-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
33 lines (32 loc) · 1.39 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
pipeline {
// runs on any 'agent' (can either be a master or slave) that has ansible installed
agent any
parameters {
string(name: 'MICROSERVICE_NAME', description: 'The microservice to deploy')
string(name: 'MICROSERVICE_VERSION', description: 'The version to deploy')
string(name: 'MICROSERVICE_PORT', description: 'The microservice port')
}
stages {
stage('Execute Ansible Playbook') {
steps {
// Needs Ansi Plugin that enables colourful printing on Console Log output
ansiColor('xterm') {
ansiblePlaybook(
playbook: "deploy_${params.MICROSERVICE_NAME}.yml",
inventory: 'hosts',
extraVars: [
VERSION: "${params.MICROSERVICE_VERSION}",
HOST_PORT: "${params.MICROSERVICE_PORT}",
CONTAINER_PORT: "${params.MICROSERVICE_PORT}",
MICROSERVICE_NAME: "${params.MICROSERVICE_NAME}"
],
installation: 'ansible',
credentialsId: 'ssh-to-server',
disableHostKeyChecking: true,
colorized: true,
)
}
}
}
}
}