Role conversion of playbooks
diff --git a/aztest.yml b/aztest.yml
new file mode 100644
index 0000000..81239c8
--- /dev/null
+++ b/aztest.yml
@@ -0,0 +1,16 @@
+---
+# aztest playbook, for installing OpenCloud
+
+- hosts: head
+  become: yes
+  roles:
+    #    - common-prep
+    - head-prep
+    - create-vms
+
+- hosts: compute
+  become: yes
+  roles:
+    #    - common-prep
+    - compute-prep
+
diff --git a/group_vars/aztest b/group_vars/aztest
new file mode 100644
index 0000000..33268ca
--- /dev/null
+++ b/group_vars/aztest
@@ -0,0 +1,6 @@
+---
+# file: group_vars/aztest
+
+mgmt_net_prefix: 192.168.250
+
+cloudlab: false
diff --git a/inventory/aztest b/inventory/aztest
new file mode 100644
index 0000000..1de8b89
--- /dev/null
+++ b/inventory/aztest
@@ -0,0 +1,5 @@
+[head]
+node11.opencloud.cs.arizona.edu ansible_ssh_user=ubuntu
+
+[compute]
+node12.opencloud.cs.arizona.edu ansible_ssh_user=ubuntu
diff --git a/roles/common-prep/tasks/main.yml b/roles/common-prep/tasks/main.yml
new file mode 100644
index 0000000..0e5474d
--- /dev/null
+++ b/roles/common-prep/tasks/main.yml
@@ -0,0 +1,16 @@
+---
+# file: roles/common-prep/tasks/main.yml
+
+- name: Upgrade system to current using apt
+  apt: update_cache=yes upgrade=dist
+
+- name: Install standard packages
+  apt:  pkg={{ item }} state=present
+  with_items:
+   - tmux
+   - vim
+
+- name: Enable vim syntax highlighting
+  lineinfile: dest=/etc/vim/vimrc
+    regexp="^\s*syntax on"
+    line="syntax on"
diff --git a/roles/compute-prep/tasks/main.yml b/roles/compute-prep/tasks/main.yml
new file mode 100644
index 0000000..aedd62a
--- /dev/null
+++ b/roles/compute-prep/tasks/main.yml
@@ -0,0 +1,8 @@
+---
+# file: roles/compute-prep/tasks/main.yml
+
+- name:  Install packages
+  apt: name={{ item }} state=latest update_cache=yes
+  with_items:
+    - python-yaml
+
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
diff --git a/roles/head-prep/tasks/main.yml b/roles/head-prep/tasks/main.yml
new file mode 100644
index 0000000..d0638b6
--- /dev/null
+++ b/roles/head-prep/tasks/main.yml
@@ -0,0 +1,76 @@
+---
+# file: roles/head-prep/tasks/main.yml
+
+- name:  Install prerequisites for using PPA repos
+  apt:
+    name={{ item }}
+  with_items:
+    - python-pycurl
+    - software-properties-common
+
+- name: Add Ansible/Juju repositories
+  apt_repository:
+    repo={{ item }}
+  with_items:
+     - "ppa:juju/stable"
+     - "ppa:ansible/ansible"
+
+- name: Install packages
+  apt:
+    name={{ item }}
+    state=latest
+    update_cache=yes
+  with_items:
+    - ansible
+    - uvtool
+    - git
+    - bzr
+    - juju-core
+    - python-novaclient
+    - python-neutronclient
+    - python-keystoneclient
+    - python-glanceclient
+
+- name: Obtain the juju-ansible tool from github
+  git:
+    repo=https://github.com/cmars/juju-ansible.git
+    dest=/usr/local/src/juju-ansible
+    version="HEAD"
+
+- name: Create symlinks to the juju-ansible tool
+  file:
+    src=/usr/local/src/juju-ansible/juju-ansible
+    dest={{ item }}
+    state=link
+  with_items:
+    - "/usr/local/bin/juju-ansible"
+    - "/usr/local/bin/juju-ansible-playbook"
+
+- name: Prepare user account and generate SSH key
+  user:
+    name={{ ansible_env['SUDO_USER'] }}
+    generate_ssh_key=yes
+    groups="libvirtd" append=yes
+
+- name: Get public key
+  shell: cat {{ ansible_env['PWD'] }}/.ssh/id_rsa.pub
+  register: sshkey
+
+- name: Add key to this user account
+  authorized_key:
+    user={{ ansible_env['SUDO_USER'] }}
+    key="{{ sshkey.stdout }}"
+
+- name: Copy keypair to /tmp
+  shell: cp -f {{ ansible_user_dir }}/.ssh/{{ item }} /tmp; chmod +r /tmp/{{ item }}
+  with_items:
+    - id_rsa
+    - id_rsa.pub
+
+- name: Get ubuntu image for uvtool
+  shell: uvt-simplestreams-libvirt sync --source http://cloud-images.ubuntu.com/daily release={{ ansible_distribution_release }} arch=amd64
+
+
+
+
+
diff --git a/roles/test-prep/tasks/main.yml b/roles/test-prep/tasks/main.yml
new file mode 100644
index 0000000..1ebf604
--- /dev/null
+++ b/roles/test-prep/tasks/main.yml
@@ -0,0 +1,9 @@
+---
+# roles/test-prep/tasks/main.yml
+
+- name: Add local resolver to /etc/resolv.conf
+  lineinfile:
+    dest=/etc/resolv.conf
+    insertafter=".*DO NOT EDIT THIS FILE.*" 
+    line="nameserver 192.168.122.1"
+