Skip to content

Commit

Permalink
Folder lookup module - Update and improve the examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgetwan committed May 29, 2024
1 parent 74b3d4b commit 1c06934
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/lookup_folder_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
breaking_changes:
- Folder lookup module - Update and improve the examples.
30 changes: 15 additions & 15 deletions plugins/lookup/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,23 @@
"""

EXAMPLES = """
- name: Get the attributes of folder /tests
- name: Get the attributes of folders /tests and /snmp
ansible.builtin.debug:
msg: "Attributes of folder /network: {{ attributes }}"
vars:
attributes: "{{
lookup('checkmk.general.folder',
'~tests',
server_url=my_server_url,
site=mysite,
automation_user=myuser,
automation_secret=mysecret,
validate_certs=False
)
}}"
msg: "Extended attributes of folder /network: {{ attributes.extensions }}"
loop: "{{
lookup('checkmk.general.folder',
'~tests', '~snmp',
server_url=my_server_url,
site=mysite,
automation_user=myuser,
automation_secret=mysecret,
validate_certs=False
)
}}"
- name: "Use variables outside the module call."
ansible.builtin.debug:
msg: "Attributes of folder /network: {{ attributes }}"
msg: "Extended attributes of folder /network: {{ attributes.extensions }}"
vars:
ansible_lookup_checkmk_server_url: "http://myserver/"
ansible_lookup_checkmk_site: "mysite"
Expand All @@ -118,7 +117,8 @@
RETURN = """
_list:
description:
- A list of dicts of attributes of the folder(s)
- A dict of attributes of the folder if you query a single folder
- A list of dicts of attributes of the folders if you query multiple folders
type: list
elements: str
"""
Expand Down

0 comments on commit 1c06934

Please sign in to comment.