diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..327ea02 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +pipeline { + agent none + environment { + CHAT = "morgan@mcmillian.dev" + MAIL = "morgan@mcmillian.dev" + } + stages { + stage('Execute playbook') { + agent { label 'ansible' } + steps { + ansiblePlaybook(playbook: "main.yml", inventory: "hosts.ini", credentialsId: "igor") + } + 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}" + } + } + } + } +}