diff --git a/playbooks/deploy.yml b/playbooks/deploy.yml index f7692a2..ce1f556 100644 --- a/playbooks/deploy.yml +++ b/playbooks/deploy.yml @@ -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" diff --git a/playbooks/load_vars.yml b/playbooks/load_vars.yml index 45724ae..61ea9eb 100644 --- a/playbooks/load_vars.yml +++ b/playbooks/load_vars.yml @@ -6,9 +6,21 @@ become: true tasks: - name: "Load global variables" - ansible.builtin.include_vars: - dir: "{{ configuration_directory }}" - files_matching: "{{ configuration_global_vars_file }}" + 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 }}" + files_matching: "{{ configuration_global_vars_file }}" - name: "Load group specific variables" ansible.builtin.include_vars: