-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
31 lines (30 loc) · 1.09 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
pipeline {
agent any
environment {
MY_IP = 'ip'
}
stages {
stage('Spinup VM') {
when { branch 'master' }
steps {
sh 'cd terraform ; terraform init'
// sh 'cd terraform ; terraform destroy -state=${HOME}/tfstates/terraform-helpdesk.tfstate -auto-approve'
// Change this
sh 'cd terraform ; terraform apply -state=${HOME}/tfstates/terraform-umove.tfstate -auto-approve'
// Changre thio
script{
MY_IP = sh(returnStdout: true, script: 'terraform output -state=${HOME}/tfstates/terraform-umove.tfstate public_ip_address').trim()
}
}
}
stage('Node tools installation and application start') {
when { branch 'master' }
steps {
sh "sleep 20"
sh "echo ${MY_IP} ansible_ssh_user=ubuntu > ./ansible/host"
sh 'cd ansible ; cat host'
sh 'cd ansible ; ansible-playbook -i host playbook.yml'
}
}
}
}