feat(vars): add check to load global vars file before running deployment

This commit is contained in:
Bertrand Lanson 2024-01-02 21:11:32 +01:00
parent 27df88ae09
commit 34bb4bd7ad
2 changed files with 16 additions and 3 deletions

View File

@ -8,6 +8,7 @@
- name: "debug"
ansible.builtin.debug:
msg: "{{ hashi_vault_configuration.listener }}"
- name: "Vault"
when: enable_vault | bool
when: "'vault_servers' in group_names"

View File

@ -5,6 +5,18 @@
gather_facts: true
become: true
tasks:
- name: "Load global variables"
block:
- name: "Stat global configuration file"
ansible.builtin.stat:
path: "{{ configuration_directory }}/{{ configuration_global_vars_file }}"
register: _global_config_file
- name: "Make sure global configuration file exists"
ansible.builtin.assert:
that:
- _global_config_file.stat.exists
- name: "Load global variables"
ansible.builtin.include_vars:
dir: "{{ configuration_directory }}"