ci: Add pipeline for NTP

jenkins-master
Dustin 2018-04-22 11:50:07 -05:00
parent 48a5c19232
commit d1cdf1831b
1 changed files with 77 additions and 0 deletions

77
ci/ntp.jenkinsfile Normal file
View File

@ -0,0 +1,77 @@
// vim: set ft=groovy sw=4 ts=4 sts=4 et :
pipeline {
agent {
label 'ansible'
}
triggers {
cron 'H H * * *'
}
environment {
KRB5CCNAME = "${WORKSPACE}/.krb5cc"
}
stages {
stage('Prepare') {
steps {
withCredentials([file(
credentialsId: 'keytab-jenkins@pyrocufflink.blue',
variable: 'KEYTAB'
)]) {
sh 'kinit -kt "${KEYTAB}" jenkins@PYROCUFFLINK.BLUE'
}
withCredentials([file(
credentialsId: 'vault-jenkins@pyrocufflink.blue',
variable: 'SUDO_PASS_FILE'
)]) {
sh 'cp "${SUDO_PASS_FILE}" sudo-pass'
}
}
}
stage('Remount R/W') {
steps {
ansiblePlaybook \
playbook: 'remount.yml',
limit: 'ntpd',
become: true,
vaultCredentialsId: 'ansible-vault',
extraVars: [
remount_state: 'rw',
],
extras: '-e@sudo-pass'
}
}
stage('NTP') {
steps {
ansiblePlaybook \
playbook: 'ntp.yml',
become: true,
vaultCredentialsId: 'ansible-vault',
extras: '-e@sudo-pass --diff'
}
}
stage('Remount R/O') {
steps {
ansiblePlaybook \
playbook: 'remount.yml',
limit: 'ntpd',
become: true,
vaultCredentialsId: 'ansible-vault',
extras: '-e@sudo-pass'
}
}
}
post {
always {
sh 'rm -f sudo-pass'
sh 'kdestroy'
}
}
}