47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
|
---
|
||
|
# task/configure file for hashicorp_nomad
|
||
|
- name: "Ensure default nomad.hcl is removed"
|
||
|
ansible.builtin.file:
|
||
|
path: /etc/nomad.d/nomad.hcl
|
||
|
state: absent
|
||
|
|
||
|
- name: "Copy nomad.json template"
|
||
|
ansible.builtin.template:
|
||
|
src: nomad.json.j2
|
||
|
dest: "{{ hashi_nomad_config_dir }}/nomad.json"
|
||
|
owner: "{{ hashi_nomad_user }}"
|
||
|
group: "{{ hashi_nomad_group }}"
|
||
|
mode: '0600'
|
||
|
notify:
|
||
|
- "systemctl-enable-nomad"
|
||
|
- "systemctl-restart-nomad"
|
||
|
|
||
|
- name: "Create nomad.env"
|
||
|
ansible.builtin.template:
|
||
|
src: nomad.env.j2
|
||
|
dest: "{{ hashi_nomad_config_dir }}/nomad.env"
|
||
|
owner: "{{ hashi_nomad_user }}"
|
||
|
group: "{{ hashi_nomad_group }}"
|
||
|
mode: '0600'
|
||
|
|
||
|
- name: "Copy extra configuration files"
|
||
|
when: hashi_nomad_extra_files
|
||
|
block:
|
||
|
- name: "Create directory {{ hashi_nomad_extra_files_dst }}"
|
||
|
ansible.builtin.file:
|
||
|
path: "{{ hashi_nomad_extra_files_dst }}"
|
||
|
state: directory
|
||
|
owner: "{{ hashi_nomad_user }}"
|
||
|
group: "{{ hashi_nomad_group }}"
|
||
|
mode: '0755'
|
||
|
|
||
|
- name: "Copy extra configuration files"
|
||
|
ansible.builtin.template:
|
||
|
src: "{{ item }}"
|
||
|
dest: "{{ hashi_nomad_extra_files_dst }}/{{ (item | basename).split('.')[:-1] | join('.')}}"
|
||
|
owner: "{{ hashi_nomad_user }}"
|
||
|
group: "{{ hashi_nomad_group }}"
|
||
|
mode: '0600'
|
||
|
with_fileglob:
|
||
|
- "{{ hashi_nomad_extra_files_src }}/*"
|