Add libvirt-network role, libvirt-domain test

Change-Id: Ie8b607e308118c859e297c5b6b89a75ae0ed610b
This commit is contained in:
Kostiantyn Kalynovskyi 2020-01-15 19:03:08 +00:00
parent 68157859a7
commit f3dbea4ccd
3 changed files with 41 additions and 17 deletions

View File

@ -7,7 +7,7 @@
group: "{{ libvirt_domain.libvirt_vm_log_owner }}"
recurse: true
mode: 0770
when: "libvirt_domain.console_log_enabled | default('false') | bool"
when: "libvirt_domain.console_log_enabled | default(false)"
- name: Validate VM interfaces
include_tasks: check-interface.yml

View File

@ -4,6 +4,14 @@
- name: install libvirt
include_role:
name: libvirt-install
- name: create networks
include_role:
name: libvirt-network
vars:
network_action: "{{ item.network_action }}"
libvirt_network: "{{ item }}"
ansible_become: true
with_items: "{{ libvirt_networks }}"
- name: create pool
include_role:
name: libvirt-pool

View File

@ -26,19 +26,35 @@ libvirt_domain:
interfaces:
- network: 'provision-network'
libvirt_network:
name: provision-network
spec:
forward:
mode: nat
nat:
port:
- start: 1024
end: 65535
bridge:
name: "prov-net-br"
stp: 'on'
delay: '0'
ip:
address: "172.22.0.1"
netmask: "255.255.255.0"
libvirt_networks:
- network_action: create
autostart: false
name: oob-net
spec:
bridge:
name: oob-net
stp: 'on'
delay: '0'
ip:
address: "10.23.22.1"
netmask: "255.255.255.0"
dhcp:
- range:
start: 10.23.22.100
end: 10.23.22.199
- network_action: create
name: provision-network
spec:
forward:
mode: nat
nat:
port:
- start: 1024
end: 65535
bridge:
name: "prov-net-br"
stp: 'on'
delay: '0'
ip:
address: "172.22.0.1"
netmask: "255.255.255.0"