Using a dedicated slave node instead of a Docker container has a few advantages: * Persistent configuration is possible, without making weird assumptions (e.g. Jenkins UID/GID) in the Dockerfile * Can limit concurrent deployments by controlling executor count on the node
49 lines
1.2 KiB
Groovy
49 lines
1.2 KiB
Groovy
// vim: set ft=groovy sw=4 ts=4 sts=4 et :
|
|
|
|
pipeline {
|
|
agent {
|
|
label 'ansible'
|
|
}
|
|
|
|
triggers {
|
|
pollSCM ''
|
|
}
|
|
|
|
stages {
|
|
stage('Prepare') {
|
|
steps {
|
|
withCredentials([file(
|
|
credentialsId: 'vault-jenkins@gw0',
|
|
variable: 'SUDO_PASS_FILE')]) {
|
|
sh 'cp -f "${SUDO_PASS_FILE}" host_vars/gw0/sudo-pass'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Services') {
|
|
steps {
|
|
withCredentials([file(
|
|
credentialsId: 'ansible-vault',
|
|
variable: 'ANSIBLE_VAULT_PASSWORD_FILE')]) {
|
|
sshagent(['jenkins-ssh']) {
|
|
sh 'ansible-playbook --diff -b dhcpd.yml radvd.yml'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Firewall') {
|
|
steps {
|
|
withCredentials([file(
|
|
credentialsId: 'ansible-vault',
|
|
variable: 'ANSIBLE_VAULT_PASSWORD_FILE')]) {
|
|
sshagent(['jenkins-ssh']) {
|
|
sh 'ansible-playbook --diff -b dch-gw.yml'
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|