From a846fb78c722c437db09d5da7019a40983f8b6ac Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 13 Feb 2024 17:59:39 -0500 Subject: [PATCH 1/8] Update lookup_folder with new variables. --- .../targets/lookup_folder/tasks/test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/integration/targets/lookup_folder/tasks/test.yml b/tests/integration/targets/lookup_folder/tasks/test.yml index 647dc014d..1e55b046c 100644 --- a/tests/integration/targets/lookup_folder/tasks/test.yml +++ b/tests/integration/targets/lookup_folder/tasks/test.yml @@ -57,3 +57,18 @@ }}" delegate_to: localhost run_once: true # noqa run-once[task] + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify folder criticality using ENV vars." + ansible.builtin.assert: + that: "extensions.attributes.tag_criticality == checkmk_folder.criticality" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + extensions: "{{ lookup('checkmk.general.folder', + checkmk_folder.path) + }}" + delegate_to: localhost + run_once: true # noqa run-once[task] From e19fd625656b0ce703890fe69440e0f1e2fac9aa Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Wed, 14 Feb 2024 11:18:43 -0500 Subject: [PATCH 2/8] Update lookup_bakery with new variables. --- .../targets/lookup_bakery/tasks/test.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/integration/targets/lookup_bakery/tasks/test.yml b/tests/integration/targets/lookup_bakery/tasks/test.yml index b594758f0..d41fbc773 100644 --- a/tests/integration/targets/lookup_bakery/tasks/test.yml +++ b/tests/integration/targets/lookup_bakery/tasks/test.yml @@ -20,3 +20,24 @@ ("'initialized' in looked_up_bakery.msg") or ("'stopped' in looked_up_bakery.msg") or ("'exception' in looked_up_bakery.msg") + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Get Checkmk bakery status using ENV vars." + ansible.builtin.debug: + msg: "Bakery status is {{ bakery }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + bakery: "{{ lookup('checkmk.general.bakery') }}" + delegate_to: localhost + register: looked_up_bakery + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify bakery status." + ansible.builtin.assert: + that: ("'finished' in looked_up_bakery.msg") or + ("'running' in looked_up_bakery.msg") or + ("'initialized' in looked_up_bakery.msg") or + ("'stopped' in looked_up_bakery.msg") or + ("'exception' in looked_up_bakery.msg") From 6e671d3ffe39cfed42622af8964f838a91e4cb21 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Thu, 15 Feb 2024 10:20:18 -0500 Subject: [PATCH 3/8] Add changelog and extend documentation. --- changelogs/fragments/lookups.yml | 4 ++++ plugins/lookup/bakery.py | 13 ++++++++++++- plugins/lookup/folder.py | 11 +++++++++++ plugins/lookup/folders.py | 18 ++++++++++++++++++ plugins/lookup/host.py | 11 +++++++++++ plugins/lookup/hosts.py | 14 ++++++++++++++ plugins/lookup/rule.py | 11 +++++++++++ plugins/lookup/rules.py | 14 ++++++++++++++ plugins/lookup/ruleset.py | 11 +++++++++++ plugins/lookup/rulesets.py | 14 ++++++++++++++ plugins/lookup/version.py | 11 +++++++++++ 11 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/lookups.yml diff --git a/changelogs/fragments/lookups.yml b/changelogs/fragments/lookups.yml new file mode 100644 index 000000000..c9c3e4d80 --- /dev/null +++ b/changelogs/fragments/lookups.yml @@ -0,0 +1,4 @@ +minor_changes: + - Lookup modules - Enable usage of ini files, environment and inventory variables + to configure basic settings for the lookup plugins, like the server_url and site + alongside the authentication options. Refer to the module documentation for details. diff --git a/plugins/lookup/bakery.py b/plugins/lookup/bakery.py index 0346e3122..63fdc700d 100644 --- a/plugins/lookup/bakery.py +++ b/plugins/lookup/bakery.py @@ -83,7 +83,7 @@ EXAMPLES = """ - name: "Show bakery status" - debug: + ansible.builtin.debug: msg: "Bakery status is {{ bakery }}" vars: bakery: "{{ lookup('checkmk.general.bakery', @@ -93,6 +93,17 @@ automation_user=automation_user, automation_secret=automation_secret )}}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Bakery status is {{ bakery }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + bakery: "{{ lookup('checkmk.general.bakery') }}" """ RETURN = """ diff --git a/plugins/lookup/folder.py b/plugins/lookup/folder.py index 56a204ca2..22965b838 100644 --- a/plugins/lookup/folder.py +++ b/plugins/lookup/folder.py @@ -100,6 +100,17 @@ validate_certs=False ) }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Attributes of folder /network: {{ attributes }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + attributes: "{{ lookup('checkmk.general.folder', '~tests') }}" """ RETURN = """ diff --git a/plugins/lookup/folders.py b/plugins/lookup/folders.py index 8a3a9708a..570337c15 100644 --- a/plugins/lookup/folders.py +++ b/plugins/lookup/folders.py @@ -136,6 +136,24 @@ loop: "{{ looping|subelements('members.hosts.value') }}" loop_control: label: "{{ item.0.id }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Folder tree: {{ item.id }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + loop: "{{ + lookup('checkmk.general.folders', + '~', + show_hosts=False, + recursive=True, + ) }}" + loop_control: + label: "{{ item.id }}" """ RETURN = """ diff --git a/plugins/lookup/host.py b/plugins/lookup/host.py index a4145221d..d94d8485c 100644 --- a/plugins/lookup/host.py +++ b/plugins/lookup/host.py @@ -107,6 +107,17 @@ validate_certs=False ) }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Attributes of host example: {{ attributes }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + attributes: "{{ lookup('checkmk.general.host', 'example.com', effective_attributes=True) }}" """ RETURN = """ diff --git a/plugins/lookup/hosts.py b/plugins/lookup/hosts.py index 79f2e744e..a98f5c5ab 100644 --- a/plugins/lookup/hosts.py +++ b/plugins/lookup/hosts.py @@ -104,6 +104,20 @@ }}" loop_control: label: "{{ item.id }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Host: {{ item.id }} in folder {{ item.extensions.folder }}, IP: {{ item.extensions.effective_attributes.ipaddress }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + loop: "{{ + lookup('checkmk.general.hosts', effective_attributes=True) }}" + loop_control: + label: "{{ item.id }}" """ RETURN = """ diff --git a/plugins/lookup/rule.py b/plugins/lookup/rule.py index 441b3ac71..ec3e4e1f3 100644 --- a/plugins/lookup/rule.py +++ b/plugins/lookup/rule.py @@ -100,6 +100,17 @@ validate_certs=False ) }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Rule: {{ extensions }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + attributes: "{{ lookup('checkmk.general.rule', rule_id='a9285bc1-dcaf-45e0-a3ba-ad398ef06a49') }}" """ RETURN = """ diff --git a/plugins/lookup/rules.py b/plugins/lookup/rules.py index a9b954f8c..842c98ac3 100644 --- a/plugins/lookup/rules.py +++ b/plugins/lookup/rules.py @@ -129,6 +129,20 @@ }}" loop_control: label: "{{ item.id }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Rule: {{ item.extensions }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + loop: "{{ + lookup('checkmk.general.rules', ruleset='host_groups') }}" + loop_control: + label: "{{ item.id }}" """ RETURN = """ diff --git a/plugins/lookup/ruleset.py b/plugins/lookup/ruleset.py index d25d1cb05..161ce8547 100644 --- a/plugins/lookup/ruleset.py +++ b/plugins/lookup/ruleset.py @@ -100,6 +100,17 @@ validate_certs=False ) }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Ruleset: {{ extensions }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + extensions: "{{ lookup('checkmk.general.ruleset', ruleset='host_groups') }}" """ RETURN = """ diff --git a/plugins/lookup/rulesets.py b/plugins/lookup/rulesets.py index 349920375..a8c39dd8a 100644 --- a/plugins/lookup/rulesets.py +++ b/plugins/lookup/rulesets.py @@ -139,6 +139,20 @@ }}" loop_control: label: "{{ item.0.id }}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Ruleset {{ item.extension.name }} is deprecated." + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + loop: "{{ + lookup('checkmk.general.rulesets', regex='', rulesets_deprecated=True, rulesets_used=True) }}" + loop_control: + label: "{{ item.0.id }}" """ RETURN = """ diff --git a/plugins/lookup/version.py b/plugins/lookup/version.py index 5a87f4ded..8d293ba68 100644 --- a/plugins/lookup/version.py +++ b/plugins/lookup/version.py @@ -92,6 +92,17 @@ automation_user=my_user, automation_secret=my_secret )}}" + +- name: "Use variables outside the module call." + ansible.builtin.debug: + msg: "Server version is {{ version }}" + vars: + ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" + ansible_lookup_checkmk_site: "{{ outer_item.site }}" + ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_validate_certs: false + attributes: "{{ lookup('checkmk.general.version') }}" """ RETURN = """ From 68940f841df56eda2460964c0ae94e806e7ad4f6 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Thu, 15 Feb 2024 12:47:28 -0500 Subject: [PATCH 4/8] Fix variable names. --- plugins/lookup/bakery.py | 6 +++--- plugins/lookup/folder.py | 6 +++--- plugins/lookup/folders.py | 6 +++--- plugins/lookup/host.py | 6 +++--- plugins/lookup/hosts.py | 6 +++--- plugins/lookup/rule.py | 6 +++--- plugins/lookup/rules.py | 6 +++--- plugins/lookup/ruleset.py | 6 +++--- plugins/lookup/rulesets.py | 6 +++--- plugins/lookup/version.py | 6 +++--- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/plugins/lookup/bakery.py b/plugins/lookup/bakery.py index 63fdc700d..712006101 100644 --- a/plugins/lookup/bakery.py +++ b/plugins/lookup/bakery.py @@ -100,9 +100,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false bakery: "{{ lookup('checkmk.general.bakery') }}" """ diff --git a/plugins/lookup/folder.py b/plugins/lookup/folder.py index 22965b838..bf00737f6 100644 --- a/plugins/lookup/folder.py +++ b/plugins/lookup/folder.py @@ -107,9 +107,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false attributes: "{{ lookup('checkmk.general.folder', '~tests') }}" """ diff --git a/plugins/lookup/folders.py b/plugins/lookup/folders.py index 570337c15..03d260728 100644 --- a/plugins/lookup/folders.py +++ b/plugins/lookup/folders.py @@ -143,9 +143,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false loop: "{{ lookup('checkmk.general.folders', '~', diff --git a/plugins/lookup/host.py b/plugins/lookup/host.py index d94d8485c..6db71d786 100644 --- a/plugins/lookup/host.py +++ b/plugins/lookup/host.py @@ -114,9 +114,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false attributes: "{{ lookup('checkmk.general.host', 'example.com', effective_attributes=True) }}" """ diff --git a/plugins/lookup/hosts.py b/plugins/lookup/hosts.py index a98f5c5ab..d2ac43106 100644 --- a/plugins/lookup/hosts.py +++ b/plugins/lookup/hosts.py @@ -111,9 +111,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false loop: "{{ lookup('checkmk.general.hosts', effective_attributes=True) }}" loop_control: diff --git a/plugins/lookup/rule.py b/plugins/lookup/rule.py index ec3e4e1f3..e6c0447ff 100644 --- a/plugins/lookup/rule.py +++ b/plugins/lookup/rule.py @@ -107,9 +107,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false attributes: "{{ lookup('checkmk.general.rule', rule_id='a9285bc1-dcaf-45e0-a3ba-ad398ef06a49') }}" """ diff --git a/plugins/lookup/rules.py b/plugins/lookup/rules.py index 842c98ac3..9d0620b2f 100644 --- a/plugins/lookup/rules.py +++ b/plugins/lookup/rules.py @@ -136,9 +136,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false loop: "{{ lookup('checkmk.general.rules', ruleset='host_groups') }}" loop_control: diff --git a/plugins/lookup/ruleset.py b/plugins/lookup/ruleset.py index 161ce8547..af23d7dd8 100644 --- a/plugins/lookup/ruleset.py +++ b/plugins/lookup/ruleset.py @@ -107,9 +107,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false extensions: "{{ lookup('checkmk.general.ruleset', ruleset='host_groups') }}" """ diff --git a/plugins/lookup/rulesets.py b/plugins/lookup/rulesets.py index a8c39dd8a..fb50b21f2 100644 --- a/plugins/lookup/rulesets.py +++ b/plugins/lookup/rulesets.py @@ -146,9 +146,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false loop: "{{ lookup('checkmk.general.rulesets', regex='', rulesets_deprecated=True, rulesets_used=True) }}" loop_control: diff --git a/plugins/lookup/version.py b/plugins/lookup/version.py index 8d293ba68..e603819a6 100644 --- a/plugins/lookup/version.py +++ b/plugins/lookup/version.py @@ -99,9 +99,9 @@ vars: ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" + ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + ansible_lookup_checkmk_validate_certs: false attributes: "{{ lookup('checkmk.general.version') }}" """ From 0433f903241a523bcc476dd5ff24ea010e33f9d6 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Thu, 15 Feb 2024 13:57:45 -0500 Subject: [PATCH 5/8] Add initial set of tests using the new variables from #546. --- .../files/includes/vars/global.yml | 6 ++++++ .../targets/lookup_bakery/tasks/test.yml | 7 +------ .../targets/lookup_folder/tasks/test.yml | 11 ++--------- .../targets/lookup_folders/tasks/test.yml | 15 ++++++++++++--- .../targets/lookup_host/tasks/test.yml | 8 ++++++++ .../targets/lookup_hosts/tasks/test.yml | 8 ++++++++ .../targets/lookup_rules/tasks/test.yml | 19 +++++++++++++++++++ .../targets/lookup_rulesets/tasks/test.yml | 18 ++++++++++++++++++ .../targets/lookup_version/tasks/test.yml | 7 +++++++ 9 files changed, 81 insertions(+), 18 deletions(-) diff --git a/tests/integration/files/includes/vars/global.yml b/tests/integration/files/includes/vars/global.yml index 57f8bb073..e56ed6faf 100644 --- a/tests/integration/files/includes/vars/global.yml +++ b/tests/integration/files/includes/vars/global.yml @@ -15,3 +15,9 @@ checkmk_server_edition_mapping: cee: enterprise cce: cloud cme: managed + +ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" +ansible_lookup_checkmk_site: "{{ outer_item.site }}" +ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" +ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" +ansible_lookup_checkmk_validate_certs: false diff --git a/tests/integration/targets/lookup_bakery/tasks/test.yml b/tests/integration/targets/lookup_bakery/tasks/test.yml index d41fbc773..034b88552 100644 --- a/tests/integration/targets/lookup_bakery/tasks/test.yml +++ b/tests/integration/targets/lookup_bakery/tasks/test.yml @@ -21,15 +21,10 @@ ("'stopped' in looked_up_bakery.msg") or ("'exception' in looked_up_bakery.msg") -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Get Checkmk bakery status using ENV vars." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." ansible.builtin.debug: msg: "Bakery status is {{ bakery }}" vars: - ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" - ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false bakery: "{{ lookup('checkmk.general.bakery') }}" delegate_to: localhost register: looked_up_bakery diff --git a/tests/integration/targets/lookup_folder/tasks/test.yml b/tests/integration/targets/lookup_folder/tasks/test.yml index 1e55b046c..f028883c9 100644 --- a/tests/integration/targets/lookup_folder/tasks/test.yml +++ b/tests/integration/targets/lookup_folder/tasks/test.yml @@ -58,17 +58,10 @@ delegate_to: localhost run_once: true # noqa run-once[task] -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify folder criticality using ENV vars." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." ansible.builtin.assert: that: "extensions.attributes.tag_criticality == checkmk_folder.criticality" vars: - ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" - ansible_lookup_checkmk_site: "{{ outer_item.site }}" - ansible_lookup_automation_user: "{{ checkmk_var_automation_user }}" - ansible_lookup_automation_secret: "{{ checkmk_var_automation_secret }}" - ansible_lookup_validate_certs: false - extensions: "{{ lookup('checkmk.general.folder', - checkmk_folder.path) - }}" + extensions: "{{ lookup('checkmk.general.folder', checkmk_folder.path) }}" delegate_to: localhost run_once: true # noqa run-once[task] diff --git a/tests/integration/targets/lookup_folders/tasks/test.yml b/tests/integration/targets/lookup_folders/tasks/test.yml index befebd766..8852389d4 100644 --- a/tests/integration/targets/lookup_folders/tasks/test.yml +++ b/tests/integration/targets/lookup_folders/tasks/test.yml @@ -14,7 +14,7 @@ run_once: true # noqa run-once[task] loop: "{{ checkmk_var_folders }}" -- name: "Get all folders." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Get all folders." ansible.builtin.debug: var: folders vars: @@ -30,7 +30,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] -- name: "Get list of all folders." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Get list of all folders." ansible.builtin.debug: msg: "Criticality of {{ item.id }} is {{ item.extensions.attributes.tag_criticality | default('N/A') }}" loop: "{{ lookup('checkmk.general.folders', @@ -47,7 +47,7 @@ loop_control: label: "{{ item.id }}" -- name: "Verify number of folders." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify number of folders." ansible.builtin.assert: # The looked up list contains the main folder, as well. that: "( 1 + checkmk_var_folders|length ) == folders|length" @@ -63,3 +63,12 @@ }}" delegate_to: localhost run_once: true # noqa run-once[task] + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify number of folders." + ansible.builtin.assert: + # The looked up list contains the main folder, as well. + that: "( 1 + checkmk_var_folders|length ) == folders|length" + vars: + folders: "{{ lookup('checkmk.general.folders', '/', recursive=True) }}" + delegate_to: localhost + run_once: true # noqa run-once[task] diff --git a/tests/integration/targets/lookup_host/tasks/test.yml b/tests/integration/targets/lookup_host/tasks/test.yml index 281d673a0..e10ac167d 100644 --- a/tests/integration/targets/lookup_host/tasks/test.yml +++ b/tests/integration/targets/lookup_host/tasks/test.yml @@ -44,3 +44,11 @@ }}" delegate_to: localhost run_once: true # noqa run-once[task] + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." + ansible.builtin.assert: + that: "checkmk_host.alias == extensions.attributes.alias" + vars: + extensions: "{{ lookup('checkmk.general.host', checkmk_host.name) }}" + delegate_to: localhost + run_once: true # noqa run-once[task] diff --git a/tests/integration/targets/lookup_hosts/tasks/test.yml b/tests/integration/targets/lookup_hosts/tasks/test.yml index 3e04d6b30..e9b50d1e7 100644 --- a/tests/integration/targets/lookup_hosts/tasks/test.yml +++ b/tests/integration/targets/lookup_hosts/tasks/test.yml @@ -44,3 +44,11 @@ }}" delegate_to: localhost run_once: true # noqa run-once[task] + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." + ansible.builtin.assert: + that: "checkmk_hosts|length == hosts|length" + vars: + folders: "{{ lookup('checkmk.general.hosts') }}" + delegate_to: localhost + run_once: true # noqa run-once[task] diff --git a/tests/integration/targets/lookup_rules/tasks/test.yml b/tests/integration/targets/lookup_rules/tasks/test.yml index 675237540..eda80fa72 100644 --- a/tests/integration/targets/lookup_rules/tasks/test.yml +++ b/tests/integration/targets/lookup_rules/tasks/test.yml @@ -94,3 +94,22 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ cpu_load_ruleset.rules }}" + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rule." + ansible.builtin.debug: + var: "rule" + vars: + rule: "{{ lookup('checkmk.general.rule', rule_id=item.id) }}" + delegate_to: localhost + run_once: true # noqa run-once[task] + loop: "{{ cpu_load_ruleset.rules }}" + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rules." + ansible.builtin.assert: + # Check the number of rules + that: rules|length == 1 + vars: + rules: "{{ lookup('checkmk.general.rules', ruleset=item, commebt_regex='Ansible managed') }}" + delegate_to: localhost + run_once: true # noqa run-once[task] + loop: "{{ checkmk_rulesets }}" diff --git a/tests/integration/targets/lookup_rulesets/tasks/test.yml b/tests/integration/targets/lookup_rulesets/tasks/test.yml index 8f7482982..94eb8d998 100644 --- a/tests/integration/targets/lookup_rulesets/tasks/test.yml +++ b/tests/integration/targets/lookup_rulesets/tasks/test.yml @@ -80,3 +80,21 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ checkmk_ruleset_regexes }}" + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: ruleset." + ansible.builtin.assert: + # For each rule that we created, check, if the number of rules in its ruleset is 1. + that: "ruleset.number_of_rules == 1" + vars: + ruleset: "{{ lookup('checkmk.general.ruleset', ruleset=item) }}" + delegate_to: localhost + run_once: true # noqa run-once[task] + loop: "{{ checkmk_ruleset_regexes }}" + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rulesets." + ansible.builtin.debug: + var: rulesets + vars: + rulesets: "{{ lookup('checkmk.general.rulesets', regex='file', rulesets_used=False, rulesets_deprecated=False) }}" + delegate_to: localhost + run_once: true # noqa run-once[task] diff --git a/tests/integration/targets/lookup_version/tasks/test.yml b/tests/integration/targets/lookup_version/tasks/test.yml index e4409f64c..b156f5df9 100644 --- a/tests/integration/targets/lookup_version/tasks/test.yml +++ b/tests/integration/targets/lookup_version/tasks/test.yml @@ -16,3 +16,10 @@ - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify Checkmk version." ansible.builtin.assert: that: "outer_item.version in looked_up_version.msg" + +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Get Checkmk version." + ansible.builtin.assert: + that: "outer_item.version in looked_up_version.msg" + vars: + version: "{{ lookup('checkmk.general.version') }}" + delegate_to: localhost From 160f068126bc27b1b7bdcbd95d03704f8a7e3b6d Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Fri, 16 Feb 2024 09:18:24 -0500 Subject: [PATCH 6/8] Bugfix. --- tests/integration/targets/lookup_version/tasks/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/lookup_version/tasks/test.yml b/tests/integration/targets/lookup_version/tasks/test.yml index b156f5df9..63142308f 100644 --- a/tests/integration/targets/lookup_version/tasks/test.yml +++ b/tests/integration/targets/lookup_version/tasks/test.yml @@ -17,9 +17,10 @@ ansible.builtin.assert: that: "outer_item.version in looked_up_version.msg" -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Get Checkmk version." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." ansible.builtin.assert: that: "outer_item.version in looked_up_version.msg" vars: version: "{{ lookup('checkmk.general.version') }}" delegate_to: localhost + register: looked_up_version From d46ce0a06a79625d0a9cbed48aeab516243f7285 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Fri, 16 Feb 2024 09:18:46 -0500 Subject: [PATCH 7/8] Enable extended integration tests, using a hack. --- .../integration/files/includes/vars/global.yml | 12 ++++++++---- .../targets/lookup_bakery/tasks/test.yml | 18 +++++++----------- .../targets/lookup_folder/tasks/test.yml | 1 + .../targets/lookup_folders/tasks/test.yml | 3 ++- .../targets/lookup_host/tasks/test.yml | 1 + .../targets/lookup_hosts/tasks/test.yml | 1 + .../targets/lookup_rules/tasks/test.yml | 2 ++ .../targets/lookup_rulesets/tasks/test.yml | 2 ++ .../targets/lookup_version/tasks/test.yml | 1 + 9 files changed, 25 insertions(+), 16 deletions(-) diff --git a/tests/integration/files/includes/vars/global.yml b/tests/integration/files/includes/vars/global.yml index e56ed6faf..f243be9f5 100644 --- a/tests/integration/files/includes/vars/global.yml +++ b/tests/integration/files/includes/vars/global.yml @@ -16,8 +16,12 @@ checkmk_server_edition_mapping: cce: cloud cme: managed -ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" -ansible_lookup_checkmk_site: "{{ outer_item.site }}" -ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" -ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + +# This is a very hacky workaround, as it is not possible to assign variables +# to other variables when using them in lookup modules. +ansible_lookup_checkmk_server_url: "http://127.0.0.1" +ansible_lookup_checkmk_site: "stable_cee" # This is especially hacky. + # All integration tests were adapted to run the specific task only on this site. +ansible_lookup_checkmk_automation_user: "cmkadmin" +ansible_lookup_checkmk_automation_secret: "Sup3rSec4et!" ansible_lookup_checkmk_validate_certs: false diff --git a/tests/integration/targets/lookup_bakery/tasks/test.yml b/tests/integration/targets/lookup_bakery/tasks/test.yml index 034b88552..a24572023 100644 --- a/tests/integration/targets/lookup_bakery/tasks/test.yml +++ b/tests/integration/targets/lookup_bakery/tasks/test.yml @@ -22,17 +22,13 @@ ("'exception' in looked_up_bakery.msg") - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." - ansible.builtin.debug: - msg: "Bakery status is {{ bakery }}" + ansible.builtin.assert: + that: ("'finished' in bakery.msg") or + ("'running' in bakery.msg") or + ("'initialized' in bakery.msg") or + ("'stopped' in bakery.msg") or + ("'exception' in bakery.msg") vars: bakery: "{{ lookup('checkmk.general.bakery') }}" delegate_to: localhost - register: looked_up_bakery - -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify bakery status." - ansible.builtin.assert: - that: ("'finished' in looked_up_bakery.msg") or - ("'running' in looked_up_bakery.msg") or - ("'initialized' in looked_up_bakery.msg") or - ("'stopped' in looked_up_bakery.msg") or - ("'exception' in looked_up_bakery.msg") + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_folder/tasks/test.yml b/tests/integration/targets/lookup_folder/tasks/test.yml index f028883c9..11522c352 100644 --- a/tests/integration/targets/lookup_folder/tasks/test.yml +++ b/tests/integration/targets/lookup_folder/tasks/test.yml @@ -65,3 +65,4 @@ extensions: "{{ lookup('checkmk.general.folder', checkmk_folder.path) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_folders/tasks/test.yml b/tests/integration/targets/lookup_folders/tasks/test.yml index 8852389d4..f7109c8bc 100644 --- a/tests/integration/targets/lookup_folders/tasks/test.yml +++ b/tests/integration/targets/lookup_folders/tasks/test.yml @@ -64,7 +64,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify number of folders." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." ansible.builtin.assert: # The looked up list contains the main folder, as well. that: "( 1 + checkmk_var_folders|length ) == folders|length" @@ -72,3 +72,4 @@ folders: "{{ lookup('checkmk.general.folders', '/', recursive=True) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_host/tasks/test.yml b/tests/integration/targets/lookup_host/tasks/test.yml index e10ac167d..c5f98fb5f 100644 --- a/tests/integration/targets/lookup_host/tasks/test.yml +++ b/tests/integration/targets/lookup_host/tasks/test.yml @@ -52,3 +52,4 @@ extensions: "{{ lookup('checkmk.general.host', checkmk_host.name) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_hosts/tasks/test.yml b/tests/integration/targets/lookup_hosts/tasks/test.yml index e9b50d1e7..8642c7ad3 100644 --- a/tests/integration/targets/lookup_hosts/tasks/test.yml +++ b/tests/integration/targets/lookup_hosts/tasks/test.yml @@ -52,3 +52,4 @@ folders: "{{ lookup('checkmk.general.hosts') }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_rules/tasks/test.yml b/tests/integration/targets/lookup_rules/tasks/test.yml index eda80fa72..3189b24af 100644 --- a/tests/integration/targets/lookup_rules/tasks/test.yml +++ b/tests/integration/targets/lookup_rules/tasks/test.yml @@ -103,6 +103,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ cpu_load_ruleset.rules }}" + when: outer_item.edition == "stable_cee" - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rules." ansible.builtin.assert: @@ -113,3 +114,4 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ checkmk_rulesets }}" + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_rulesets/tasks/test.yml b/tests/integration/targets/lookup_rulesets/tasks/test.yml index 94eb8d998..4055ea615 100644 --- a/tests/integration/targets/lookup_rulesets/tasks/test.yml +++ b/tests/integration/targets/lookup_rulesets/tasks/test.yml @@ -90,6 +90,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ checkmk_ruleset_regexes }}" + when: outer_item.edition == "stable_cee" - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rulesets." ansible.builtin.debug: @@ -98,3 +99,4 @@ rulesets: "{{ lookup('checkmk.general.rulesets', regex='file', rulesets_used=False, rulesets_deprecated=False) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_version/tasks/test.yml b/tests/integration/targets/lookup_version/tasks/test.yml index 63142308f..49dfb9ae7 100644 --- a/tests/integration/targets/lookup_version/tasks/test.yml +++ b/tests/integration/targets/lookup_version/tasks/test.yml @@ -24,3 +24,4 @@ version: "{{ lookup('checkmk.general.version') }}" delegate_to: localhost register: looked_up_version + when: outer_item.edition == "stable_cee" From 28ac0dc3fd9e6ac2e888feb79902a64831919186 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Fri, 16 Feb 2024 11:09:18 -0500 Subject: [PATCH 8/8] Document known issues and limitations. --- changelogs/fragments/lookups.yml | 7 ++++++- plugins/lookup/bakery.py | 2 ++ plugins/lookup/folder.py | 2 ++ plugins/lookup/folders.py | 2 ++ plugins/lookup/host.py | 2 ++ plugins/lookup/hosts.py | 2 ++ plugins/lookup/rule.py | 2 ++ plugins/lookup/rules.py | 2 ++ plugins/lookup/ruleset.py | 2 ++ plugins/lookup/rulesets.py | 2 ++ plugins/lookup/version.py | 2 ++ 11 files changed, 26 insertions(+), 1 deletion(-) diff --git a/changelogs/fragments/lookups.yml b/changelogs/fragments/lookups.yml index c9c3e4d80..1c8d0172f 100644 --- a/changelogs/fragments/lookups.yml +++ b/changelogs/fragments/lookups.yml @@ -1,4 +1,9 @@ minor_changes: - Lookup modules - Enable usage of ini files, environment and inventory variables - to configure basic settings for the lookup plugins, like the server_url and site + to configure basic settings for the lookup plugins, like e.g., the server_url or site alongside the authentication options. Refer to the module documentation for details. + +known_issues: + - Lookup modules - When using inventory variables to configure e.g., the server_url, + it is not possible to assign other variables to these variables. + This is a limitation of Ansble itself. diff --git a/plugins/lookup/bakery.py b/plugins/lookup/bakery.py index 712006101..6308bb351 100644 --- a/plugins/lookup/bakery.py +++ b/plugins/lookup/bakery.py @@ -79,6 +79,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/folder.py b/plugins/lookup/folder.py index bf00737f6..a2b5db1cd 100644 --- a/plugins/lookup/folder.py +++ b/plugins/lookup/folder.py @@ -83,6 +83,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/folders.py b/plugins/lookup/folders.py index 03d260728..4a18d7aaf 100644 --- a/plugins/lookup/folders.py +++ b/plugins/lookup/folders.py @@ -96,6 +96,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/host.py b/plugins/lookup/host.py index 6db71d786..af9a191fc 100644 --- a/plugins/lookup/host.py +++ b/plugins/lookup/host.py @@ -89,6 +89,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/hosts.py b/plugins/lookup/hosts.py index d2ac43106..50756e84a 100644 --- a/plugins/lookup/hosts.py +++ b/plugins/lookup/hosts.py @@ -86,6 +86,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/rule.py b/plugins/lookup/rule.py index e6c0447ff..105f39034 100644 --- a/plugins/lookup/rule.py +++ b/plugins/lookup/rule.py @@ -83,6 +83,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/rules.py b/plugins/lookup/rules.py index 9d0620b2f..c36349ea7 100644 --- a/plugins/lookup/rules.py +++ b/plugins/lookup/rules.py @@ -93,6 +93,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/ruleset.py b/plugins/lookup/ruleset.py index af23d7dd8..790fd7db9 100644 --- a/plugins/lookup/ruleset.py +++ b/plugins/lookup/ruleset.py @@ -83,6 +83,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/rulesets.py b/plugins/lookup/rulesets.py index fb50b21f2..10acc985d 100644 --- a/plugins/lookup/rulesets.py +++ b/plugins/lookup/rulesets.py @@ -102,6 +102,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """ diff --git a/plugins/lookup/version.py b/plugins/lookup/version.py index e603819a6..389876af2 100644 --- a/plugins/lookup/version.py +++ b/plugins/lookup/version.py @@ -79,6 +79,8 @@ If you need to use different permissions, you must change the command or run Ansible as another user. - Alternatively, you can use a shell/command task that runs against localhost and registers the result. - The directory of the play is used as the current working directory. + - It is B(NOT) possible to assign other variables to the variables mentioned in the C(vars) section! + This is a limitation of Ansible itself. """ EXAMPLES = """