aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/docker/tasks/main.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-09-22 11:04:34 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-09-22 11:19:06 +0200
commit33847d19fb2a76e91486e63b473afb4aa13de4cb (patch)
treeef126214e62889c253086b7eaa5af218a26c7ea3 /roles/docker/tasks/main.yml
parentdocker: refactoring (diff)
downloadinfra-ansible-33847d19fb2a76e91486e63b473afb4aa13de4cb.tar.gz
infra-ansible-33847d19fb2a76e91486e63b473afb4aa13de4cb.zip
docker: avoid duplicate service restarts
Diffstat (limited to '')
-rw-r--r--roles/docker/tasks/main.yml20
1 files changed, 11 insertions, 9 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index f4ba814..95f8565 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -1,19 +1,21 @@
+- name: Configure Docker logging driver
+ when: docker_logging_driver is defined and docker_logging_driver
+ ansible.builtin.include_tasks: logging.yml
+
- name: Install Docker
become: true
- ansible.builtin.apt:
+ ansible.builtin.package:
name:
- docker.io
- docker-compose
state: present
- policy_rc_d: 101
- notify: docker_restart
-- name: Configure Docker logging driver
- when: docker_logging_driver is defined and docker_logging_driver
- ansible.builtin.include_tasks: logging.yml
-
-- name: Restart systemd service if necessary
- ansible.builtin.meta: flush_handlers
+- name: Enable & start Docker service
+ become: true
+ ansible.builtin.systemd_service:
+ name: docker
+ enabled: true
+ state: started
- name: Clean up Docker data
become: true