This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker/tasks/services.yml

36 lines
913 B
YAML
Raw Normal View History

2022-12-22 19:18:27 +00:00
# vim: ft=yaml.ansible
2022-12-21 21:25:10 +00:00
---
- 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) start Docker daemon
2022-12-22 22:34:09 +00:00
service:
name: "{{ item }}"
enabled: false
state: "{{ 'restarted' if daemon_config.changed else 'started' }}"
2022-12-22 22:34:09 +00:00
loop:
- docker.socket
- docker.service
2022-12-22 19:18:27 +00:00
- name: Create base directory for Docker volumes
file:
name: "{{ base_volume }}"
owner: "{{ ansible_user }}"
mode: u=rwx,g=rx,o=rx
state: directory
2022-12-21 21:25:10 +00:00
- name: Deploy services
2022-12-25 23:29:46 +00:00
include_tasks: "services/{{ item.service }}.yml"
loop: "{{ services | dict2items(key_name='service') }}"
when: single_service is not defined
2022-12-21 21:25:10 +00:00
- name: Deploy single service
2022-12-25 23:29:46 +00:00
include_tasks: "services/{{ single_service }}.yml"
2022-12-21 21:25:10 +00:00
when: single_service is defined and
2022-12-25 23:29:46 +00:00
single_service in services