summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2018-10-05 09:52:06 +0200
committerManuel Buil <mbuil@suse.com>2018-10-15 15:57:32 +0000
commitb9b00f336f20bad8bc58b325172ebf9c71c83b6a (patch)
treeef647fabc31ab694bbd5966d09e9064ebbf0d4bb /xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml
parenteab5448287464ca3900a3e7495e27ac1a2cf1dc9 (diff)
[baremetal] Add two interfaces to the opnfv vm
opnfv vm requires connectivity to two physical interfaces of the host. These interfaces are: 1 - admin, where DHCP requests will arrive from blades to do PXE boot 2 - mgmt, which connects to the mgmt of the blades to do the ansible configuration To achive this, it is required: 1 - Two libvirt networks that connect to two different linux bridges. The important physical interfaces are connected to them. The interfaces name is fetched from the idf 2 - Two templates representing the new libvirt networks (net-mgmt.xml.j2 and net-admin.xml.j2) 3 - Two interfaces defined in vm.xml.j2 Change-Id: I9037aa36802cfde44717b9394bab79b22d7dfaab Signed-off-by: Manuel Buil <mbuil@suse.com>
Diffstat (limited to 'xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml')
-rw-r--r--xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml26
1 files changed, 17 insertions, 9 deletions
diff --git a/xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml b/xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml
index 3f49e756..faf19a6f 100644
--- a/xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml
+++ b/xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml
@@ -46,15 +46,24 @@
# with the default 192.168.122/0/24 network
- name: destroy libvirt network
virt_net:
- name: "{{ vm_network }}"
+ name: "{{ item }}"
+ state: absent
+ uri: "{{ vm_libvirt_uri }}"
+
+# Ubuntu creates a default network when installing libvirt.
+# This network uses the 192.168.122.0/24 range and thus
+# conflicts with our admin network
+- name: destroy libvirt network
+ virt_net:
+ name: "default"
state: absent
uri: "{{ vm_libvirt_uri }}"
- name: ensure libvirt network is present
virt_net:
- name: "{{ vm_network }}"
+ name: "{{ item }}"
state: present
- xml: "{{ lookup('template', 'net.xml.j2') }}"
+ xml: "{{ lookup('template', 'net-'+item+'.xml.j2') }}"
uri: "{{ vm_libvirt_uri }}"
- name: find facts on libvirt networks
@@ -62,29 +71,28 @@
command: facts
uri: "{{ vm_libvirt_uri }}"
-# NOTE(pas-ha) yet another place where non-local libvirt will not work
- name: "Delete network interface if virtual network is not active"
- command: ip link del {{ ansible_libvirt_networks[vm_network].bridge }}
+ command: ip link del {{ ansible_libvirt_networks[item].bridge }}
when:
- - ansible_libvirt_networks[vm_network].state != 'active'
+ - ansible_libvirt_networks[item].state != 'active'
- vm_libvirt_uri == 'qemu:///system'
ignore_errors: yes
- name: set libvirt network to autostart
virt_net:
- name: "{{ vm_network }}"
+ name: "{{ item }}"
autostart: yes
uri: "{{ vm_libvirt_uri }}"
- name: ensure libvirt network is running
virt_net:
- name: "{{ vm_network }}"
+ name: "{{ item }}"
state: active
uri: "{{ vm_libvirt_uri }}"
- name: get libvirt network status
virt_net:
- name: "{{ vm_network }}"
+ name: "{{ item }}"
command: status
uri: "{{ vm_libvirt_uri }}"
register: test_vm_net_status