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
...@@ -11,3 +11,8 @@ Set up a service using Docker Compose ...@@ -11,3 +11,8 @@ Set up a service using Docker Compose
`compose_service_registry_url` (optional) Custom registry URL `compose_service_registry_url` (optional) Custom registry URL
`compose_service_registry_username` (optional) Custom registry credentials `compose_service_registry_username` (optional) Custom registry credentials
`compose_service_registry_password` (optional) Custom registry credentials `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: ...@@ -8,5 +8,8 @@ galaxy_info:
- name: Ubuntu - name: Ubuntu
versions: versions:
- all - all
- name: Debian
versions:
- all
dependencies: dependencies:
- role: geerlingguy.docker - role: geerlingguy.docker
...@@ -26,25 +26,13 @@ ...@@ -26,25 +26,13 @@
password: "{{ compose_service_registry_password }}" password: "{{ compose_service_registry_password }}"
when: compose_service_registry_url is defined 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 - name: Pull container images
ansible.builtin.command: community.docker.docker_compose_v2_pull:
cmd: docker compose --ansi never --progress plain --file docker-compose.yml pull project_src: /opt/{{ compose_service_name }}
chdir: /opt/{{ compose_service_name }}
register: temp_compose_pull
changed_when: "'Downloading' in temp_compose_pull.stdout"
- name: Start containers - name: Start containers
ansible.builtin.command: community.docker.docker_compose_v2:
cmd: docker compose --ansi never --progress plain --file docker-compose.yml up --detach project_src: /opt/{{ compose_service_name }}
chdir: /opt/{{ compose_service_name }}
register: temp_compose_up
changed_when: "'Started' in temp_compose_up.stdout"
- name: Prune unused and dangling images & containers - name: Prune unused and dangling images & containers
community.docker.docker_prune: community.docker.docker_prune:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment