2018-12-22 13:55:51 +00:00
|
|
|
---
|
|
|
|
- name: create docker-compose folders
|
|
|
|
file:
|
|
|
|
path: '/etc/docker/compose/{{ item }}'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0750
|
|
|
|
state: directory
|
|
|
|
loop: '{{ docker_services|list }}'
|
|
|
|
tags: docker
|
|
|
|
|
|
|
|
- name: copy docker-compose configuration
|
|
|
|
copy:
|
2018-12-23 10:30:26 +00:00
|
|
|
content: '{{ item.value|to_nice_yaml }}'
|
2018-12-22 13:55:51 +00:00
|
|
|
dest: '/etc/docker/compose/{{ item.key }}/docker-compose.yml'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0640
|
|
|
|
loop: '{{ docker_services|dict2items }}'
|
2018-12-23 10:30:26 +00:00
|
|
|
notify: reload docker-compose
|
2018-12-22 13:55:51 +00:00
|
|
|
no_log: true
|
|
|
|
tags: docker
|
|
|
|
|
|
|
|
- name: enable and start docker-compose
|
|
|
|
systemd:
|
|
|
|
name: 'docker-compose@{{ item }}'
|
2018-12-23 10:30:26 +00:00
|
|
|
state: started
|
2018-12-22 13:55:51 +00:00
|
|
|
enabled: yes
|
|
|
|
loop: '{{ docker_services|list }}'
|
|
|
|
tags: docker
|
2018-12-23 10:30:26 +00:00
|
|
|
|
|
|
|
#- name: apply docker-compose configuration
|
|
|
|
# systemd:
|
|
|
|
# name: 'docker-compose@{{ item.item.key }}'
|
|
|
|
# state: reloaded
|
|
|
|
# loop: '{{ config.results }}'
|
|
|
|
# when: item.changed
|
|
|
|
# tags: docker
|