ansible-role-swarm/tasks/service.yml

39 lines
901 B
YAML
Raw Normal View History

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:
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 }}'
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 }}'
state: started
2018-12-22 13:55:51 +00:00
enabled: yes
loop: '{{ docker_services|list }}'
tags: docker
#- name: apply docker-compose configuration
# systemd:
# name: 'docker-compose@{{ item.item.key }}'
# state: reloaded
# loop: '{{ config.results }}'
# when: item.changed
# tags: docker