@@ -25,8 +25,10 @@ Test the connection "Test Connection"
25
25
26
26
### Part-02 - Execute job to connect
27
27
28
- create a copywarfile.yml on Ansible
28
+ create a copywarfile.yml on Ansible under /opt/playbooks
29
+
29
30
``` sh
31
+ # copywarfile.yml
30
32
---
31
33
- hosts: all
32
34
become: true
@@ -37,27 +39,27 @@ create a copywarfile.yml on Ansible
37
39
dest: /opt/apache-tomcat-8.5.32/webapps
38
40
```
39
41
Add tomcat server details to /etc/ansible/hosts (if you are using other hosts file update server info there)
40
-
42
+ ``` sh
41
43
echo " <server_IP>" >> /etc/ansible/hosts
42
-
44
+ ```
43
45
Create * Jenkins job* , Fill the following details,
46
+
44
47
- * Source Code Management:*
45
48
- Repository: ` https://github.com/ValaxyTech/hello-world.git `
46
49
- Branches to build : ` */master `
47
50
- * Build:*
48
51
- Root POM:` pom.xml `
49
52
- Goals and options : ` clean install package `
50
53
51
- Add post-build steps
52
- - Send files or execute commands over SSH
53
- - SSH Server : ` ansible_server `
54
- - Source fiels: webapp/target/* .war
55
- - Remote directory //opt//playbooks
56
- Post Steps
57
- Add post-build steps
58
- - Send files or execute commands over ssH
59
- - SSH Server : ` ansible_server `
60
- - Exec command ansible-playbook /opt/playbooks/copywarfile.yml
54
+ - * Add post-build steps*
55
+ - Send files or execute commands over SSH
56
+ - SSH Server : ` ansible_server `
57
+ - Source fiels: ` webapp/target/*.war `
58
+ - Remote directory: ` //opt//playbooks `
59
+ - * Add post-build steps*
60
+ - Send files or execute commands over ssH
61
+ - SSH Server : ` ansible_server `
62
+ - Exec command ansible-playbook /opt/playbooks/copywarfile.yml
61
63
62
64
Execute job and you should be able to seen build has been deployed on Tomcat server.
63
65
0 commit comments