forked from srinivas1987devops/myweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkins-ansible
48 lines (45 loc) · 1.4 KB
/
Jenkins-ansible
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 any
tools {
maven 'Maven-3.6.1'
}
environment{
PATH = "/opt/maven3/bin:$PATH"
}
stages{
stage("Git Checkout"){
steps{
git credentialsId: 'javahome2', url: 'https://github.com/srinivas1987devops/myweb.git'
}
}
stage("Maven Build"){
steps{
sh "mvn clean sonar:sonar package"
}
}
stage('Upload War To Nexus'){
steps{
nexusArtifactUploader artifacts: [
[
artifactId: 'myweb',
classifier: '',
file: "target/myweb-8.2.0.war",
type: 'war'
]
],
credentialsId: 'nexus3',
groupId: 'in.javahome',
nexusUrl: '172.31.46.15:8081',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'sample-releases',
version: '8.2.0'
}
}
stage("Execute Ansible"){
steps{
ansiblePlaybook credentialsId: 'private-key', disableHostKeyChecking: true, installation: 'ansible2', inventory: 'dev.in', playbook: 'copy.yml'
}
}
}
}