hcp-ansible/roles/nomad/tasks/recursive_copy_extra_dirs.yml
Bertrand Lanson 2c9f538cef
All checks were successful
development / Check commit compliance (push) Successful in 6s
feat(roles): integrate nomad role to hashistack collection
2024-07-19 23:32:24 +02:00

28 lines
880 B
YAML

---
# task/recursive_copy_extra_dirs file for hashicorp_nomad
- name: "Nomad | Ensure destination directory exists"
ansible.builtin.file:
path: "{{ dir_source_item.dest }}"
recurse: true
state: directory
mode: "0775"
- name: "Nomad | Create extra directory sources"
ansible.builtin.file:
path: "{{ dir_source_item.dest }}/{{ item.path }}"
recurse: true
state: directory
mode: "0775"
with_community.general.filetree: "{{ dir_source_item.src }}/"
when: item.state == 'directory'
- name: "Nomad | Template extra directory sources"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ dir_source_item.dest }}/{{ item.path | regex_replace('\\.j2$', '') }}"
owner: "{{ nomad_user }}"
group: "{{ nomad_group }}"
mode: "0700"
with_community.general.filetree: "{{ dir_source_item.src }}/"
when: item.state == 'file'