computer-playbook/roles/docker/tasks/main.yml

48 lines
1.3 KiB
YAML
Raw Normal View History

2020-12-24 14:27:31 +01:00
---
2023-11-16 12:26:27 +01:00
- name: Wait in a loop until the service update-docker.service is inactive
block:
- name: Check the status of update-docker.service
command: systemctl is-active update-docker.service
register: service_status
changed_when: false
failed_when: service_status.stdout == 'active'
- name: Pause for 60 seconds if the service is still active
pause:
seconds: 60
when: service_status.stdout == 'active'
become: true
until: service_status.stdout != 'active'
retries: 720
delay: 10
- name: Abort if the service is still active after the maximum attempts
fail:
msg: "The update-docker.service is still active after the maximum number of attempts."
when: service_status.stdout == 'active' and service_status.attempts == 10
2020-12-24 14:27:31 +01:00
- name: docker & docker compose install
pacman:
2023-04-19 00:03:13 +02:00
name: ['docker','docker-compose']
2020-12-24 14:27:31 +01:00
state: present
notify: docker restart
2023-04-26 11:52:11 +02:00
- name: "create {{path_docker_compose_files}}"
2021-10-18 18:46:58 +02:00
file:
2023-04-26 11:52:11 +02:00
path: "{{path_docker_compose_files}}"
2021-10-18 18:46:58 +02:00
state: directory
mode: 0700
owner: administrator
group: administrator
2023-04-26 11:52:11 +02:00
- name: "create {{path_docker_volumes}}"
2021-10-18 18:46:58 +02:00
file:
2023-04-26 11:52:11 +02:00
path: "{{path_docker_volumes}}"
2021-10-18 18:46:58 +02:00
state: directory
mode: 0700
owner: administrator
group: administrator
2020-12-24 14:27:31 +01:00
- name: flush docker service
meta: flush_handlers