Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [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 | */ |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 16 | import org.opencord.gradle.rules.* |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 17 | import org.yaml.snakeyaml.Yaml |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 18 | |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 19 | allprojects { |
| 20 | apply plugin: 'base' |
| 21 | apply plugin: 'de.gesellix.docker' |
| 22 | //apply plugin: 'com.tmiyamon.config' |
| 23 | |
| 24 | docker { |
| 25 | // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock' |
| 26 | // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376' |
| 27 | // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default" |
| 28 | // authConfigPlain = [ |
| 29 | // "username" : "joe", |
| 30 | // "password" : "some-pw-as-needed", |
| 31 | // "email" : "joe@acme.com", |
| 32 | // "serveraddress" : "https://index.docker.io/v1/" |
| 33 | // ] |
| 34 | } |
| 35 | } |
| 36 | |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 37 | ext { |
| 38 | |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 39 | // Upstream registry to simplify filling out the comps table below |
| 40 | upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io' |
| 41 | |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 42 | // Target registry to be used to publish docker images needed for deployment |
| 43 | targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000' |
| 44 | |
| 45 | // The tag used to tag the docker images push to the target registry |
| 46 | targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate' |
| 47 | |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 48 | // Deployment target config file (yaml format); this can be overwritten from the command line |
| 49 | // using the -PdeployConfig=<file-path> syntax. |
| 50 | deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml' |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 51 | |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 52 | dockerPath = project.hasProperty('dockerPath') ? project.getProperty('dockerPath') : '/usr/bin' |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 53 | |
| 54 | comps = [ |
| 55 | 'consul': [ |
| 56 | 'type': 'image', |
| 57 | 'upstream': upstreamReg, |
| 58 | 'name': 'consul', |
| 59 | 'digest': 'sha256:0dc990ff3c44d5b5395475bcc5ebdae4fc8b67f69e17942a8b9793b3df74d290' |
| 60 | ] |
| 61 | ] |
| 62 | } |
| 63 | |
| 64 | task fetchUpstreamImages { |
| 65 | comps.each { name, spec -> if (spec.type == 'image') { dependsOn "fetch" + name } } |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 66 | } |
| 67 | |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 68 | // Switch Configuration Image |
| 69 | |
| 70 | task buildSwitchqImage(type: Exec) { |
| 71 | commandLine "$dockerPath/docker", 'build', '-t', 'cord-maas-switchq', './switchq' |
| 72 | } |
| 73 | |
| 74 | task tagSwitchqImage(type: Exec) { |
| 75 | dependsOn buildSwitchqImage |
| 76 | commandLine "$dockerPath/docker", 'tag', 'cord-maas-switchq', "$targetReg/cord-maas-switchq:$targetTag" |
| 77 | } |
| 78 | |
| 79 | task publishSwitchqImage(type: Exec) { |
| 80 | dependsOn tagSwitchqImage |
| 81 | commandLine "$dockerPath/docker", 'push', "$targetReg/cord-maas-switchq:$targetTag" |
| 82 | } |
| 83 | |
| 84 | // Bootstrap Image |
| 85 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 86 | task buildBootstrapImage(type: Exec) { |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 87 | commandLine "$dockerPath/docker", 'build', '-t', 'cord-maas-bootstrap', './bootstrap' |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 88 | } |
| 89 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 90 | task tagBootstrapImage(type: Exec) { |
| 91 | dependsOn buildBootstrapImage |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 92 | commandLine "$dockerPath/docker", 'tag', 'cord-maas-bootstrap', "$targetReg/cord-maas-bootstrap:$targetTag" |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 93 | } |
| 94 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 95 | task publishBootstrapImage(type: Exec) { |
| 96 | dependsOn tagBootstrapImage |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 97 | commandLine "$dockerPath/docker", 'push', "$targetReg/cord-maas-bootstrap:$targetTag" |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 98 | } |
| 99 | |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 100 | // IP Allocator Image |
| 101 | |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 102 | task buildAllocationImage(type: Exec) { |
David K. Bainbridge | f22dc06 | 2016-05-31 15:35:39 -0700 | [diff] [blame] | 103 | commandLine "$dockerPath/docker", 'build', '-t', 'cord-ip-allocator', './ip-allocator' |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | task tagAllocationImage(type: Exec) { |
David K. Bainbridge | f22dc06 | 2016-05-31 15:35:39 -0700 | [diff] [blame] | 107 | dependsOn buildAllocationImage |
| 108 | commandLine "$dockerPath/docker", 'tag', 'cord-ip-allocator', "$targetReg/cord-ip-allocator:$targetTag" |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | task publishAllocationImage(type: Exec) { |
David K. Bainbridge | f22dc06 | 2016-05-31 15:35:39 -0700 | [diff] [blame] | 112 | dependsOn tagAllocationImage |
| 113 | commandLine "$dockerPath/docker", 'push', "$targetReg/cord-ip-allocator:$targetTag" |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 114 | } |
| 115 | |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 116 | // Provisioner Image |
| 117 | |
David K. Bainbridge | f0da873 | 2016-06-01 16:15:37 -0700 | [diff] [blame] | 118 | task buildProvisionerImage(type: Exec) { |
David K. Bainbridge | d86d96d | 2016-06-01 17:28:46 -0700 | [diff] [blame] | 119 | commandLine "$dockerPath/docker", 'build', '-t', 'cord-provisioner', './provisioner' |
David K. Bainbridge | f0da873 | 2016-06-01 16:15:37 -0700 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | task tagProvisionerImage(type: Exec) { |
| 123 | dependsOn buildProvisionerImage |
| 124 | commandLine "$dockerPath/docker", 'tag', 'cord-provisioner', "$targetReg/cord-provisioner:$targetTag" |
| 125 | } |
| 126 | |
| 127 | task publishProvisionerImage(type: Exec) { |
| 128 | dependsOn tagProvisionerImage |
| 129 | commandLine "$dockerPath/docker", 'push', "$targetReg/cord-provisioner:$targetTag" |
| 130 | } |
| 131 | |
David K. Bainbridge | 9d1e02d | 2016-06-22 09:22:16 -0700 | [diff] [blame] | 132 | // Automation Image |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 133 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 134 | task buildAutomationImage(type: Exec) { |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 135 | commandLine "$dockerPath/docker", 'build', '-t', "cord-maas-automation", "-f", "./automation/Dockerfile", "./automation" |
David K. Bainbridge | efa951d | 2016-05-26 10:54:25 -0700 | [diff] [blame] | 136 | } |
| 137 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 138 | task tagAutomationImage(type: Exec) { |
| 139 | dependsOn buildAutomationImage |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 140 | commandLine "$dockerPath/docker", 'tag', 'cord-maas-automation', "$targetReg/cord-maas-automation:$targetTag" |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 141 | } |
| 142 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 143 | task publishAutomationImage(type: Exec) { |
| 144 | dependsOn tagAutomationImage |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 145 | commandLine "$dockerPath/docker", 'push', "$targetReg/cord-maas-automation:$targetTag" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 146 | } |
| 147 | |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 148 | // DHCP Harvester Images |
| 149 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 150 | task buildHarvesterImage(type: Exec) { |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 151 | commandLine "$dockerPath/docker", 'build', '-t', "cord-dhcp-harvester", "./harvester" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | task tagHarvesterImage(type: Exec) { |
| 155 | dependsOn buildHarvesterImage |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 156 | commandLine "$dockerPath/docker", 'tag', 'cord-dhcp-harvester', "$targetReg/cord-dhcp-harvester:$targetTag" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | task publishHarvesterImage(type: Exec) { |
| 160 | dependsOn tagHarvesterImage |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 161 | commandLine "$dockerPath/docker", 'push', "$targetReg/cord-dhcp-harvester:$targetTag" |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | // ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~ |
| 165 | |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 166 | task updateDocker (type: Exec) { |
| 167 | commandLine 'sudo', 'utils/enable-remote-docker-registry', "$targetReg" |
| 168 | } |
| 169 | |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 170 | // To be used to fetch upstream binaries, clone repos, etc. |
| 171 | task fetch(type: Exec) { |
| 172 | // this is where we fetch upstream artifacts that we do not need internet for the build phase" |
| 173 | // Placeholdr example: |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 174 | dependsOn fetchUpstreamImages |
David K. Bainbridge | 19b8d27 | 2016-05-26 21:20:43 -0700 | [diff] [blame] | 175 | commandLine "$dockerPath/docker", "pull", "golang:alpine" |
| 176 | commandLine "$dockerPath/docker", "pull", "python:2.7-alpine" |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | // To be used to generate all needed binaries that need to be present on the target |
| 180 | // as docker images in the local docker runner. |
| 181 | task buildImages { |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 182 | dependsOn buildBootstrapImage |
| 183 | dependsOn buildHarvesterImage |
David K. Bainbridge | 9d1e02d | 2016-06-22 09:22:16 -0700 | [diff] [blame] | 184 | dependsOn buildAutomationImage |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 185 | dependsOn buildAllocationImage |
David K. Bainbridge | f0da873 | 2016-06-01 16:15:37 -0700 | [diff] [blame] | 186 | dependsOn buildProvisionerImage |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 187 | dependsOn buildSwitchqImage |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | task tagImages { |
| 191 | dependsOn tagBootstrapImage |
| 192 | dependsOn tagHarvesterImage |
David K. Bainbridge | 9d1e02d | 2016-06-22 09:22:16 -0700 | [diff] [blame] | 193 | dependsOn tagAutomationImage |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 194 | dependsOn tagAllocationImage |
David K. Bainbridge | f0da873 | 2016-06-01 16:15:37 -0700 | [diff] [blame] | 195 | dependsOn tagProvisionerImage |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 196 | dependsOn tagSwitchqImage |
Zsolt Haraszti | 2a792f6 | 2016-05-12 17:49:02 -0700 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | task publish { |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 200 | comps.each { name, spec -> if (spec.type == 'image') { dependsOn "publish" + name } } |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 201 | dependsOn publishBootstrapImage |
| 202 | dependsOn publishHarvesterImage |
David K. Bainbridge | 9d1e02d | 2016-06-22 09:22:16 -0700 | [diff] [blame] | 203 | dependsOn publishAutomationImage |
David K. Bainbridge | 8bc905c | 2016-05-31 14:07:10 -0700 | [diff] [blame] | 204 | dependsOn publishAllocationImage |
David K. Bainbridge | f0da873 | 2016-06-01 16:15:37 -0700 | [diff] [blame] | 205 | dependsOn publishProvisionerImage |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 206 | dependsOn publishSwitchqImage |
David K. Bainbridge | efa951d | 2016-05-26 10:54:25 -0700 | [diff] [blame] | 207 | } |
| 208 | |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 209 | tasks.addRule(new DockerFetchRule(project)) |
| 210 | tasks.addRule(new DockerPublishRule(project)) |
| 211 | tasks.addRule(new DockerTagRule(project)) |
| 212 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 213 | // ~~~~~~~~~~~~~~~~~~~ Deployment / Test Tasks ~~~~~~~~~~~~~~~~~~~~~~~ |
| 214 | |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 215 | List.metaClass.asParam = { prefix, sep -> |
| 216 | if (delegate.size() == 0) { |
| 217 | "" |
| 218 | } |
| 219 | String result = "--" + prefix + "=" |
| 220 | String p = "" |
| 221 | delegate.each { |
| 222 | result += p + "${it}" |
| 223 | p = sep |
| 224 | } |
| 225 | result |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 226 | } |
| 227 | |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 228 | List.metaClass.p = { value, name -> |
| 229 | if (value != null && value != "") { |
| 230 | delegate << name + "=" + value |
| 231 | } else { |
| 232 | delegate |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | List.metaClass.p = { spec -> |
| 237 | if (spec != null && spec != "") { |
| 238 | delegate += spec |
| 239 | } else { |
| 240 | delegate |
| 241 | } |
| 242 | } |
| 243 | |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 244 | task prime (type: Exec) { |
David K. Bainbridge | 59bdb54 | 2016-07-01 11:07:45 -0700 | [diff] [blame] | 245 | dependsOn updateDocker |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 246 | println "Using deployment config: $deployConfig" |
| 247 | File configFile = new File(deployConfig) |
| 248 | def yaml = new Yaml() |
| 249 | def config = yaml.load(configFile.newReader()) |
| 250 | |
| 251 | executable = "ansible-playbook" |
| 252 | args = ["-i", config.seedServer.ip + ','] |
| 253 | |
| 254 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 255 | args = args << "--user=$config.seedServer.user" |
| 256 | } |
| 257 | |
| 258 | def extraVars = [] |
| 259 | if (config.seedServer) { |
| 260 | extraVars = extraVars.p(config.seedServer.extraVars) |
| 261 | .p(config.seedServer.password, "ansible_ssh_pass") |
| 262 | .p(config.seedServer.sudoPassword, "ansible_sudo_pass") |
| 263 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 264 | .p(config.seedServer.management_ip, "management_ip") |
| 265 | .p(config.seedServer.management_network, "management_network") |
| 266 | .p(config.seedServer.management_iface, "management_iface") |
| 267 | .p(config.seedServer.external_ip, "external_ip") |
| 268 | .p(config.seedServer.external_network, "external_network") |
| 269 | .p(config.seedServer.external_iface, "external_iface") |
| 270 | .p(config.seedServer.fabric_ip, "fabric_ip") |
| 271 | .p(config.seedServer.fabric_network, "fabric_network") |
| 272 | .p(config.seedServer.fabric_iface, "fabric_iface") |
| 273 | .p(config.seedServer.domain, "domain") |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 274 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
| 275 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 276 | .p(config.seedServer.power_helper_host, "power_helper_host") |
| 277 | .p(config.seedServer.port, "ansible_ssh_port") |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | if (config.otherServers) { |
| 281 | extraVars = extraVars.p(config.otherServers.location, "prov_location") |
| 282 | .p(config.otherServers.rolesPath, "prov_role_path") |
| 283 | .p(config.otherServers.role, "prov_role") |
| 284 | } |
| 285 | |
| 286 | if (config.docker) { |
| 287 | extraVars = extraVars.p(config.docker.registry, "docker_registry") |
| 288 | .p(config.docker.imageVersion, "docker_image_version") |
| 289 | } |
| 290 | |
| 291 | def skipTags = [].p(config.seedServer.skipTags) |
| 292 | |
| 293 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "prime-node.yml" |
| 294 | } |
| 295 | |
David K. Bainbridge | 23a4945 | 2016-07-06 15:59:09 -0700 | [diff] [blame] | 296 | task deployBase (type: Exec) { |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 297 | println "Using deployment config: $deployConfig" |
| 298 | File configFile = new File(deployConfig) |
| 299 | def yaml = new Yaml() |
| 300 | def config = yaml.load(configFile.newReader()) |
| 301 | |
| 302 | executable = "ansible-playbook" |
David K. Bainbridge | 13c765c | 2016-05-26 11:24:22 -0700 | [diff] [blame] | 303 | args = ["-i", config.seedServer.ip + ','] |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 304 | |
David K. Bainbridge | 13c765c | 2016-05-26 11:24:22 -0700 | [diff] [blame] | 305 | if ( config.seedServer.user != null && config.seedServer.user != "" ) { |
| 306 | args = args << "--user=$config.seedServer.user" |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | def extraVars = [] |
David K. Bainbridge | 13c765c | 2016-05-26 11:24:22 -0700 | [diff] [blame] | 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") |
David K. Bainbridge | c82a446 | 2016-06-14 12:39:01 -0700 | [diff] [blame] | 316 | .p(config.seedServer.management_network, "management_network") |
| 317 | .p(config.seedServer.management_iface, "management_iface") |
David K. Bainbridge | 13c765c | 2016-05-26 11:24:22 -0700 | [diff] [blame] | 318 | .p(config.seedServer.external_ip, "external_ip") |
David K. Bainbridge | c82a446 | 2016-06-14 12:39:01 -0700 | [diff] [blame] | 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") |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 325 | .p(config.seedServer.virtualbox_support, "virtualbox_support") |
David K. Bainbridge | c82a446 | 2016-06-14 12:39:01 -0700 | [diff] [blame] | 326 | .p(config.seedServer.power_helper_user, "power_helper_user") |
| 327 | .p(config.seedServer.power_helper_host, "power_helper_host") |
David K. Bainbridge | be58a0d | 2016-06-22 15:43:02 -0700 | [diff] [blame] | 328 | .p(config.seedServer.port, "ansible_ssh_port") |
David K. Bainbridge | 6ea57c1 | 2016-06-06 23:29:12 -0700 | [diff] [blame] | 329 | } |
| 330 | |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 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 | |
David K. Bainbridge | 97ee805 | 2016-06-14 00:52:07 -0700 | [diff] [blame] | 337 | if (config.docker) { |
| 338 | extraVars = extraVars.p(config.docker.registry, "docker_registry") |
| 339 | .p(config.docker.imageVersion, "docker_image_version") |
| 340 | } |
| 341 | |
David K. Bainbridge | 13c765c | 2016-05-26 11:24:22 -0700 | [diff] [blame] | 342 | def skipTags = [].p(config.seedServer.skipTags) |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 343 | |
| 344 | args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "head-node.yml" |
David K. Bainbridge | 10b0c11 | 2016-05-24 13:17:23 -0700 | [diff] [blame] | 345 | } |