deploy last

Change-Id: Ibf05cc285ee50e71d30ca225fca5b4d974f9be72
diff --git a/build.gradle b/build.gradle
index d27c237..2b1f1db 100644
--- a/build.gradle
+++ b/build.gradle
@@ -170,40 +170,42 @@
 }
 
 task deploy (dependsOn: publishMavenRepoImage, type: Exec) {
-    println "Using deployment config: $deployConfig"
-    File configFile = new File(deployConfig)
-    def yaml = new Yaml()
-    def config = yaml.load(configFile.newReader())
+    doLast {
+        println "Using deployment config: $deployConfig"
+        File configFile = new File(deployConfig)
+        def yaml = new Yaml()
+        def config = yaml.load(configFile.newReader())
 
-    executable = "ansible-playbook"
-    args = ["-i", config.seedServer.ip + ',']
+        executable = "ansible-playbook"
+        args = ["-i", config.seedServer.ip + ',']
 
-    if ( config.seedServer.user != null && config.seedServer.user != "" ) {
-        args = args << "--user=$config.seedServer.user"
+        if ( config.seedServer.user != null && config.seedServer.user != "" ) {
+            args = args << "--user=$config.seedServer.user"
+        }
+
+        def extraVars = []
+        if (config.seedServer) {
+            extraVars = extraVars.p(config.seedServer.extraVars)
+                    .p(config.seedServer.password, "ansible_ssh_pass")
+                    .p(config.seedServer.sudoPassword, "ansible_sudo_pass")
+                    .p(config.seedServer.domain, "domain")
+        }
+
+        if (config.otherServers) {
+            extraVars = extraVars.p(config.otherServers.location, "prov_location")
+                .p(config.otherServers.rolesPath, "prov_role_path")
+                .p(config.otherServers.role, "prov_role")
+        }
+
+        if (config.docker) {
+            extraVars = extraVars.p(config.docker.registry, "docker_registry")
+                .p(config.docker.imageVersion, "docker_image_version")
+        }
+
+        def skipTags = [].p(config.seedServer.skipTags)
+
+        args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "mavenrepo.yml"   
     }
-
-    def extraVars = []
-    if (config.seedServer) {
-        extraVars = extraVars.p(config.seedServer.extraVars)
-            .p(config.seedServer.password, "ansible_ssh_pass")
-            .p(config.seedServer.sudoPassword, "ansible_sudo_pass")
-            .p(config.seedServer.domain, "domain")
-    }
-
-    if (config.otherServers) {
-        extraVars = extraVars.p(config.otherServers.location, "prov_location")
-        .p(config.otherServers.rolesPath, "prov_role_path")
-        .p(config.otherServers.role, "prov_role")
-    }
-
-    if (config.docker) {
-        extraVars = extraVars.p(config.docker.registry, "docker_registry")
-            .p(config.docker.imageVersion, "docker_image_version")
-    }
-
-    def skipTags = [].p(config.seedServer.skipTags)
-
-    args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "mavenrepo.yml"   
 }