blob: d6e34799209e7a0d00e17c5c285204d12e10b2b6 [file] [log] [blame]
Zsolt Haraszti2a792f62016-05-12 17:49:02 -07001/*
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. Bainbridge59bdb542016-07-01 11:07:45 -070016import org.opencord.gradle.rules.*
David K. Bainbridge10b0c112016-05-24 13:17:23 -070017import org.yaml.snakeyaml.Yaml
Zsolt Haraszti2a792f62016-05-12 17:49:02 -070018
David K. Bainbridge59bdb542016-07-01 11:07:45 -070019allprojects {
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 Haraszti2a792f62016-05-12 17:49:02 -070037ext {
38
David K. Bainbridge59bdb542016-07-01 11:07:45 -070039 // Upstream registry to simplify filling out the comps table below
40 upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io'
41
David K. Bainbridge10b0c112016-05-24 13:17:23 -070042 // Deployment target config file (yaml format); this can be overwritten from the command line
43 // using the -PdeployConfig=<file-path> syntax.
44 deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml'
David K. Bainbridge19b8d272016-05-26 21:20:43 -070045
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -080046 println "Using deployment config: $deployConfig"
47 File configFile = new File(deployConfig)
48 def yaml = new Yaml()
49 config = yaml.load(configFile.newReader())
50
51 // Target registry to be used to publish docker images needed for deployment
52 targetReg = project.hasProperty('targetReg')
53 ? project.getProperty('targetReg')
54 : config.docker && config.docker.registry
55 ? config.docker.registry
Zack Williamsb55e8ef2017-02-01 10:54:36 -070056 : config.headnode.ip
57 ? config.headnode.ip + ":5000"
David K. Bainbridgec9cacd32016-11-15 15:10:06 -080058 : 'localhost:5000'
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -080059
60 // The tag used to tag the docker images push to the target registry
61 targetTag = project.hasProperty('targetTag')
62 ? project.getProperty('targetTag')
63 : config.docker && config.docker.imageVersion
64 ? config.docker.imageVersion
65 : 'candidate'
66
David K. Bainbridge59bdb542016-07-01 11:07:45 -070067 comps = [
68 'consul': [
69 'type': 'image',
70 'upstream': upstreamReg,
71 'name': 'consul',
72 'digest': 'sha256:0dc990ff3c44d5b5395475bcc5ebdae4fc8b67f69e17942a8b9793b3df74d290'
73 ]
74 ]
75}
76
77task fetchUpstreamImages {
78 comps.each { name, spec -> if (spec.type == 'image') { dependsOn "fetch" + name } }
Zsolt Haraszti2a792f62016-05-12 17:49:02 -070079}
80
David K. Bainbridge97ee8052016-06-14 00:52:07 -070081// Switch Configuration Image
82
David K. Bainbridgede0d9262016-09-13 20:12:06 -070083def getBuildTimestamp() {
84 def cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"))
85 def date = cal.getTime()
David K. Bainbridge151e8452016-12-19 23:05:51 -080086 def formattedDate = date.format("yyyy-MM-dd'T'HH:mm:ssZ")
David K. Bainbridgede0d9262016-09-13 20:12:06 -070087 return formattedDate
88}
89
David K. Bainbridge151e8452016-12-19 23:05:51 -080090def getCommitDate = { ->
91 def stdOut = new ByteArrayOutputStream()
92 exec {
93 commandLine "git", "log", "--pretty=format:%cd", "--date=format:%FT%T%z", "-n", "1"
94 standardOutput = stdOut
95 }
96 return stdOut.toString().trim()
97}
98
David K. Bainbridgede0d9262016-09-13 20:12:06 -070099def getCommitHash = { ->
100 def hashStdOut = new ByteArrayOutputStream()
101 exec {
David K. Bainbridge151e8452016-12-19 23:05:51 -0800102 commandLine "git", "log", "--pretty=format:%H", "-n", "1"
David K. Bainbridgede0d9262016-09-13 20:12:06 -0700103 standardOutput = hashStdOut
104 }
105 return hashStdOut.toString().trim()
106}
107
David K. Bainbridged4e3f622017-01-12 14:07:54 -0800108def isModified = { ->
109 def statusOut = new ByteArrayOutputStream()
110 def branchesOut = new ByteArrayOutputStream()
David K. Bainbridgede0d9262016-09-13 20:12:06 -0700111 exec {
David K. Bainbridged4e3f622017-01-12 14:07:54 -0800112 commandLine "bash", "-c", "repo --color=never --no-pager status . | tail -n +2 | wc -l"
113 standardOutput = statusOut
David K. Bainbridgede0d9262016-09-13 20:12:06 -0700114 }
David K. Bainbridged4e3f622017-01-12 14:07:54 -0800115 exec {
116 commandLine "bash", "-c", "repo --color=never --no-pager branches | wc -l"
117 standardOutput = branchesOut
118 }
119 def statusVal = statusOut.toString().trim()
120 def branchesVal = branchesOut.toString().trim()
121
122 return statusVal != "0" || branchesVal != "0"
123}
124
125def getBranchName = { ->
126 def stdout = new ByteArrayOutputStream()
127 exec {
128 commandLine "bash", "-c", "repo --color=never --no-pager info -l -o | grep 'Manifest branch:' | awk '{print \$NF}'"
129 standardOutput = stdout
130 }
131 def val = stdout.toString().trim()
132 if ( isModified() != "0" ) {
133 val += '[modified]'
134 }
135 return val
David K. Bainbridgede0d9262016-09-13 20:12:06 -0700136}
David K. Bainbridge6e23ac82016-12-07 12:55:41 -0800137
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700138task buildSwitchqImage(type: Exec) {
David K. Bainbridge528b3182017-01-23 08:51:59 -0800139 workingDir 'switchq'
140 commandLine 'make', 'build', 'package'
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700141}
142
143task tagSwitchqImage(type: Exec) {
144 dependsOn buildSwitchqImage
David K. Bainbridge528b3182017-01-23 08:51:59 -0800145 commandLine "docker", 'tag', 'cord-maas-switchq:candidate', "$targetReg/cord-maas-switchq:$targetTag"
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700146}
147
148task publishSwitchqImage(type: Exec) {
149 dependsOn tagSwitchqImage
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700150 commandLine "docker", 'push', "$targetReg/cord-maas-switchq:$targetTag"
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700151}
152
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700153// IP Allocator Image
154
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700155task buildAllocationImage(type: Exec) {
David K. Bainbridge528b3182017-01-23 08:51:59 -0800156 workingDir 'ip-allocator'
157 commandLine 'make', 'build', 'package'
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700158}
159
160task tagAllocationImage(type: Exec) {
David K. Bainbridgef22dc062016-05-31 15:35:39 -0700161 dependsOn buildAllocationImage
David K. Bainbridge528b3182017-01-23 08:51:59 -0800162 commandLine "docker", 'tag', 'cord-ip-allocator:candidate', "$targetReg/cord-ip-allocator:$targetTag"
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700163}
164
165task publishAllocationImage(type: Exec) {
David K. Bainbridgef22dc062016-05-31 15:35:39 -0700166 dependsOn tagAllocationImage
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700167 commandLine "docker", 'push', "$targetReg/cord-ip-allocator:$targetTag"
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700168}
169
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700170// Provisioner Image
171
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700172task buildProvisionerImage(type: Exec) {
David K. Bainbridge528b3182017-01-23 08:51:59 -0800173 workingDir 'provisioner'
174 commandLine 'make', 'build', 'package'
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700175}
176
177task tagProvisionerImage(type: Exec) {
178 dependsOn buildProvisionerImage
David K. Bainbridge528b3182017-01-23 08:51:59 -0800179 commandLine "docker", 'tag', 'cord-provisioner:candidate', "$targetReg/cord-provisioner:$targetTag"
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700180}
181
182task publishProvisionerImage(type: Exec) {
183 dependsOn tagProvisionerImage
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700184 commandLine "docker", 'push', "$targetReg/cord-provisioner:$targetTag"
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700185}
186
gunjan5e9bdd1d2016-07-13 14:59:33 -0700187// Config Generator Image
188
189task buildConfigGeneratorImage(type: Exec) {
David K. Bainbridge528b3182017-01-23 08:51:59 -0800190 workingDir 'config-generator'
191 commandLine 'make', 'build', 'package'
gunjan5e9bdd1d2016-07-13 14:59:33 -0700192}
193
194task tagConfigGeneratorImage(type: Exec) {
195 dependsOn buildConfigGeneratorImage
David K. Bainbridge528b3182017-01-23 08:51:59 -0800196 commandLine "docker", 'tag', 'config-generator:candidate', "$targetReg/config-generator:$targetTag"
gunjan5e9bdd1d2016-07-13 14:59:33 -0700197}
198
199task publishConfigGeneratorImage(type: Exec) {
200 dependsOn tagConfigGeneratorImage
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700201 commandLine "docker", 'push', "$targetReg/config-generator:$targetTag"
gunjan5e9bdd1d2016-07-13 14:59:33 -0700202}
203
David K. Bainbridge9d1e02d2016-06-22 09:22:16 -0700204// Automation Image
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700205
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700206task buildAutomationImage(type: Exec) {
David K. Bainbridge528b3182017-01-23 08:51:59 -0800207 workingDir 'automation'
208 commandLine 'make', 'build', 'package'
David K. Bainbridgeefa951d2016-05-26 10:54:25 -0700209}
210
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700211task tagAutomationImage(type: Exec) {
212 dependsOn buildAutomationImage
David K. Bainbridge528b3182017-01-23 08:51:59 -0800213 commandLine "docker", 'tag', 'cord-maas-automation:candidate', "$targetReg/cord-maas-automation:$targetTag"
Zsolt Haraszti2a792f62016-05-12 17:49:02 -0700214}
215
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700216task publishAutomationImage(type: Exec) {
217 dependsOn tagAutomationImage
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700218 commandLine "docker", 'push', "$targetReg/cord-maas-automation:$targetTag"
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700219}
220
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700221// DHCP Harvester Images
222
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700223task buildHarvesterImage(type: Exec) {
David K. Bainbridge528b3182017-01-23 08:51:59 -0800224 workingDir 'harvester'
225 commandLine 'make', 'build', 'package'
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700226}
227
228task tagHarvesterImage(type: Exec) {
229 dependsOn buildHarvesterImage
David K. Bainbridge528b3182017-01-23 08:51:59 -0800230 commandLine "docker", 'tag', 'cord-dhcp-harvester:candidate', "$targetReg/cord-dhcp-harvester:$targetTag"
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700231}
232
233task publishHarvesterImage(type: Exec) {
234 dependsOn tagHarvesterImage
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700235 commandLine "docker", 'push', "$targetReg/cord-dhcp-harvester:$targetTag"
Zsolt Haraszti2a792f62016-05-12 17:49:02 -0700236}
237
238// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
239
alshabib462f6252016-08-29 16:15:28 -0700240task updateDocker (type: Exec) {
David K. Bainbridge59bdb542016-07-01 11:07:45 -0700241 commandLine 'sudo', 'utils/enable-remote-docker-registry', "$targetReg"
242}
243
Zsolt Haraszti2a792f62016-05-12 17:49:02 -0700244// To be used to fetch upstream binaries, clone repos, etc.
245task fetch(type: Exec) {
246 // this is where we fetch upstream artifacts that we do not need internet for the build phase"
247 // Placeholdr example:
David K. Bainbridge59bdb542016-07-01 11:07:45 -0700248 dependsOn fetchUpstreamImages
David K. Bainbridgea677d4e2016-09-11 20:01:32 -0700249 commandLine "docker", "pull", "golang:alpine"
250 commandLine "docker", "pull", "python:2.7-alpine"
Zsolt Haraszti2a792f62016-05-12 17:49:02 -0700251}
252
253// To be used to generate all needed binaries that need to be present on the target
254// as docker images in the local docker runner.
255task buildImages {
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700256 dependsOn buildHarvesterImage
David K. Bainbridge9d1e02d2016-06-22 09:22:16 -0700257 dependsOn buildAutomationImage
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700258 dependsOn buildAllocationImage
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700259 dependsOn buildProvisionerImage
gunjan5e9bdd1d2016-07-13 14:59:33 -0700260 dependsOn buildConfigGeneratorImage
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700261 dependsOn buildSwitchqImage
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700262}
263
264task tagImages {
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700265 dependsOn tagHarvesterImage
David K. Bainbridge9d1e02d2016-06-22 09:22:16 -0700266 dependsOn tagAutomationImage
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700267 dependsOn tagAllocationImage
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700268 dependsOn tagProvisionerImage
gunjan5e9bdd1d2016-07-13 14:59:33 -0700269 dependsOn tagConfigGeneratorImage
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700270 dependsOn tagSwitchqImage
Zsolt Haraszti2a792f62016-05-12 17:49:02 -0700271}
272
273task publish {
alshabib462f6252016-08-29 16:15:28 -0700274 //FIXME: This works because the upstream project primes the nodes before running this.
David K. Bainbridge59bdb542016-07-01 11:07:45 -0700275 comps.each { name, spec -> if (spec.type == 'image') { dependsOn "publish" + name } }
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700276 dependsOn publishHarvesterImage
David K. Bainbridge9d1e02d2016-06-22 09:22:16 -0700277 dependsOn publishAutomationImage
David K. Bainbridge8bc905c2016-05-31 14:07:10 -0700278 dependsOn publishAllocationImage
David K. Bainbridgef0da8732016-06-01 16:15:37 -0700279 dependsOn publishProvisionerImage
gunjan5e9bdd1d2016-07-13 14:59:33 -0700280 dependsOn publishConfigGeneratorImage
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700281 dependsOn publishSwitchqImage
David K. Bainbridgeefa951d2016-05-26 10:54:25 -0700282}
283
David K. Bainbridge59bdb542016-07-01 11:07:45 -0700284
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700285// ~~~~~~~~~~~~~~~~~~~ Deployment / Test Tasks ~~~~~~~~~~~~~~~~~~~~~~~
286
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700287List.metaClass.asParam = { prefix, sep ->
288 if (delegate.size() == 0) {
289 ""
290 }
291 String result = "--" + prefix + "="
292 String p = ""
293 delegate.each {
294 result += p + "${it}"
295 p = sep
296 }
297 result
David K. Bainbridgeb5415042016-05-13 17:06:10 -0700298}
299
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700300List.metaClass.p = { value, name ->
301 if (value != null && value != "") {
302 delegate << name + "=" + value
303 } else {
304 delegate
305 }
306}
307
308List.metaClass.p = { spec ->
309 if (spec != null && spec != "") {
310 delegate += spec
311 } else {
312 delegate
313 }
314}
315
alshabib462f6252016-08-29 16:15:28 -0700316task prime (type: Exec) {
David K. Bainbridgef4181702016-06-17 14:44:03 -0700317 executable = "ansible-playbook"
Zack Williams642388d2017-04-12 22:39:15 -0700318 args = ["-i", '../genconfig/cord-inv']
David K. Bainbridgef4181702016-06-17 14:44:03 -0700319
Zack Williamsb55e8ef2017-02-01 10:54:36 -0700320 if ( config.headnode.ansible_user != null && config.headnode.ansible_user != "" ) {
321 args = args << "--user=$config.headnode.ansible_user"
David K. Bainbridgef4181702016-06-17 14:44:03 -0700322 }
323
David K. Bainbridge5ba01a92016-08-16 14:58:31 -0700324 if ( config.debug ) {
325 args = args << "-vvvv"
326 }
327
David K. Bainbridgef4181702016-06-17 14:44:03 -0700328 def extraVars = []
Zack Williamsb55e8ef2017-02-01 10:54:36 -0700329 if (config.common) {
330 extraVars = extraVars.p(config.common.extraVars)
331 .p(config.headnode.ansible_ssh_pass, "ansible_ssh_pass")
332 .p(config.headnode.ansible_become_pass, "ansible_become_pass")
333 .p(config.headnode.ansible_ssh_port, "ansible_ssh_port")
334 .p(config.common.fabric_ip, "fabric_ip")
335 .p(config.common.fabric_range_low, "fabric_range_low")
336 .p(config.common.fabric_range_high, "fabric_range_high")
337 .p(config.common.management_ip, "management_ip")
338 .p(config.common.management_range_low, "management_range_low")
339 .p(config.common.management_range_high, "management_range_high")
340 .p(config.common.management_gw, "management_gw")
341 .p(config.common.management_bc, "management_bc")
342 .p(config.common.management_network, "management_network")
343 .p(config.common.management_iface, "management_iface")
344 .p(config.common.external_ip, "external_ip")
345 .p(config.common.external_gw, "external_gw")
346 .p(config.common.external_bc, "external_bc")
347 .p(config.common.external_network, "external_network")
348 .p(config.common.external_iface, "external_iface")
349 .p(config.common.fabric_iface, "fabric_iface")
350 .p(config.common.domain, "domain")
351 .p(config.common.virtualbox_support, "virtualbox_support")
352 .p(config.common.power_helper_user, "power_helper_user")
353 .p(config.common.power_helper_host, "power_helper_host")
David K. Bainbridgef4181702016-06-17 14:44:03 -0700354 }
355
David K. Bainbridge8b179042016-11-30 15:38:42 -0800356 if (config.passwords) {
357 extraVars = extraVars.p(config.passwords.compute_node, "password_compute_node")
358 .p(config.passwords.maas_admin, "password_maas_admin")
359 .p(config.passwords.maas_user, "password_maas_user")
360 }
361
David K. Bainbridgef4181702016-06-17 14:44:03 -0700362 if (config.otherServers) {
363 extraVars = extraVars.p(config.otherServers.location, "prov_location")
364 .p(config.otherServers.rolesPath, "prov_role_path")
365 .p(config.otherServers.role, "prov_role")
366 }
367
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -0800368 extraVars = extraVars.p("$targetReg", "deploy_docker_registry")
369 .p("$targetTag", "deploy_docker_tag")
David K. Bainbridgef4181702016-06-17 14:44:03 -0700370
David K. Bainbridge6e23ac82016-12-07 12:55:41 -0800371 // the password set on the compute node is skipped because this is being run against the
372 // head node and we don't want to change the head node password as this node was manualy
David K. Bainbridge8b179042016-11-30 15:38:42 -0800373 // set up.
Zack Williamsb55e8ef2017-02-01 10:54:36 -0700374 def skipTags = [].p(config.common.skipTags).p('set_compute_node_password')
David K. Bainbridgef4181702016-06-17 14:44:03 -0700375
376 args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "prime-node.yml"
377}
378
alshabib462f6252016-08-29 16:15:28 -0700379task deployBase(type: Exec) {
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700380 executable = "ansible-playbook"
Zack Williams642388d2017-04-12 22:39:15 -0700381 args = ["-i", '../genconfig/cord-inv']
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700382
Zack Williamsb55e8ef2017-02-01 10:54:36 -0700383 if ( config.headnode.ansible_user != null && config.headnode.ansible_user != "" ) {
384 args = args << "--user=$config.headnode.ansible_user"
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700385 }
386
David K. Bainbridge5ba01a92016-08-16 14:58:31 -0700387 if ( config.debug ) {
388 args = args << "-vvvv"
389 }
390
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700391 def extraVars = []
Zack Williamsb55e8ef2017-02-01 10:54:36 -0700392 if (config.common) {
393 extraVars = extraVars.p(config.common.extraVars)
394 .p(config.headnode.ansible_ssh_pass, "ansible_ssh_pass")
395 .p(config.headnode.ansible_become_pass, "ansible_become_pass")
396 .p(config.headnode.ansible_ssh_port, "ansible_ssh_port")
397 .p(config.common.fabric_ip, "fabric_ip")
398 .p(config.common.fabric_range_low, "fabric_range_low")
399 .p(config.common.fabric_range_high, "fabric_range_high")
400 .p(config.common.management_ip, "management_ip")
401 .p(config.common.management_range_low, "management_range_low")
402 .p(config.common.management_range_high, "management_range_high")
403 .p(config.common.management_gw, "management_gw")
404 .p(config.common.management_network, "management_network")
405 .p(config.common.management_iface, "management_iface")
406 .p(config.common.external_ip, "external_ip")
407 .p(config.common.external_gw, "external_gw")
408 .p(config.common.external_network, "external_network")
409 .p(config.common.external_iface, "external_iface")
410 .p(config.common.fabric_iface, "fabric_iface")
411 .p(config.common.domain, "domain")
412 .p(config.common.virtualbox_support, "virtualbox_support")
413 .p(config.common.power_helper_user, "power_helper_user")
414 .p(config.common.power_helper_host, "power_helper_host")
David K. Bainbridge6ea57c12016-06-06 23:29:12 -0700415 }
416
David K. Bainbridge8b179042016-11-30 15:38:42 -0800417 if (config.passwords) {
418 extraVars = extraVars.p(config.passwords.compute_node, "password_compute_node")
419 .p(config.passwords.maas_admin, "password_maas_admin")
420 .p(config.passwords.maas_user, "password_maas_user")
421 }
422
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700423 if (config.otherServers) {
424 extraVars = extraVars.p(config.otherServers.location, "prov_location")
425 .p(config.otherServers.rolesPath, "prov_role_path")
426 .p(config.otherServers.role, "prov_role")
427 }
428
David K. Bainbridgec4e0fc52016-11-14 12:03:35 -0800429 extraVars = extraVars.p("$targetReg", "deploy_docker_registry")
430 .p("$targetTag", "deploy_docker_tag")
David K. Bainbridge97ee8052016-06-14 00:52:07 -0700431
David K. Bainbridge8b179042016-11-30 15:38:42 -0800432 // the password set on the compute node is skipped because this is being run against the
433 // head node and we don't want to change the head node password as this node was manualy
434 // set up.
Zack Williamsb55e8ef2017-02-01 10:54:36 -0700435 def skipTags = [].p(config.common.skipTags).p('set_compute_node_password')
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700436
437 args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "head-node.yml"
David K. Bainbridge10b0c112016-05-24 13:17:23 -0700438}
alshabib462f6252016-08-29 16:15:28 -0700439
440prime.dependsOn {
441 updateDocker
442}
443
444tasks.addRule(new DockerFetchRule(project))
445tasks.addRule(new DockerPublishRule(project, project(':maas').prime))
446tasks.addRule(new DockerTagRule(project))
447
448