rebuild xos-base image in xos-vm-install role playbook
run, which happens async to juju setup

(whitespace fix)

async testclient install

change single-node-pod.sh to use platform-install repo

reformat and minor fixes to README.md

pull xosproject/cord-app-build inside async xos-vm-install role

whitespace fixes v2

fix path for container build

don't start testclient container before databr has been plumbed

fix context

allow xos-vm-install to run longer as it's rebuilding base

daemonize lxc-start for testcliet, avoiding a hang

Change-Id: Icb5da9b69e942aaa79c8256ca5775219f63643d1
diff --git a/roles/create-vms/tasks/main.yml b/roles/create-vms/tasks/main.yml
index d12abe5..b20c82e 100644
--- a/roles/create-vms/tasks/main.yml
+++ b/roles/create-vms/tasks/main.yml
@@ -34,7 +34,7 @@
 
 - name: Update apt cache
   command: ansible services -m apt -b -u ubuntu -a "update_cache=yes"
-  
+
 - name: Update software in all the VMs
   command: ansible services -m apt -b -u ubuntu -a "upgrade=dist"
 
diff --git a/roles/docker-compose/tasks/main.yml b/roles/docker-compose/tasks/main.yml
index efb310a..5f1da1d 100644
--- a/roles/docker-compose/tasks/main.yml
+++ b/roles/docker-compose/tasks/main.yml
@@ -30,3 +30,12 @@
 - name: Copy admin-openrc.sh into XOS container
   command: ansible xos-1 -u ubuntu -m copy \
     -a "src=~/admin-openrc.sh dest={{ service_profile_repo_dest }}/{{ xos_configuration }}"
+
+- name: Wait for test client to complete installation
+  when: test_client_install
+  async_status: jid={{ test_client_playbook.ansible_job_id }}
+  register: test_client_playbook_result
+  until: test_client_playbook_result.finished
+  delay: 10
+  retries: 120
+
diff --git a/roles/test-client-install/files/test-client-playbook.yml b/roles/test-client-install/files/test-client-playbook.yml
new file mode 100644
index 0000000..ab17491
--- /dev/null
+++ b/roles/test-client-install/files/test-client-playbook.yml
@@ -0,0 +1,26 @@
+---
+- hosts: nova-compute-1
+  remote_user: ubuntu
+
+  tasks:
+    - name: Install software
+      apt:
+        name={{ item }}
+        update_cache=yes
+        cache_valid_time=3600
+      become: yes
+      with_items:
+       - lxc
+
+    # replaces: sudo sed -i 's/lxcbr0/databr/' /etc/lxc/default.conf
+    - name: set lxc bridge interface to be databr
+      become: yes
+      lineinfile:
+        dest: /etc/lxc/default.conf
+        regexp: "^lxc.network.link ="
+        line: "lxc.network.link = databr"
+
+    - name: Create testclient
+      become: yes
+      command: lxc-create -t ubuntu -n testclient
+
diff --git a/roles/test-client-install/tasks/main.yml b/roles/test-client-install/tasks/main.yml
new file mode 100644
index 0000000..d10512d
--- /dev/null
+++ b/roles/test-client-install/tasks/main.yml
@@ -0,0 +1,14 @@
+---
+# test-client-install/tasks/main.yml
+
+- name: Copy over test-client ansible playbook
+  copy:
+    src=test-client-playbook.yml
+    dest={{ ansible_user_dir }}/test-client-playbook.yml
+
+- name: Run the test-client ansible playbook
+  command: ansible-playbook {{ ansible_user_dir }}/test-client-playbook.yml
+  async: 3600
+  poll: 0
+  register: test_client_playbook
+
diff --git a/roles/xos-vm-install/defaults/main.yml b/roles/xos-vm-install/defaults/main.yml
index 64c4421..42723d9 100644
--- a/roles/xos-vm-install/defaults/main.yml
+++ b/roles/xos-vm-install/defaults/main.yml
@@ -6,7 +6,7 @@
 
 xos_configuration: "devel"
 
-xos_container_rebuild: false
+xos_container_rebuild: True
 
 service_profile_repo_url: "https://gerrit.opencord.org/p/service-profile.git"
 service_profile_repo_dest: "~/service-profile"
diff --git a/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml b/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
index 364882e..8a99769 100644
--- a/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
+++ b/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
@@ -49,24 +49,31 @@
         src=~/.ssh/id_rsa
         dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/node_key
 
-    - name: download software image
+    - name: Download Glance VM images
       get_url:
         url={{ item.url }}
         checksum={{ item.checksum }}
         dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.img
       with_items: "{{ xos_images }}"
 
+    - name: Pull database and cord-app-build image
+      become: yes
+      command: docker pull {{ item }}
+      with_items:
+        - xosproject/xos-postgres
+        - xosproject/cord-app-build
+
     - name: Pull docker images for XOS
       when: not xos_container_rebuild
       become: yes
       command: docker pull {{ item }}
       with_items:
         - xosproject/xos-base
-        - xosproject/xos-postgres
 
     - name: Rebuild XOS containers
       when: xos_container_rebuild
       command: make {{ item }}
-        chdir="{{ service_profile_repo_dest }}/containers/xos/"
+        chdir="{{ xos_repo_dest }}/containers/xos/"
       with_items:
        - base
+
diff --git a/roles/xos-vm-install/tasks/main.yml b/roles/xos-vm-install/tasks/main.yml
index 1aa66a9..a4fc803 100644
--- a/roles/xos-vm-install/tasks/main.yml
+++ b/roles/xos-vm-install/tasks/main.yml
@@ -15,7 +15,7 @@
 
 - name: Run the XOS ansible playbook
   command: ansible-playbook {{ ansible_user_dir }}/xos-setup-playbook.yml
-  async: 2400
+  async: 4800
   poll: 0
   register: xos_setup_playbook