diff --git a/roles/docker/tasks/docker.yml b/roles/docker/tasks/docker.yml deleted file mode 100644 index 3d54497..0000000 --- a/roles/docker/tasks/docker.yml +++ /dev/null @@ -1,23 +0,0 @@ -# vim: ft=yaml.ansible ---- -- name: Copy Docker daemon config file - template: - src: daemon.json.j2 - dest: /etc/docker/daemon.json - owner: root - mode: u=rw,g=r,o=r - register: daemon_config - -- name: Disable and (re)start Docker daemon - service: - name: "{{ item }}" - enabled: false - state: "{{ 'restarted' if daemon_config.changed else 'started' }}" - loop: - - docker.socket - - docker.service - -- name: Set up Docker services - import_tasks: services.yml - tags: - - services diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 3d6bdfc..b43f2ce 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -37,7 +37,8 @@ - docker - docker-compose -- name: Set up Docker - import_tasks: docker.yml +- name: Set up Docker services + import_tasks: services.yml tags: + - services - reboot diff --git a/roles/docker/tasks/services.yml b/roles/docker/tasks/services.yml index c0f5a22..09d9a36 100644 --- a/roles/docker/tasks/services.yml +++ b/roles/docker/tasks/services.yml @@ -1,5 +1,22 @@ # vim: ft=yaml.ansible --- +- name: Copy Docker daemon config file + template: + src: daemon.json.j2 + dest: /etc/docker/daemon.json + owner: root + mode: u=rw,g=r,o=r + register: daemon_config + +- name: Disable and (re)start Docker daemon + service: + name: "{{ item }}" + enabled: false + state: "{{ 'restarted' if daemon_config.changed else 'started' }}" + loop: + - docker.socket + - docker.service + - name: Create base directory for Docker volumes file: name: "{{ base_volume }}"