--- - name: 'Ensures {{ current_base_path }}/{{ current_destination }} directory exists' file: state: directory path: '{{ current_base_path }}/{{ current_destination }}' tags: - update_deployment - update_config - name: 'Ensure directory structure for {{ current_config }} exists' file: path: "{{ current_base_path }}/{{ current_destination }}/{{ item.path }}" state: directory owner: "{{ current_owner }}" group: "{{ current_group }}" mode: 0755 with_filetree: "templates/{{ current_config }}" when: item.state == "directory" tags: - update_config - name: Ensure docker files are populated from templates template: src: "{{ item.src }}" dest: "{{ current_base_path }}/{{ current_destination }}/{{ item.path | regex_replace('\\.j2$', '') }}" owner: "{{ current_owner }}" group: "{{ current_group }}" mode: 0644 with_filetree: "templates/_docker" when: item.state == 'file' and item.src is match('.*\.j2$') tags: - update_deployment - update_config - name: Ensure config template files are populated from templates template: src: "{{ item.src }}" dest: "{{ current_base_path }}/{{ current_destination }}/{{ item.path | regex_replace('\\.j2$', '') }}" owner: "{{ current_owner }}" group: "{{ current_group }}" mode: 0644 with_filetree: "templates/{{ current_config }}" when: item.state == 'file' and item.src is match('.*\.j2$') tags: - update_config - name: Ensure config files are populated from templates copy: src: "{{ item.src }}" dest: "{{ current_base_path }}/{{ current_destination }}/{{ item.path }}" owner: "{{ current_owner }}" group: "{{ current_group }}" mode: 0644 with_filetree: "templates/{{ current_config }}" when: item.state == 'file' and item.src is not match('.*\.j2$') tags: - update_config