Update ansible/playbooks/deploy-docker.yml

This commit is contained in:
Matt Reeves 2024-12-19 21:44:47 -05:00
parent 7dd6333fd4
commit 257c0f819d

View file

@ -5,29 +5,22 @@
repo_path: "/home/{{ ansible_user }}/iac/docker/{{ folder }}" repo_path: "/home/{{ ansible_user }}/iac/docker/{{ folder }}"
tasks: tasks:
- name: Ensure the repository is up-to-date - name: Ensure the repository is up-to-date
shell: git pull ansible.builtin.shell: git pull
args: args:
chdir: "{{ repo_path }}" chdir: "{{ repo_path }}"
register: git_pull_output register: git_pull_output
- name: Display git pull output - name: Display git pull output
debug: ansible.builtin.debug:
var: git_pull_output.stdout_lines var: git_pull_output.stdout_lines
- name: Restart services - name: Restart services using Docker Compose
command: docker compose up -d --remove-orphans community.docker.docker_compose_v2:
args: project_src: "{{ repo_path }}"
chdir: "{{ repo_path }}" state: present
remove_orphans: true
register: docker_compose_output register: docker_compose_output
- name: Display docker output - name: Display docker compose output
debug: ansible.builtin.debug:
var: docker_compose_output.stdout_lines var: docker_compose_output
- name: Run Docker Command
command: docker ps
register: docker_output
- name: Display Docker Output
debug:
var: docker_output.stdout_lines