Enhanced the installer's test mode such that multiple development users
can create independent vagrant VM based clusters on the same bare metal
server. This reduces the number of servers required to do development
and testing of the voltha HA cluster.
Updated the production installer to start a 3 node docker swarm cluster
once installation is completed.
Added an option to the production installer to use a different QEMU/KVM
network to enable testing of the installer using vagrant based VMs on
the same server as the installer. The production installer will use the
default network otherwise.
Further provisioning of the installed environment will be submitted in
subsequent updates as the HA implementation progresses.

Change-Id: I62424e882d4a7f322acb9e26a9ee588c6fa91ca1
diff --git a/install/ansible/group_vars/all b/install/ansible/group_vars/all
index 311ec96..e13d45f 100644
--- a/install/ansible/group_vars/all
+++ b/install/ansible/group_vars/all
@@ -8,6 +8,8 @@
 docker_py_version: "1.7.0"
 netifaces_version: "0.10.4"
 target_voltha_home: /home/voltha
+docker_daemon_json: daemon.json
+docker_daemon_json_dest: /etc/docker
 voltha_containers:
   - voltha/nginx
   - voltha/grafana
diff --git a/install/ansible/roles/cluster-host/tasks/cluster-host.yml b/install/ansible/roles/cluster-host/tasks/cluster-host.yml
index 20330c4..b9b2146 100644
--- a/install/ansible/roles/cluster-host/tasks/cluster-host.yml
+++ b/install/ansible/roles/cluster-host/tasks/cluster-host.yml
@@ -48,6 +48,12 @@
   when: target == "cluster"
   tags: [cluster_host]
 
+- name: apt lists are up-to-date
+  copy:
+    src: "/var/lib/apt/lists"
+    dest: "/var/lib/apt"
+  tags: [cluster_host]
+
 - name: Dependent software is installed
   command: dpkg -i "{{ target_voltha_home }}/deb_files/{{ item }}"
   with_items: "{{ deb_files }}"
diff --git a/install/ansible/roles/voltha/tasks/voltha.yml b/install/ansible/roles/voltha/tasks/voltha.yml
index d6884e5..a52b7d9 100644
--- a/install/ansible/roles/voltha/tasks/voltha.yml
+++ b/install/ansible/roles/voltha/tasks/voltha.yml
@@ -76,6 +76,30 @@
   when: target == "cluster"

   tags: [voltha]

 

+# Update the insecure registry to reflect the current installer.

+# The installer name can change depending on whether test mode

+# is being used or not.

+- name: Enable insecure install registry

+  template:

+    src: "{{ docker_daemon_json }}"

+    dest: "{{ docker_daemon_json_dest }}"

+  register: copy_result

+  when: target == "installer"

+  tags: [voltha]

+

+- name: Debain Daemon is reloaded

+  command: systemctl daemon-reload

+  when: copy_result|changed and is_systemd is defined and target == "installer"

+  tags: [voltha]

+

+- name: Debian Docker service is restarted

+  service:

+    name: docker

+    state: restarted

+  when: copy_result|changed or user_result|changed

+  when: target == "installer"

+  tags: [voltha]

+

 - name: Docker images are re-tagged to registry for push

   command: docker tag {{ item }} {{ docker_push_registry }}/{{ item }}

   with_items: "{{ voltha_containers }}"

diff --git a/install/ansible/voltha.yml b/install/ansible/voltha.yml
index f3a1cf4..b9a2c24 100644
--- a/install/ansible/voltha.yml
+++ b/install/ansible/voltha.yml
@@ -9,4 +9,4 @@
     - docker
     - docker-compose
     - voltha
-    - java
+#    - java