veza/ansible/playbooks/10-incus-ovn.yml
2025-12-03 22:56:50 +01:00

137 lines
No EOL
3.5 KiB
YAML

---
# Install and configure Incus + OVN for Veza V5 Ultra deployment
# Single-host setup with OVN networking
- name: Install Incus and OVN for Veza V5 Ultra
hosts: edge
become: true
gather_facts: true
pre_tasks:
- name: Update package cache
apt:
update_cache: true
cache_valid_time: 3600
- name: Install snapd if not present
apt:
name: snapd
state: present
- name: Enable snapd service
systemd:
name: snapd
state: started
enabled: true
- name: Create snapd socket symlink
file:
src: /var/lib/snapd/snapd.socket
dest: /run/snapd.socket
state: link
failed_when: false
- name: Wait for snapd to be ready
wait_for:
path: /run/snapd.socket
timeout: 30
tasks:
- name: Install Incus via snap
command: snap install incus --classic
register: incus_install_result
failed_when: false
- name: Wait for Incus to initialize
wait_for:
timeout: 30
delegate_to: localhost
- name: Initialize Incus (standalone mode)
command: incus init --auto
register: incus_init_result
failed_when: false
- name: Display Incus init result
debug:
var: incus_init_result.stdout_lines
when: incus_init_result.stdout_lines is defined
- name: Create OVN network for Veza
command: |
incus network create veza-ovn \
--type=ovn \
--config network=veza-ovn \
--config ipv4.address=10.10.0.1/24 \
--config ipv4.nat=true \
--config ipv6.address=fd42:veza::1/64 \
--config ipv6.nat=true
register: ovn_network_result
failed_when: false
- name: Display OVN network creation result
debug:
var: ovn_network_result.stdout_lines
when: ovn_network_result.stdout_lines is defined
- name: Create Veza network profile
command: |
incus profile create veza || true
incus profile set veza security.nesting=true
incus profile set veza security.privileged=false
incus profile device add veza root disk path=/ pool=default
incus profile device add veza eth0 nic nictype=ovn parent=veza-ovn
register: profile_result
failed_when: false
- name: Display profile creation result
debug:
var: profile_result.stdout_lines
when: profile_result.stdout_lines is defined
- name: Verify Incus is running
command: incus list
register: incus_status
failed_when: false
- name: Display Incus status
debug:
var: incus_status.stdout_lines
when: incus_status.stdout_lines is defined
- name: Verify OVN network exists
command: incus network list
register: network_list
failed_when: false
- name: Display network list
debug:
var: network_list.stdout_lines
when: network_list.stdout_lines is defined
- name: Verify Veza profile exists
command: incus profile list
register: profile_list
failed_when: false
- name: Display profile list
debug:
var: profile_list.stdout_lines
when: profile_list.stdout_lines is defined
post_tasks:
- name: Show Incus version
command: incus version
register: incus_version
- name: Display Incus version
debug:
var: incus_version.stdout_lines
- name: Show system resources
command: incus info
register: incus_info
- name: Display Incus info
debug:
var: incus_info.stdout_lines