-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search option for device group, address group #537
Comments
Hi @asgr8e ! You would have two main options:
- name: Get device group info
paloaltonetworks.panos.panos_device_group:
provider: "{{ panorama_provider }}"
name: 'test_device_group'
state: 'gathered'
register: device_group_info
- name: show list of all device groups
paloaltonetworks.panos.panos_op:
provider: "{{ panorama_provider }}"
cmd: "show devicegroups"
register: devicegroup_status
- name: Parse devicegroup list
community.general.xml:
xmlstring: "{{ devicegroup_status.stdout_xml}}"
xpath: "/response/result/devicegroups/entry[@name='test_device_group']"
content: attribute
ignore_errors: true
register: parsed_software_xml
- name: Print parsed xml
ansible.builtin.debug:
var: parsed_software_xml
- name: Assert that there is a device group with that name
ansible.builtin.assert:
that:
- parsed_software_xml.failed == false
- parsed_software_xml.matches | length > 0
fail_msg: "Device group does not exist"
success_msg: "Device group exists" I hope that helps! |
@asgr8e - did you manage to test out the above solution? Unless we receive a reply soon - we will proceed to close the issue. |
fatal: [192.168.1.249]: FAILED! => { PLAY RECAP **************************************************************************************************************************************************************************************************** First solution is giving this error |
w list of all device groups] ************************************************************************************************************************************************************************* TASK [Parse devicegroup list] ********************************************************************************************************************************************************************************* TASK [Print parsed xml] *************************************************************************************************************************************************************************************** TASK [Assert that there is a device group with that name] ***************************************************************************************************************************************************** second one gives this error |
This worked for me |
Is there any way I can List down available device groups or check if specific device group is present or not, and if found how to perform the same search for checking address groups, if they exist or not?
The text was updated successfully, but these errors were encountered: