archer-a9-router-rebooter/Jenkinsfile

30 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2023-06-07 05:52:17 -04:00
pipeline {
agent any
stages {
stage('Deploy') {
when {
branch pattern: '^(master|main)$|stable|release', comparator: 'REGEXP'
}
steps {
httpRequest outputFile: 'get_service_config.yaml', url: 'https://gist.githubusercontent.com/computer-geek64/3ed7241e7a74ad6ddd00409900b590e4/raw/39d371d4040b319663bfd339ea1aa56bd37cdf77/get_service_config.yaml'
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, extras: "--extra-vars 'service=\"archer_a9_router_rebooter\"'", playbook: 'get_service_config.yaml'
script {
archer_a9_router_rebooter_config = readJSON file: 'archer_a9_router_rebooter_config.json'
}
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, extras: "--extra-vars 'router_password=\"${archer_a9_router_rebooter_config.router.password}\"'", playbook: 'install.yaml'
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, playbook: 'stop.yaml'
ansiblePlaybook credentialsId: 'rivendell-ssh-key', disableHostKeyChecking: true, playbook: 'start.yaml'
}
}
}
post {
cleanup {
cleanWs()
}
}
}