Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Added CONNECT_AS_SLAVE parameter to accomodate workflows that do not …
Browse files Browse the repository at this point in the history
…need cinch
  • Loading branch information
jaypoulz committed Oct 18, 2017
1 parent e548962 commit 949ce6c
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions jobs/provision/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
properties([
parameters([
choiceParam(
name: 'ARCH',
choices: "x86_64\nppc64le\naarch64\ns390x",
description: 'Architecture'
choices: 'x86_64\nppc64le\naarch64\ns390x',
description: 'Architecture',
name: 'ARCH'
),
string(
name: 'CONFIG_REPO',
description: 'Optional repo containing an Ansible playbook to run on the provisioned host.',
defaultValue: ''
defaultValue: '',
description: 'Path to file in CONFIG_REPO to specify an Ansible playbook to run on the provisioned host.',
name: 'CONFIG_FILE'
),
string(
name: 'CONFIG_FILE',
description: 'Path to file in CONFIG_REPO to specify an Ansible playbook to run on the provisioned host.',
defaultValue: ''
defaultValue: '',
description: 'Optional repo containing an Ansible playbook to run on the provisioned host.',
name: 'CONFIG_REPO'
),
boolean(
defaultValue: true,
description: 'Run cinch to connect provisioned node to Jenkins master.',
name: 'CONNECT_AS_SLAVE'
)
])
])
])
])

node ('provisioner') {
ansiColor('xterm') {
Expand Down Expand Up @@ -59,11 +64,13 @@ node ('provisioner') {
stage('Provision') {
slaveTarget = "${params.ARCH}-slave"
sh "linchpin -vvvv up ${slaveTarget}"
sh """
ansible-playbook --inventory inventories/${slaveTarget}.inventory \
--extra-vars '{ "rpm_key_imports":[], "jenkins_master_repositories":[], "jenkins_master_download_repositories":[] }' \
cinch/cinch/site.yml
"""
if (params.CONNECT_AS_SLAVE) {
sh """
ansible-playbook --inventory inventories/${slaveTarget}.inventory \
--extra-vars '{ "rpm_key_imports":[], "jenkins_master_repositories":[], "jenkins_master_download_repositories":[] }' \
cinch/cinch/site.yml
"""
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
Expand Down

0 comments on commit 949ce6c

Please sign in to comment.