hcp-ansible/roles/hashistack/tasks/load_group_vars.yml
Bertrand Lanson ff66fe22ae
All checks were successful
development / Check commit compliance (push) Successful in 27s
feat(hashistack): move variable loading to specific role
2024-07-22 23:04:05 +02:00

23 lines
777 B
YAML

---
# task/load_group_vars file for hashistack
- name: "Variables | Stat group specific config file"
ansible.builtin.stat:
path: "{{ hashistack_configuration_directory }}/{{ group_name }}/{{ hashistack_configuration_global_vars_file }}"
register: _group_config_file
loop: "{{ group_names }}"
loop_control:
loop_var: group_name
delegate_to: localhost
- name: "Variables | Load group specific variables"
ansible.builtin.include_vars:
dir: "{{ hashistack_configuration_directory }}/{{ item.group_name }}"
files_matching: "{{ hashistack_configuration_global_vars_file }}"
depth: 1
loop: "{{ _group_config_file.results }}"
when: item.stat.exists
and item.group_name in group_names
loop_control:
loop_var: item
delegate_to: localhost