CORD-912
OpenCloud-in-a-Box script
apply VAGRANT_CWD in proper place, fix order on elk.diff application
nvme drive support for Utah cloudlab
utah cloudlab fixes
fix logic inversion on SSH keygen
rename network interface
configuration of libvirt networks
network fixes
vagrant-libvirt fails to use networks created by others
update ip addresses for OCiaB
change IP's for head/compute VM's
fix VM destroy
manually configure mgmt network
use a bogus ip address range for management network
typo
dns failure check
don't install docker on the host node
frontload more package installation
sudo on cleanup vagrant command
s/loghost/cordloghost/ to fix logging to logstash
remove now-unneccesary steps
make suitable for CiaB use
fix paths in CiaB Vagrantfile
fixed paths in a more maintainable way
set vagrantfile path in more places
bump Vagrant version, fix for compute-node naming

Change-Id: Icbaaab4e74bd18c87b17f474bd5eea347c98cfaf
diff --git a/ansible/roles/virt-nets/tasks/main.yml b/ansible/roles/virt-nets/tasks/main.yml
new file mode 100644
index 0000000..15e52e5
--- /dev/null
+++ b/ansible/roles/virt-nets/tasks/main.yml
@@ -0,0 +1,53 @@
+---
+# virt-nets/tasks/main.yml
+
+- name: Install libvirt/lxml python module
+  apt:
+    name: "{{ item }}"
+    update_cache: yes
+    cache_valid_time: 3600
+  with_items:
+    - python-libvirt
+    - python-lxml
+
+- name: collect libvirt network facts
+  virt_net:
+    command: facts
+
+- name: Tear down libvirt's default network
+  when: ansible_libvirt_networks["default"] is defined
+  virt_net:
+    command: "{{ item }}"
+    name: "default"
+  with_items:
+    - destroy
+    - undefine
+
+# note, this isn't idempotent, so may need manual fixing if it changes
+- name: Define libvirt networks settings (IP/DHCP/DNS)
+  when: "{{ ansible_libvirt_networks[item.name] is not defined }}"
+  virt_net:
+    name: "{{ item.name }}"
+    command: define
+    xml: "{{ lookup('template', 'virt_net.xml.j2') }}"
+  with_items: "{{ virt_nets }}"
+
+- name: Collect libvirt network facts after defining new network
+  virt_net:
+    command: facts
+
+- name: Start libvirt networks
+  when: "{{ ansible_libvirt_networks[item.name].state != 'active' }}"
+  virt_net:
+    name: "{{ item.name }}"
+    command: create
+    autostart: yes
+  with_items: "{{ virt_nets }}"
+
+- name: Have libvirt networks automatically start on reboot
+  when: "{{ ansible_libvirt_networks[item.name].autostart != 'yes' }}"
+  virt_net:
+    name: "{{ item.name }}"
+    autostart: yes
+  with_items: "{{ virt_nets }}"
+