2023-11-10 23:37:51 +00:00
|
|
|
pipeline {
|
|
|
|
agent none
|
|
|
|
environment {
|
|
|
|
CHAT = "morgan@mcmillian.dev"
|
|
|
|
MAIL = "morgan@mcmillian.dev"
|
2023-11-10 23:46:29 +00:00
|
|
|
ANSIBLE_HOST_KEY_CHECKING = "False"
|
2023-11-10 23:37:51 +00:00
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Execute playbook') {
|
|
|
|
agent { label 'ansible' }
|
|
|
|
steps {
|
2023-11-10 23:41:12 +00:00
|
|
|
ansiblePlaybook(playbook: "main.yaml", inventory: "hosts.ini", credentialsId: "igor")
|
2023-11-10 23:37:51 +00:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
success {
|
|
|
|
jabberNotify buildToChatNotifier: [$class: 'ExtraMessageOnlyBuildToChatNotifier'], extraMessage: 'Deploy Succeeded', notifySuspects: true, targets: "${CHAT}"
|
|
|
|
}
|
|
|
|
failure {
|
|
|
|
jabberNotify buildToChatNotifier: [$class: 'ExtraMessageOnlyBuildToChatNotifier'], extraMessage: 'Deploy Failed', notifySuspects: true, targets: "${CHAT}"
|
|
|
|
mail to: "${MAIL}",
|
|
|
|
subject: "Deploy Failed: ${currentBuild.fullDisplayName}",
|
|
|
|
body: "Something is wrong with ${env.BUILD_URL}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|