From 91763f13a0a267848116fa4aaef71a638f6667d5 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Mon, 13 Apr 2020 20:19:14 +0200 Subject: [PATCH] Be more careful about loading --- plays/lib/vars.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/plays/lib/vars.yml b/plays/lib/vars.yml index 728e64f..5de6896 100644 --- a/plays/lib/vars.yml +++ b/plays/lib/vars.yml @@ -1,15 +1,25 @@ --- +- name: Check if internal system variables exists + stat: + path: "{{ plugin_config_root }}/vars.yml" + register: vars_yml + +- name: Load internal system variables + no_log: true + when: vars_yml.stat.exists + include_vars: + file: "{{ plugin_config_root }}/vars.yml" + +- name: Check if the app config file exists + stat: + path: "{{ app_config_root }}/config.yml" + register: config_yml + - name: Load unencrypted variables no_log: true + when: config_yml.stat.exists include_vars: - ignore_unknown_extensions: true - dir: "{{ item }}" - extensions: - - yml - - yaml - with_items: - - "{{ plugin_config_root }}" # vars.yml system variables - - "{{ app_config_root }}" # config.yml end-user variables + file: "{{ app_config_root }}/config.yml" - name: Check if a vault directory exists stat: