Update ansible/playbooks/deploy-docker.yml
This commit is contained in:
parent
7dd6333fd4
commit
257c0f819d
1 changed files with 10 additions and 17 deletions
|
@ -5,29 +5,22 @@
|
|||
repo_path: "/home/{{ ansible_user }}/iac/docker/{{ folder }}"
|
||||
tasks:
|
||||
- name: Ensure the repository is up-to-date
|
||||
shell: git pull
|
||||
ansible.builtin.shell: git pull
|
||||
args:
|
||||
chdir: "{{ repo_path }}"
|
||||
register: git_pull_output
|
||||
|
||||
- name: Display git pull output
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: git_pull_output.stdout_lines
|
||||
|
||||
- name: Restart services
|
||||
command: docker compose up -d --remove-orphans
|
||||
args:
|
||||
chdir: "{{ repo_path }}"
|
||||
- name: Restart services using Docker Compose
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ repo_path }}"
|
||||
state: present
|
||||
remove_orphans: true
|
||||
register: docker_compose_output
|
||||
|
||||
- name: Display docker output
|
||||
debug:
|
||||
var: docker_compose_output.stdout_lines
|
||||
|
||||
- name: Run Docker Command
|
||||
command: docker ps
|
||||
register: docker_output
|
||||
|
||||
- name: Display Docker Output
|
||||
debug:
|
||||
var: docker_output.stdout_lines
|
||||
- name: Display docker compose output
|
||||
ansible.builtin.debug:
|
||||
var: docker_compose_output
|
Loading…
Add table
Reference in a new issue