Role: docker_compose: replace command with module #214
1 changed files with 9 additions and 9 deletions
|
@ -51,13 +51,13 @@
|
||||||
when:
|
when:
|
||||||
- item.network is defined
|
- item.network is defined
|
||||||
|
|
||||||
- name: (re)start container
|
- name: restart changed container
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.command: docker-compose up -d
|
community.docker.docker_compose_v2:
|
||||||
args:
|
project_src: "{{ compose_dest_basedir }}/{{ item.name }}"
|
||||||
chdir: "{{ compose_dest_basedir }}/{{ item.name }}"
|
state: restarted
|
||||||
register: start_result # speichere ergebnis in var
|
dependencies: true
|
||||||
changed_when: "start_result.rc == 0" # markiere tasks als changed when exit-code == 0
|
pull: missing
|
||||||
loop: "{{ compose_files }}"
|
loop: "{{ compose_files }}"
|
||||||
when:
|
when:
|
||||||
- item.state == "present"
|
- item.state == "present"
|
||||||
|
@ -65,9 +65,9 @@
|
||||||
|
|
||||||
- name: stop old container
|
- name: stop old container
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.command: docker-compose down # noqa no-changed-when
|
community.docker.docker_compose_v2:
|
||||||
args:
|
project_src: "{{ compose_dest_basedir }}/{{ item.name }}"
|
||||||
chdir: "{{ compose_dest_basedir }}/{{ item.name }}"
|
state: absent
|
||||||
loop: "{{ compose_files }}"
|
loop: "{{ compose_files }}"
|
||||||
when:
|
when:
|
||||||
- item.state == "absent"
|
- item.state == "absent"
|
||||||
|
|
Loading…
Reference in a new issue