Skip to content

Commit 257c0f8

Browse files
author
mafyuh
committedDec 20, 2024
Update ansible/playbooks/deploy-docker.yml
1 parent 7dd6333 commit 257c0f8

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed
 

‎ansible/playbooks/deploy-docker.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,22 @@
55
repo_path: "/home/{{ ansible_user }}/iac/docker/{{ folder }}"
66
tasks:
77
- name: Ensure the repository is up-to-date
8-
shell: git pull
8+
ansible.builtin.shell: git pull
99
args:
1010
chdir: "{{ repo_path }}"
1111
register: git_pull_output
1212

1313
- name: Display git pull output
14-
debug:
14+
ansible.builtin.debug:
1515
var: git_pull_output.stdout_lines
1616

17-
- name: Restart services
18-
command: docker compose up -d --remove-orphans
19-
args:
20-
chdir: "{{ repo_path }}"
17+
- name: Restart services using Docker Compose
18+
community.docker.docker_compose_v2:
19+
project_src: "{{ repo_path }}"
20+
state: present
21+
remove_orphans: true
2122
register: docker_compose_output
2223

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
24+
- name: Display docker compose output
25+
ansible.builtin.debug:
26+
var: docker_compose_output

0 commit comments

Comments
 (0)
Please sign in to comment.