File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Deploy application
3
+ hosts : " {{ target_host }}"
4
+ vars :
5
+ repo_path : " /home/{{ ansible_user }}/iac/{{ folder }}"
6
+ tasks :
7
+ - name : Ensure the repository is up-to-date
8
+ shell : git pull
9
+ args :
10
+ chdir : " {{ repo_path }}"
11
+ register : git_pull_output
12
+
13
+ - name : Display git pull output
14
+ debug :
15
+ var : git_pull_output.stdout_lines
16
+
17
+ - name : Restart services
18
+ command : docker compose up -d
19
+ args :
20
+ chdir : " {{ repo_path }}"
21
+ register : docker_compose_output
22
+
23
+ - name : Display docker output
24
+ debug :
25
+ var : docker_compose_output.stdout_lines
26
+
27
+ - name : Run Docker Command
28
+ command : docker ps
29
+ register : docker_output
30
+
31
+ - name : Display Docker Output
32
+ debug :
33
+ var : docker_output.stdout_lines
You can’t perform that action at this time.
0 commit comments