Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 the original author or authors. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | import org.opencord.gradle.rules.* |
| 18 | import org.yaml.snakeyaml.Yaml |
| 19 | |
| 20 | allprojects { |
| 21 | apply plugin: 'base' |
| 22 | apply plugin: 'de.gesellix.docker' |
| 23 | //apply plugin: 'com.tmiyamon.config' |
| 24 | |
| 25 | docker { |
| 26 | // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock' |
| 27 | // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376' |
| 28 | // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default" |
| 29 | // authConfigPlain = [ |
| 30 | // "username" : "joe", |
| 31 | // "password" : "some-pw-as-needed", |
| 32 | // "email" : "joe@acme.com", |
| 33 | // "serveraddress" : "https://index.docker.io/v1/" |
| 34 | // ] |
| 35 | } |
| 36 | } |
| 37 | |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 38 | def getCordAppVersion = { -> |
| 39 | def StdOut = new ByteArrayOutputStream() |
| 40 | exec { |
| 41 | commandLine "xpath", "-q", "-e", "project/version/text()", "../../onos-apps/apps/pom.xml" |
| 42 | standardOutput = StdOut |
| 43 | } |
| 44 | return StdOut.toString().trim() |
| 45 | } |
| 46 | |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 47 | ext { |
| 48 | |
| 49 | // Upstream registry to simplify filling out the comps table below |
| 50 | upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io' |
| 51 | |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 52 | // Deployment target config file (yaml format); this can be overwritten from the command line |
| 53 | // using the -PdeployConfig=<file-path> syntax. |
| 54 | deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml' |
| 55 | |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 56 | println "Using deployment config: $deployConfig" |
| 57 | File configFile = new File(deployConfig) |
| 58 | def yaml = new Yaml() |
| 59 | config = yaml.load(configFile.newReader()) |
| 60 | |
| 61 | |
| 62 | // Target registry to be used to publish docker images needed for deployment |
| 63 | targetReg = project.hasProperty('targetReg') |
| 64 | ? project.getProperty('targetReg') |
| 65 | : config.docker && config.docker.registry |
| 66 | ? config.docker.registry |
David K. Bainbridge | 94b2471 | 2016-11-15 15:09:42 -0800 | [diff] [blame] | 67 | : config.seedServer.ip |
| 68 | ? config.seedServer.ip + ":5000" |
| 69 | : 'localhost:5000' |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 70 | |
| 71 | // The tag used to tag the docker images push to the target registry |
| 72 | targetTag = project.hasProperty('targetTag') |
| 73 | ? project.getProperty('targetTag') |
| 74 | : config.docker && config.docker.imageVersion |
| 75 | ? config.docker.imageVersion |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 76 | : 'candidate' |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 77 | |
| 78 | println "targetReg = $targetReg, targetTag = $targetTag" |
| 79 | |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 80 | |
| 81 | // Version of the CORD apps to load into ONOS |
| 82 | cordAppVersion = project.hasProperty('cordAppVersion') |
| 83 | ? project.getProperty('cordAppVersion') |
| 84 | : getCordAppVersion() |
| 85 | |
| 86 | println "CORD app version: $cordAppVersion" |
| 87 | |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 88 | // Component table |
| 89 | comps = [ |
| 90 | ] |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 91 | } |
| 92 | |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 93 | task copyAnsibleInventory(type: Copy) { |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 94 | from 'inventory/templates/single-prod' |
| 95 | into 'inventory' |
| 96 | expand([ |
| 97 | prod: config.seedServer.ip, |
| 98 | ]) |
| 99 | } |
| 100 | |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 101 | // ------------- PlaceHolders ---------------- |
| 102 | |
| 103 | task updateDocker (type: Exec) { |
| 104 | commandLine 'sudo', 'utils/enable-remote-docker-registry', "$targetReg" |
| 105 | } |
| 106 | |
| 107 | task prime { |
| 108 | // TODO this is a place-holder. |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 109 | // dependsOn updateDocker |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | // ---------------- Useful tasks ---------------- |
| 113 | |
Andy Bavier | 1b8a537 | 2016-07-07 19:36:21 -0400 | [diff] [blame] | 114 | List.metaClass.asParam = { prefix, sep -> |
| 115 | if (delegate.size() == 0) { |
| 116 | "" |
| 117 | } |
| 118 | String result = "--" + prefix + "=" |
| 119 | String p = "" |
| 120 | delegate.each { |
| 121 | result += p + "${it}" |
| 122 | p = sep |
| 123 | } |
| 124 | result |
| 125 | } |
| 126 | |
| 127 | List.metaClass.p = { value, name -> |
| 128 | if (value != null && value != "") { |
| 129 | delegate << name + "=" + value |
| 130 | } else { |
| 131 | delegate |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | List.metaClass.p = { spec -> |
| 136 | if (spec != null && spec != "") { |
| 137 | delegate += spec |
| 138 | } else { |
| 139 | delegate |
| 140 | } |
| 141 | } |
| 142 | |
alshabib | fe09d77 | 2016-08-29 16:15:56 -0700 | [diff] [blame] | 143 | task fetch << { |
| 144 | logger.info 'Platform install has nothing to fetch' |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 145 | } |
| 146 | |
alshabib | fe09d77 | 2016-08-29 16:15:56 -0700 | [diff] [blame] | 147 | task buildImages << { |
| 148 | logger.info 'Platform install has nothing to build' |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | task publishImages { |
| 152 | comps.each { name, spec -> if (spec.type == 'image') { dependsOn "publish" + name } } |
| 153 | } |
| 154 | |
| 155 | task publish { |
| 156 | dependsOn publishImages |
| 157 | } |
| 158 | |
| 159 | tasks.addRule(new DockerFetchRule(project)) |
| 160 | tasks.addRule(new DockerPublishRule(project)) |
| 161 | tasks.addRule(new DockerTagRule(project)) |
| 162 | tasks.addRule(new GitSubmoduleUpdateRule(project)) |
| 163 | |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 164 | task prepPlatform(type: Exec) { |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 165 | dependsOn copyAnsibleInventory |
Andy Bavier | adea0fd | 2016-07-06 05:26:26 -0400 | [diff] [blame] | 166 | |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 167 | executable = "ansible-playbook" |
| 168 | args = ["-i", "inventory/single-prod"] |
| 169 | |
| 170 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 171 | args = args << "--user=$config.seedServer.user" |
| 172 | } |
| 173 | |
| 174 | def extraVars = [] |
| 175 | if (config.seedServer) { |
| 176 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 177 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 178 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 179 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 180 | .p(config.seedServer.management_ip, "management_ip") |
| 181 | .p(config.seedServer.management_network, "management_network") |
| 182 | .p(config.seedServer.management_iface, "management_iface") |
| 183 | .p(config.seedServer.external_ip, "external_ip") |
| 184 | .p(config.seedServer.external_network, "external_network") |
| 185 | .p(config.seedServer.external_iface, "external_iface") |
| 186 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 187 | .p(config.seedServer.fabric_network, "fabric_network") |
| 188 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 189 | .p(config.seedServer.domain, "domain") |
| 190 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 191 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 192 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 193 | .p(config.seedServer.port, "ansible_ssh_port") |
| 194 | } |
| 195 | |
| 196 | if (config.otherServers) { |
| 197 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 198 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 199 | .p(config.otherServers.role, "prov_role") |
| 200 | } |
| 201 | |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 202 | extraVars = extraVars.p("$targetReg", "deploy_docker_registry") |
| 203 | .p("$targetTag", "deploy_docker_tag") |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 204 | .p("$cordAppVersion", "cord_app_version") |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 205 | |
| 206 | def skipTags = [].p(config.seedServer.skipTags) |
| 207 | |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 208 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-prep-platform.yml" |
Andy Bavier | 6dbb1a3 | 2016-07-06 07:12:50 -0400 | [diff] [blame] | 209 | } |
Andy Bavier | 1b8a537 | 2016-07-07 19:36:21 -0400 | [diff] [blame] | 210 | |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 211 | task deployOpenStack (type: Exec) { |
Andy Bavier | 1b8a537 | 2016-07-07 19:36:21 -0400 | [diff] [blame] | 212 | executable = "ansible-playbook" |
| 213 | args = ["-i", "inventory/single-prod"] |
| 214 | |
| 215 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 216 | args = args << "--user=$config.seedServer.user" |
| 217 | } |
| 218 | |
| 219 | def extraVars = [] |
| 220 | if (config.seedServer) { |
| 221 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 222 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 223 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 224 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 225 | .p(config.seedServer.management_ip, "management_ip") |
| 226 | .p(config.seedServer.management_network, "management_network") |
| 227 | .p(config.seedServer.management_iface, "management_iface") |
| 228 | .p(config.seedServer.external_ip, "external_ip") |
| 229 | .p(config.seedServer.external_network, "external_network") |
| 230 | .p(config.seedServer.external_iface, "external_iface") |
| 231 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 232 | .p(config.seedServer.fabric_network, "fabric_network") |
| 233 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 234 | .p(config.seedServer.domain, "domain") |
| 235 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 236 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 237 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 238 | .p(config.seedServer.port, "ansible_ssh_port") |
| 239 | } |
| 240 | |
| 241 | if (config.otherServers) { |
| 242 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 243 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 244 | .p(config.otherServers.role, "prov_role") |
| 245 | } |
| 246 | |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 247 | extraVars = extraVars.p("$targetReg", "deploy_docker_registry") |
| 248 | .p("$targetTag", "deploy_docker_tag") |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 249 | .p("$cordAppVersion", "cord_app_version") |
Andy Bavier | 1b8a537 | 2016-07-07 19:36:21 -0400 | [diff] [blame] | 250 | |
| 251 | def skipTags = [].p(config.seedServer.skipTags) |
| 252 | |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 253 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-deploy-openstack.yml" |
| 254 | } |
| 255 | |
| 256 | task deployONOS (type: Exec) { |
| 257 | executable = "ansible-playbook" |
| 258 | args = ["-i", "inventory/single-prod"] |
| 259 | |
| 260 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 261 | args = args << "--user=$config.seedServer.user" |
| 262 | } |
| 263 | |
| 264 | def extraVars = [] |
| 265 | if (config.seedServer) { |
| 266 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 267 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 268 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 269 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 270 | .p(config.seedServer.management_ip, "management_ip") |
| 271 | .p(config.seedServer.management_network, "management_network") |
| 272 | .p(config.seedServer.management_iface, "management_iface") |
| 273 | .p(config.seedServer.external_ip, "external_ip") |
| 274 | .p(config.seedServer.external_network, "external_network") |
| 275 | .p(config.seedServer.external_iface, "external_iface") |
| 276 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 277 | .p(config.seedServer.fabric_network, "fabric_network") |
| 278 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 279 | .p(config.seedServer.domain, "domain") |
| 280 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 281 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 282 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 283 | .p(config.seedServer.port, "ansible_ssh_port") |
| 284 | } |
| 285 | |
| 286 | if (config.otherServers) { |
| 287 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 288 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 289 | .p(config.otherServers.role, "prov_role") |
| 290 | } |
| 291 | |
| 292 | extraVars = extraVars.p("$targetReg", "deploy_docker_registry") |
| 293 | .p("$targetTag", "deploy_docker_tag") |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 294 | .p("$cordAppVersion", "cord_app_version") |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 295 | |
| 296 | def skipTags = [].p(config.seedServer.skipTags) |
| 297 | |
| 298 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-deploy-onos.yml" |
| 299 | } |
| 300 | |
| 301 | task deployXOS (type: Exec) { |
| 302 | executable = "ansible-playbook" |
| 303 | args = ["-i", "inventory/single-prod"] |
| 304 | |
| 305 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 306 | args = args << "--user=$config.seedServer.user" |
| 307 | } |
| 308 | |
| 309 | def extraVars = [] |
| 310 | if (config.seedServer) { |
| 311 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 312 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 313 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 314 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 315 | .p(config.seedServer.management_ip, "management_ip") |
| 316 | .p(config.seedServer.management_network, "management_network") |
| 317 | .p(config.seedServer.management_iface, "management_iface") |
| 318 | .p(config.seedServer.external_ip, "external_ip") |
| 319 | .p(config.seedServer.external_network, "external_network") |
| 320 | .p(config.seedServer.external_iface, "external_iface") |
| 321 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 322 | .p(config.seedServer.fabric_network, "fabric_network") |
| 323 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 324 | .p(config.seedServer.domain, "domain") |
| 325 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 326 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 327 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 328 | .p(config.seedServer.port, "ansible_ssh_port") |
| 329 | } |
| 330 | |
| 331 | if (config.otherServers) { |
| 332 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 333 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 334 | .p(config.otherServers.role, "prov_role") |
| 335 | } |
| 336 | |
| 337 | extraVars = extraVars.p("$targetReg", "deploy_docker_registry") |
| 338 | .p("$targetTag", "deploy_docker_tag") |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 339 | .p("$cordAppVersion", "cord_app_version") |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 340 | |
| 341 | def skipTags = [].p(config.seedServer.skipTags) |
| 342 | |
| 343 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-deploy-xos.yml" |
| 344 | } |
| 345 | |
| 346 | task setupAutomation (type: Exec) { |
| 347 | executable = "ansible-playbook" |
| 348 | args = ["-i", "inventory/single-prod"] |
| 349 | |
| 350 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 351 | args = args << "--user=$config.seedServer.user" |
| 352 | } |
| 353 | |
| 354 | def extraVars = [] |
| 355 | if (config.seedServer) { |
| 356 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 357 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 358 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 359 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 360 | .p(config.seedServer.management_ip, "management_ip") |
| 361 | .p(config.seedServer.management_network, "management_network") |
| 362 | .p(config.seedServer.management_iface, "management_iface") |
| 363 | .p(config.seedServer.external_ip, "external_ip") |
| 364 | .p(config.seedServer.external_network, "external_network") |
| 365 | .p(config.seedServer.external_iface, "external_iface") |
| 366 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 367 | .p(config.seedServer.fabric_network, "fabric_network") |
| 368 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 369 | .p(config.seedServer.domain, "domain") |
| 370 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 371 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 372 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 373 | .p(config.seedServer.port, "ansible_ssh_port") |
| 374 | } |
| 375 | |
| 376 | if (config.otherServers) { |
| 377 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 378 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 379 | .p(config.otherServers.role, "prov_role") |
| 380 | } |
| 381 | |
| 382 | extraVars = extraVars.p("$targetReg", "deploy_docker_registry") |
| 383 | .p("$targetTag", "deploy_docker_tag") |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 384 | .p("$cordAppVersion", "cord_app_version") |
Andy Bavier | 12262e7 | 2016-12-02 11:36:57 -0500 | [diff] [blame] | 385 | |
| 386 | def skipTags = [].p(config.seedServer.skipTags) |
| 387 | |
| 388 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-automation.yml" |
| 389 | } |
| 390 | |
| 391 | deployOpenStack.mustRunAfter prepPlatform |
| 392 | deployONOS.mustRunAfter deployOpenStack |
| 393 | deployXOS.mustRunAfter deployONOS |
| 394 | setupAutomation.mustRunAfter deployXOS |
| 395 | |
| 396 | task deployPlatform { |
| 397 | dependsOn prepPlatform |
| 398 | dependsOn deployOpenStack |
| 399 | dependsOn deployONOS |
| 400 | dependsOn deployXOS |
| 401 | dependsOn setupAutomation |
Andy Bavier | 1b8a537 | 2016-07-07 19:36:21 -0400 | [diff] [blame] | 402 | } |
| 403 | |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 404 | task postDeployTests (type: Exec) { |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 405 | executable = "ansible-playbook" |
| 406 | args = ["-i", "inventory/single-prod"] |
| 407 | |
| 408 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 409 | args = args << "--user=$config.seedServer.user" |
| 410 | } |
| 411 | |
| 412 | def extraVars = [] |
| 413 | if (config.seedServer) { |
| 414 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 415 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 416 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 417 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 418 | .p(config.seedServer.management_ip, "management_ip") |
| 419 | .p(config.seedServer.management_network, "management_network") |
| 420 | .p(config.seedServer.management_iface, "management_iface") |
| 421 | .p(config.seedServer.external_ip, "external_ip") |
| 422 | .p(config.seedServer.external_network, "external_network") |
| 423 | .p(config.seedServer.external_iface, "external_iface") |
| 424 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 425 | .p(config.seedServer.fabric_network, "fabric_network") |
| 426 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 427 | .p(config.seedServer.domain, "domain") |
| 428 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 429 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 430 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 431 | .p(config.seedServer.port, "ansible_ssh_port") |
| 432 | } |
| 433 | |
| 434 | if (config.otherServers) { |
| 435 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 436 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 437 | .p(config.otherServers.role, "prov_role") |
| 438 | } |
| 439 | |
David K. Bainbridge | ecfbd4d | 2016-11-14 13:18:39 -0800 | [diff] [blame] | 440 | extraVars = extraVars.p("$targetReg", "deploy_docker_registry") |
| 441 | .p("$targetTag", "deploy_docker_tag") |
Andy Bavier | dde49cb | 2017-01-11 14:59:48 -0500 | [diff] [blame] | 442 | .p("$cordAppVersion", "cord_app_version") |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 443 | |
| 444 | def skipTags = [].p(config.seedServer.skipTags) |
| 445 | |
| 446 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-post-deploy-playbook.yml" |
| 447 | } |