ci: ntp: Convert to using shared library

btop
Dustin 2022-11-09 21:31:53 -06:00
parent 6af78aadda
commit db28544824
1 changed files with 9 additions and 91 deletions

View File

@ -1,93 +1,11 @@
// vim: set ft=groovy sw=4 ts=4 sts=4 et :
@Library('cfgpol')_
pipeline {
agent {
dockerfile {
dir 'ci'
args '''\
-v /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro
'''
}
}
options {
lock 'cfgpol'
timeout(time: 1, unit: 'HOURS')
}
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'
}
failure {
emailext \
to: 'gyrfalcon@ebonfire.com',
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT'
}
}
}
applyConfigPolicy(
'ntpd',
[
'NTP': [
'ntp.yml'
]
]
)