Skip to content
Snippets Groups Projects
Verified Commit 6f124c53 authored by David Mehren's avatar David Mehren
Browse files

Use community.docker.docker_compose_v2 instead of shell commands

parent 027fd30d
No related branches found
No related tags found
No related merge requests found
......@@ -10,4 +10,9 @@ Set up a service using Docker Compose
`compose_service_run_prune` If prune should be run after deploying (on by default)
`compose_service_registry_url` (optional) Custom registry URL
`compose_service_registry_username` (optional) Custom registry credentials
`compose_service_registry_password` (optional) Custom registry credentials
\ No newline at end of file
`compose_service_registry_password` (optional) Custom registry credentials
### Contributors
- Fachschaft Informatik, TU Dortmund
- Rhein-Ruhr Systemtechnik GmbH, Bochum
\ No newline at end of file
---
# handlers file for compose_service
......@@ -8,5 +8,8 @@ galaxy_info:
- name: Ubuntu
versions:
- all
- name: Debian
versions:
- all
dependencies:
- role: geerlingguy.docker
......@@ -26,25 +26,13 @@
password: "{{ compose_service_registry_password }}"
when: compose_service_registry_url is defined
- name: Validate compose file
ansible.builtin.command:
cmd: docker compose --file docker-compose.yml config --quiet
chdir: /opt/{{ compose_service_name }}
changed_when: false
- name: Pull container images
ansible.builtin.command:
cmd: docker compose --ansi never --progress plain --file docker-compose.yml pull
chdir: /opt/{{ compose_service_name }}
register: temp_compose_pull
changed_when: "'Downloading' in temp_compose_pull.stdout"
community.docker.docker_compose_v2_pull:
project_src: /opt/{{ compose_service_name }}
- name: Start containers
ansible.builtin.command:
cmd: docker compose --ansi never --progress plain --file docker-compose.yml up --detach
chdir: /opt/{{ compose_service_name }}
register: temp_compose_up
changed_when: "'Started' in temp_compose_up.stdout"
community.docker.docker_compose_v2:
project_src: /opt/{{ compose_service_name }}
- name: Prune unused and dangling images & containers
community.docker.docker_prune:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment