-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
48 lines (48 loc) · 1.53 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pipeline {
agent {
label 'pta-controller'
}
triggers {
cron('H 19 * * 6')
}
options {
disableConcurrentBuilds()
buildDiscarder logRotator(numToKeepStr: '10')
}
stages {
stage('Roles') {
steps {
sh '''
virtualenv virt_ansible
source virt_ansible/bin/activate
pip install -r requirements.txt
ansible-galaxy install --role-file=requirements.yml --force --roles-path=./roles
deactivate
'''
}
}
stage('Mount') {
steps {
sh '''
source virt_ansible/bin/activate
ansible-playbook -i hosts mount.yml
deactivate
'''
}
}
stage('Playbook') {
steps {
sh '''
source virt_ansible/bin/activate
ansible-playbook -i hosts --vault-password-file /mnt/extra/service/vault_password.txt main.yml
deactivate
'''
}
}
}
post {
failure {
emailext body: '''$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS<br><br>Check the console output at ${BUILD_URL}console to view the results.''', mimeType: 'text/html', recipientProviders: [requestor()], subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', to: "pta-admin@company.com"
}
}
}