Skip to content

Commit 86f4a0c

Browse files
Merge pull request #607 from Checkmk/fix/lookup_folder_examples
Folder lookup module - Update and improve the examples.
2 parents 81ff91f + 5cd290f commit 86f4a0c

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
breaking_changes:
22
- Folder lookup module - Return the complete folder information, not only the extensions.
3-
Refer to the module documentation for more details.
3+
To adjust your playbooks, you have to use "{{ my_lookup_result.extensions }}" instead of
4+
"{{ my_lookup_result }}".

plugins/lookup/folder.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,23 @@
8888
"""
8989

9090
EXAMPLES = """
91-
- name: Get the attributes of folder /tests
91+
- name: Get the attributes of folders /tests and /snmp
9292
ansible.builtin.debug:
93-
msg: "Attributes of folder /network: {{ attributes }}"
94-
vars:
95-
attributes: "{{
96-
lookup('checkmk.general.folder',
97-
'~tests',
98-
server_url=my_server_url,
99-
site=mysite,
100-
automation_user=myuser,
101-
automation_secret=mysecret,
102-
validate_certs=False
103-
)
104-
}}"
93+
msg: "Extended attributes of folder /network: {{ attributes.extensions }}"
94+
loop: "{{
95+
lookup('checkmk.general.folder',
96+
'~tests', '~snmp',
97+
server_url=my_server_url,
98+
site=mysite,
99+
automation_user=myuser,
100+
automation_secret=mysecret,
101+
validate_certs=False
102+
)
103+
}}"
105104
106105
- name: "Use variables outside the module call."
107106
ansible.builtin.debug:
108-
msg: "Attributes of folder /network: {{ attributes }}"
107+
msg: "Extended attributes of folder /network: {{ attributes.extensions }}"
109108
vars:
110109
ansible_lookup_checkmk_server_url: "http://myserver/"
111110
ansible_lookup_checkmk_site: "mysite"
@@ -118,7 +117,8 @@
118117
RETURN = """
119118
_list:
120119
description:
121-
- A list of dicts of attributes of the folder(s)
120+
- A dict of attributes of the folder if you query a single folder
121+
- A list of dicts of attributes of the folders if you query multiple folders
122122
type: list
123123
elements: str
124124
"""

0 commit comments

Comments
 (0)