-
Notifications
You must be signed in to change notification settings - Fork 12
/
Jenkinsfile
55 lines (54 loc) · 2.8 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
49
50
51
52
53
54
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
args '-v /etc/passwd:/etc/passwd'
}
}
options {
disableConcurrentBuilds()
lock resource: 'viptela-workshop-testbed'
}
environment {
VIRL_USERNAME = credentials('cpn-virl-username')
VIRL_PASSWORD = credentials('cpn-virl-password')
VIRL_HOST = credentials('cpn-virl-host')
VIPTELA_ORG = credentials('viptela-org')
HOME = "${WORKSPACE}"
DEFAULT_LOCAL_TMP = "${WORKSPACE}/ansible"
}
stages {
stage('Build Workshop') {
steps {
echo 'Running build.yml...'
ansiblePlaybook disableHostKeyChecking: true, extras: "-e virl_tag=jenkins", playbook: 'build.yml'
}
}
stage('Configure Workshop') {
steps {
echo 'Configure Viptela Control Plane...'
withCredentials([file(credentialsId: 'viptela-serial-file', variable: 'VIPTELA_SERIAL_FILE')]) {
ansiblePlaybook disableHostKeyChecking: true, extras: '-e virl_tag=jenkins -e \'organization_name="${VIPTELA_ORG}"\' -e serial_number_file=${VIPTELA_SERIAL_FILE} -e viptela_cert_dir=${WORKSPACE}/myCA', tags: 'control', playbook: 'configure.yml'
}
echo 'Check Viptela Control Plane...'
withCredentials([file(credentialsId: 'viptela-serial-file', variable: 'VIPTELA_SERIAL_FILE')]) {
ansiblePlaybook disableHostKeyChecking: true, extras: '-e virl_tag=jenkins -e \'organization_name="${VIPTELA_ORG}"\' -e serial_number_file=${VIPTELA_SERIAL_FILE} -e viptela_cert_dir=${WORKSPACE}/myCA', tags: 'check_control', playbook: 'configure.yml'
}
echo 'Configure Viptela Edge...'
withCredentials([file(credentialsId: 'viptela-serial-file', variable: 'VIPTELA_SERIAL_FILE')]) {
ansiblePlaybook disableHostKeyChecking: true, extras: '-e virl_tag=jenkins -e \'organization_name="${VIPTELA_ORG}"\' -e serial_number_file=${VIPTELA_SERIAL_FILE} -e viptela_cert_dir=${WORKSPACE}/myCA', tags: 'edge', playbook: 'configure.yml'
}
echo 'Check Viptela Edge...'
withCredentials([file(credentialsId: 'viptela-serial-file', variable: 'VIPTELA_SERIAL_FILE')]) {
ansiblePlaybook disableHostKeyChecking: true, extras: '-e virl_tag=jenkins -e \'organization_name="${VIPTELA_ORG}"\' -e serial_number_file=${VIPTELA_SERIAL_FILE} -e viptela_cert_dir=${WORKSPACE}/myCA', tags: 'check_edge', playbook: 'configure.yml'
}
}
}
}
post {
always {
ansiblePlaybook disableHostKeyChecking: true, extras: "-e virl_tag=jenkins", playbook: 'clean.yml'
cleanWs()
}
}
}