From 01b9953fc7493dc0b6f5e1fbd1ae69758511629d Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 21 Jan 2020 20:24:50 -0500 Subject: [PATCH] Explanatory Error Msgs in 0-init/tasks/validate_vars.yml --- roles/0-init/tasks/validate_vars.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/0-init/tasks/validate_vars.yml b/roles/0-init/tasks/validate_vars.yml index 18407fa60..4741f3d30 100644 --- a/roles/0-init/tasks/validate_vars.yml +++ b/roles/0-init/tasks/validate_vars.yml @@ -86,6 +86,7 @@ - name: Assert that {{ vars_checklist | length }} "XYZ_install" vars are all... defined assert: that: "{{ item }}_install is defined" + fail_msg: "PLEASE GIVE THIS VARIABLE A PROPER (UNQUOTED) BOOLEAN VALUE e.g. in: /etc/iiab/local_vars.yml" quiet: yes loop: "{{ vars_checklist }}" #register: install_vars_defined @@ -93,6 +94,7 @@ - name: Assert that {{ vars_checklist | length }} "XYZ_enabled" vars are all... defined assert: that: "{{ item }}_enabled is defined" + fail_msg: "PLEASE GIVE THIS VARIABLE A PROPER (UNQUOTED) BOOLEAN VALUE e.g. in: /etc/iiab/local_vars.yml" quiet: yes loop: "{{ vars_checklist }}" #register: enabled_vars_defined @@ -100,6 +102,7 @@ - name: Assert that {{ vars_checklist | length }} "XYZ_install" vars are all... type boolean (NOT type string, which can invert logic!) assert: that: "{{ item }}_install | type_debug == 'bool'" + fail_msg: "PLEASE GIVE THIS VARIABLE A PROPER (UNQUOTED) BOOLEAN VALUE e.g. in: /etc/iiab/local_vars.yml" quiet: yes loop: "{{ vars_checklist }}" #register: install_vars_boolean @@ -107,6 +110,7 @@ - name: Assert that {{ vars_checklist | length }} "XYZ_enabled" vars are all... type boolean (NOT type string, which can invert logic!) assert: that: "{{ item }}_enabled | type_debug == 'bool'" + fail_msg: "PLEASE GIVE THIS VARIABLE A PROPER (UNQUOTED) BOOLEAN VALUE e.g. in: /etc/iiab/local_vars.yml" quiet: yes loop: "{{ vars_checklist }}" #register: enabled_vars_boolean @@ -114,6 +118,7 @@ - name: 'DISALLOW "XYZ_install: False" WITH "XYZ_enabled: True" ...for all {{ vars_checklist | length }} var pairs' assert: that: "{{ item }}_install or not {{ item }}_enabled" + fail_msg: "PLEASE VERIFY THESE 2 VARIABLES e.g. in: /etc/iiab/local_vars.yml" #fail_msg: '{{ item }}_install or not {{ item }}_enabled {{ item }}_install is {{ {{ item }}_install }} {{ item }}_enabled is {{ {{ item }}_enabled }}' # Is there a way to output var values ? quiet: yes loop: "{{ vars_checklist }}"