Skip to content

Commit

Permalink
Merge pull request #454 from Checkmk/feature/lookup-hosts
Browse files Browse the repository at this point in the history
Fix yamllint issues.
  • Loading branch information
robin-checkmk committed Oct 24, 2023
2 parents 1848d8c + 6bb0e1b commit d5b00d4
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions playbooks/demo/lookup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,60 @@
server_url + '/' + site,
validate_certs=False,
automation_user=automation_user,
automation_secret=automation_secret
)}}"

automation_secret=automation_secret)
}}"
delegate_to: localhost
run_once: 'true'
run_once: true # noqa run-once[task]

- name: "Get all subfolders of the main folder recursively"
ansible.builtin.debug:
msg: "Folder tree: {{ item.id }}"
loop: "{{
lookup('checkmk.general.all_folders',
lookup('checkmk.general.all_folders',
'~',
show_hosts=False,
recursive=True,
site_url=server_url + '/' + site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
)
validate_certs=False)
}}"
loop_control:
label: "{{ item.id }}"

label: "{{ item.id }}"
delegate_to: localhost
run_once: true # noqa run-once[task]

- name: "Get all hosts of the folder /test recursively"
ansible.builtin.debug:
msg: "Host found in {{ item.0.id }}: {{ item.1.title }}"
vars:
looping: "{{
lookup('checkmk.general.all_folders',
lookup('checkmk.general.all_folders',
'~tests',
show_hosts=True,
recursive=True,
site_url=server_url + '/' + site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
)
validate_certs=False)
}}"
loop: "{{ looping|subelements('members.hosts.value') }}"
loop: "{{ looping | subelements('members.hosts.value') }}"
loop_control:
label: "{{ item.0.id }}"
label: "{{ item.0.id }}"
delegate_to: localhost
run_once: true # noqa run-once[task]

- name: "Get the attributes of folder /tests"
ansible.builtin.debug:
msg: "Attributes of folder /network: {{ attributes }}"
vars:
attributes: "{{
lookup('checkmk.general.folder',
lookup('checkmk.general.folder',
'~tests',
site_url=server_url + '/' + site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
)
validate_certs=False)
}}"
delegate_to: localhost
run_once: true # noqa run-once[task]

0 comments on commit d5b00d4

Please sign in to comment.