Role conversion of playbooks
diff --git a/roles/create-vms/defaults/main.yml b/roles/create-vms/defaults/main.yml
new file mode 100644
index 0000000..d8d5ea7
--- /dev/null
+++ b/roles/create-vms/defaults/main.yml
@@ -0,0 +1,17 @@
+---
+# roles/create-vms/defaults/main.yml
+# default variables for xos-install role
+
+head_vm_list:
+ - { name: "juju", cpu: "1", memMB: "2048", diskGB: "20" }
+ - { name: "mysql", cpu: "2", memMB: "4096", diskGB: "40" }
+ - { name: "rabbitmq-server", cpu: "2", memMB: "4096", diskGB: "40" }
+ - { name: "keystone", cpu: "2", memMB: "4096", diskGB: "40" }
+ - { name: "glance", cpu: "2", memMB: "4096", diskGB: "160" }
+ - { name: "nova-cloud-controller", cpu: "2", memMB: "4096", diskGB: "40" }
+ - { name: "neutron-gateway", cpu: "2", memMB: "4096", diskGB: "40" }
+ - { name: "neutron-api", cpu: "2", memMB: "4096", diskGB: "40" }
+ - { name: "openstack-dashboard", cpu: "1", memMB: "2048", diskGB: "20" }
+ - { name: "ceilometer", cpu: "1", memMB: "2048", diskGB: "20" }
+ - { name: "nagios", cpu: "1", memMB: "2048", diskGB: "20" }
+
diff --git a/roles/create-vms/tasks/main.yml b/roles/create-vms/tasks/main.yml
new file mode 100644
index 0000000..123b86b
--- /dev/null
+++ b/roles/create-vms/tasks/main.yml
@@ -0,0 +1,18 @@
+---
+# roles/create-vms/tasks/main.yml
+
+- name: create Virtual Machines with uvt-kvm
+ shell: uvt-kvm create {{ item.name }} --cpu={{ item.cpu }} --memory={{ item.memMB }} --disk={{ item.diskGB }}; \
+ uvt-kvm wait --insecure {{ item.name }}
+ creates=/var/lib/uvtool/libvirt/images/{{ item.name }}.qcow
+ with_items: head_vm_list
+
+- name: discover VM IP addresses
+ shell: uvt-kvm ip {{ item.name }}
+ with_items: head_vm_list
+ register: vm_ip
+
+- name: Create /etc/hosts with VM IP addresses
+ template:
+ src=hosts.j2
+ dest=/etc/hosts
diff --git a/roles/create-vms/templates/hosts.j2 b/roles/create-vms/templates/hosts.j2
new file mode 100644
index 0000000..ebc3706
--- /dev/null
+++ b/roles/create-vms/templates/hosts.j2
@@ -0,0 +1,10 @@
+127.0.0.1 localhost
+127.0.1.1 ubuntu
+{% for host in vm_ip.results -%}
+{{ host.stdout }} {{ host.item.name }}
+{% endfor -%}
+
+# The following lines are desirable for IPv6 capable hosts
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters