Move all Docker tasks under services tag

This commit is contained in:
Sam A. 2022-12-28 17:55:35 +01:00
parent 9a63d6a529
commit b5f028f7ed
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
3 changed files with 20 additions and 25 deletions

View file

@ -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

View file

@ -37,7 +37,8 @@
- docker - docker
- docker-compose - docker-compose
- name: Set up Docker - name: Set up Docker services
import_tasks: docker.yml import_tasks: services.yml
tags: tags:
- services
- reboot - reboot

View file

@ -1,5 +1,22 @@
# vim: ft=yaml.ansible # 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 - name: Create base directory for Docker volumes
file: file:
name: "{{ base_volume }}" name: "{{ base_volume }}"