From a574caac26919c648be90986a28e3f021e519feb Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Sun, 14 Jul 2024 16:19:43 +0200 Subject: [PATCH] fix: force load all variables in group_vars uring the variable loading process to make them top priority over every role variables --- playbooks/tasks/load_vars.yml | 6 +++++- playbooks/tasks/misc/load_all_vars.yml | 1 - playbooks/tasks/misc/load_ca_certificates.yml | 4 +++- playbooks/tasks/misc/load_global_vars.yml | 7 +++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/playbooks/tasks/load_vars.yml b/playbooks/tasks/load_vars.yml index ec8785f..ea642c3 100644 --- a/playbooks/tasks/load_vars.yml +++ b/playbooks/tasks/load_vars.yml @@ -23,7 +23,6 @@ owner: root group: root mode: 0755 - recurse: yes loop: - "{{ hashistack_remote_config_dir }}" - "{{ hashistack_remote_data_dir }}" @@ -52,3 +51,8 @@ when: - enable_nomad | bool - "('nomad_servers' in group_names) or ('nomad_clients' in group_names)" +# - name: "Print all config" +# ansible.builtin.debug: +# msg: "{{ hostvars[inventory_hostname] }}" +# +# - fail: diff --git a/playbooks/tasks/misc/load_all_vars.yml b/playbooks/tasks/misc/load_all_vars.yml index 2e5eea5..b77b930 100644 --- a/playbooks/tasks/misc/load_all_vars.yml +++ b/playbooks/tasks/misc/load_all_vars.yml @@ -121,7 +121,6 @@ owner: root group: root mode: 0755 - recurse: yes loop: - "{{ hashistack_remote_config_dir }}" - "{{ hashistack_remote_data_dir }}" diff --git a/playbooks/tasks/misc/load_ca_certificates.yml b/playbooks/tasks/misc/load_ca_certificates.yml index 4ab0d47..892dd5c 100644 --- a/playbooks/tasks/misc/load_ca_certificates.yml +++ b/playbooks/tasks/misc/load_ca_certificates.yml @@ -30,10 +30,12 @@ mode: 0644 loop: "{{ _hashistack_cacert_files.files }}" register: _hashistack_copied_ca + when: not _hashistack_cacert_files.skipped | default(False) - name: "Copy and update trust store" + when: not _hashistack_copied_ca.skipped | default(False) block: - - name: "Copy ca certificates to /usr/loca/share/ca-certificates" + - name: "Copy ca certificates to /usr/local/share/ca-certificates" ansible.builtin.file: state: link src: "{{ item.dest }}" diff --git a/playbooks/tasks/misc/load_global_vars.yml b/playbooks/tasks/misc/load_global_vars.yml index e162ee9..54284d6 100644 --- a/playbooks/tasks/misc/load_global_vars.yml +++ b/playbooks/tasks/misc/load_global_vars.yml @@ -1,4 +1,11 @@ --- +- name: "Include all default variables" + ansible.builtin.include_vars: + dir: "../../group_vars/all" + depth: 1 + extensions: ["yml"] + delegate_to: localhost + - name: "Stat global configuration file" ansible.builtin.stat: path: "{{ configuration_directory }}/{{ configuration_global_vars_file }}"