CORD-1000 Build and publish XOS images on corddev

Change-Id: I27c872fc5c835949e45a108f3b829e96156b0d33
diff --git a/ansible/roles/docker/tasks/debian.yml b/ansible/roles/docker/tasks/debian.yml
index 93299d5..f58c0c7 100644
--- a/ansible/roles/docker/tasks/debian.yml
+++ b/ansible/roles/docker/tasks/debian.yml
@@ -23,7 +23,7 @@
 - name: Debian docker-py is present
   pip:
     name: docker-py
-    version: 1.6.0
+    version: 1.10.6
     state: present
   tags: [docker]
 
@@ -42,4 +42,3 @@
   tags: [docker]
   notify:
     - docker-restart
-
diff --git a/build.gradle b/build.gradle
index 94d5e02..e138caf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -33,6 +33,7 @@
 
 evaluationDependsOn(':maas')
 evaluationDependsOn(':onos-apps')
+evaluationDependsOn(':orchestration:xos')
 
 allprojects {
     apply plugin: 'base'
@@ -218,10 +219,22 @@
     "pki-install-playbook.yml" ]
 }
 
+task PIcreateProfile(type: Exec) {
+  dependsOn PIinstallPKI
+
+  workingDir "platform-install"
+  executable = "ansible-playbook"
+  args = [ "-i", "../genconfig/cord-inv",
+    "--extra-vars", "@../genconfig/config.yml",
+    "--extra-vars", "deploy_docker_tag="+targetTag,
+    "--extra-vars", "deploy_docker_registry=docker-registry:5000/",
+    "cord-profile-playbook.yml" ]
+}
+
 task PIprepPlatform(type: Exec) {
   dependsOn CopyCord
   dependsOn ChownCord
-  dependsOn PIinstallPKI
+  dependsOn PIcreateProfile
 
   def ansible_cmd = "cd $config.common.cord_dir/build/platform-install; ansible-playbook -i inventory/head-localhost --extra-vars @$config.common.cord_dir/build/genconfig/config.yml prep-platform-playbook.yml"
 
@@ -237,14 +250,16 @@
 }
 
 task PIdeployONOS (type: Exec) {
-  def ansible_cmd = "cd $config.common.cord_dir/build/platform-install; ansible-playbook -i inventory/head-localhost --extra-vars @$config.common.cord_dir/build/genconfig/config.yml deploy-onos-playbook.yml"
+  def extra_vars = "--extra-vars deploy_docker_tag="+targetTag+" --extra-vars deploy_docker_registry=docker-registry:5000/"
+  def ansible_cmd = "cd $config.common.cord_dir/build/platform-install; ansible-playbook -i inventory/head-localhost --extra-vars @$config.common.cord_dir/build/genconfig/config.yml "+extra_vars+" deploy-onos-playbook.yml"
 
   executable = "ssh"
   args = ["-p", "$config.headnode.ansible_ssh_port", "$config.headnode.ansible_user@$config.headnode.ip", ansible_cmd ]
 }
 
 task PIdeployXOS (type: Exec) {
-  def ansible_cmd = "cd $config.common.cord_dir/build/platform-install; ansible-playbook -i inventory/head-localhost --extra-vars @$config.common.cord_dir/build/genconfig/config.yml deploy-xos-playbook.yml"
+  def extra_vars = "--extra-vars deploy_docker_tag="+targetTag+" --extra-vars deploy_docker_registry=docker-registry:5000/"
+  def ansible_cmd = "cd $config.common.cord_dir/build/platform-install; ansible-playbook -i inventory/head-localhost --extra-vars @$config.common.cord_dir/build/genconfig/config.yml "+extra_vars+" launch-xos-playbook.yml"
 
   executable = "ssh"
   args = ["-p", "$config.headnode.ansible_ssh_port", "$config.headnode.ansible_user@$config.headnode.ip", ansible_cmd ]
@@ -278,6 +293,8 @@
 project('onos-apps').publishMavenRepoImage.dependsOn project(':maas').prime
 project(':onos-apps').deploy.dependsOn project(':maas').deployBase
 
+project(':orchestration:xos').buildImages.dependsOn rootProject."tagxosproject/xos-base"
+
 task PIdeployPlatform {
      dependsOn CopyCord
      dependsOn ChownCord
diff --git a/settings.gradle b/settings.gradle
index ffceecd..3f47032 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -2,3 +2,5 @@
 include 'platform-install'
 includeFlat 'onos-apps'
 
+include 'orchestration:xos'
+project(':orchestration:xos').projectDir = "$rootDir/../orchestration/xos" as File