--- - 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 }}' dest: '/etc/docker/compose/{{ item.key }}/docker-compose.yml' owner: root group: root mode: 0640 loop: '{{ docker_services|dict2items }}' notify: reload docker-compose no_log: true tags: docker - name: enable and start docker-compose systemd: name: 'docker-compose@{{ item }}' state: started 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