<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Gather info with panos_security_rule in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/517710#M3203</link>
    <description>&lt;P&gt;The Ansible collection was just updated (v2.11.0) with a new parameter, &lt;CODE&gt;gathered_filter&lt;/CODE&gt;.&amp;nbsp; You can use this parameter to finally fully replace the panos_security_rule_facts module.&amp;nbsp; If you want everything, then it's as simple as doing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  - name: Get all security rules
    panos_security_rule:
      provider: '{{ provider_dict }}'
      state: 'gathered'
      gathered_filter: '*'
    register: ans

  - debug:
      msg: '{{ ans }}'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Oct 2022 20:03:00 GMT</pubDate>
    <dc:creator>gfreeman</dc:creator>
    <dc:date>2022-10-19T20:03:00Z</dc:date>
    <item>
      <title>Gather info with panos_security_rule</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/516742#M3193</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;I dont fully understand how to use the panos_security_rule module to find rule panos_security_rule to find rules since &lt;A href="https://github.com/PaloAltoNetworks/pan-os-ansible/blob/develop/plugins/modules/panos_security_rule_facts.py" target="_blank"&gt;https://github.com/PaloAltoNetworks/pan-os-ansible/blob/develop/plugins/modules/panos_security_rule_facts.py&lt;/A&gt; seems to be deprecated.&lt;BR /&gt;What i do want is to get all the defined rules in the firewall.&lt;/P&gt;&lt;P&gt;My supersimple playbook looks like this:&lt;/P&gt;&lt;P&gt;--&lt;BR /&gt;- name: Network Playbook&lt;BR /&gt;hosts: all&lt;BR /&gt;connection: local&lt;BR /&gt;gather_facts: false&lt;/P&gt;&lt;P&gt;vars:&lt;BR /&gt;sec_rules:&lt;BR /&gt;ip_address: 1.1.1.1&lt;BR /&gt;vars_prompt:&lt;/P&gt;&lt;P&gt;- name: password&lt;BR /&gt;prompt: password&lt;BR /&gt;- name: username&lt;BR /&gt;prompt: username&lt;BR /&gt;private: no&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;collections:&lt;BR /&gt;- paloaltonetworks.panos&lt;/P&gt;&lt;P&gt;tasks:&lt;BR /&gt;- name: Get all rules&lt;BR /&gt;panos_security_rule:&lt;BR /&gt;ip_address: " {{ ip_address }} "&lt;BR /&gt;username: " {{ username }} "&lt;BR /&gt;password: " {{ password }} "&lt;BR /&gt;rulebase: rulebase&lt;BR /&gt;state: 'gathered'&lt;BR /&gt;register: sec_rules&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- debug:&lt;BR /&gt;msg: '{{ sec_rules }}'&lt;/P&gt;&lt;P&gt;I get this output.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ansible-playbook [core 2.12.3]&lt;BR /&gt;config file = None&lt;BR /&gt;configured module search path = ['/home/labb/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']&lt;BR /&gt;ansible python module location = /home/labb/.local/lib/python3.9/site-packages/ansible&lt;BR /&gt;ansible collection location = /home/labb/.ansible/collections:/usr/share/ansible/collections&lt;BR /&gt;executable location = /home/labb/.local/bin/ansible-playbook&lt;BR /&gt;python version = 3.9.10 (main, Mar 16 2022, 15:24:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]&lt;BR /&gt;jinja version = 3.0.3&lt;BR /&gt;libyaml = True&lt;BR /&gt;No config file found; using defaults&lt;BR /&gt;host_list declined parsing /ansible/ansible/fwtest as it did not pass its verify_file() method&lt;BR /&gt;script declined parsing /ansible/ansible/fwtest as it did not pass its verify_file() method&lt;BR /&gt;auto declined parsing /ansible/ansible/fwtest as it did not pass its verify_file() method&lt;BR /&gt;[WARNING]: While constructing a mapping from /ansible/ansible/fwtest, line 4, column 5, found a duplicate dict key (ansible_connection). Using last defined value only.&lt;BR /&gt;Parsed /ansible/ansible/fwtest inventory source with yaml plugin&lt;BR /&gt;Skipping callback 'default', as we already have a stdout callback.&lt;BR /&gt;Skipping callback 'minimal', as we already have a stdout callback.&lt;BR /&gt;Skipping callback 'oneline', as we already have a stdout callback.&lt;/P&gt;&lt;P&gt;PLAYBOOK: palo.yaml ******************************************************************************************************************************************************&lt;BR /&gt;1 plays in palo.yaml&lt;BR /&gt;password:&lt;BR /&gt;username: alo&lt;/P&gt;&lt;P&gt;PLAY [Network Playbook] **************************************************************************************************************************************************&lt;BR /&gt;META: ran handlers&lt;/P&gt;&lt;P&gt;TASK [Get all rules] *****************************************************************************************************************************************************&lt;BR /&gt;task path: /ansibles/FW/palo.yaml:23&lt;BR /&gt;&amp;lt;1.1.1.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: labb&lt;BR /&gt;&amp;lt;1.1.1.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /home/labb/.ansible/tmp/ansible-local-9234529bmja22 `"&amp;amp;&amp;amp; mkdir "` echo /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340 `" &amp;amp;&amp;amp; echo ansible-tmp-1664879620.1387732-92355-183172280362340="` echo /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340 `" ) &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;Using module file /home/labb/.ansible/collections/ansible_collections/paloaltonetworks/panos/plugins/modules/panos_security_rule.py&lt;BR /&gt;&amp;lt;1.1.1.1&amp;gt; PUT /home/labb/.ansible/tmp/ansible-local-9234529bmja22/tmp80mh80tb TO /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340/AnsiballZ_panos_security_rule.py&lt;BR /&gt;&amp;lt;1.1.1.1&amp;gt; EXEC /bin/sh -c 'chmod u+x /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340/ /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340/AnsiballZ_panos_security_rule.py &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;&amp;lt;1.1.1.1&amp;gt; EXEC /bin/sh -c '/usr/local/bin/python3.9 /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340/AnsiballZ_panos_security_rule.py &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;&amp;lt;1.1.1.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /home/labb/.ansible/tmp/ansible-local-9234529bmja22/ansible-tmp-1664879620.1387732-92355-183172280362340/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'&lt;BR /&gt;fatal: [1.1.1.1]: FAILED! =&amp;gt; {&lt;BR /&gt;"changed": false,&lt;BR /&gt;"invocation": {&lt;BR /&gt;"module_args": {&lt;BR /&gt;"action": "allow",&lt;BR /&gt;"antivirus": null,&lt;BR /&gt;"api_key": null,&lt;BR /&gt;"application": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"audit_comment": null,&lt;BR /&gt;"category": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"commit": null,&lt;BR /&gt;"data_filtering": null,&lt;BR /&gt;"description": null,&lt;BR /&gt;"destination_ip": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"destination_zone": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"device_group": "shared",&lt;BR /&gt;"devicegroup": null,&lt;BR /&gt;"disable_server_response_inspection": false,&lt;BR /&gt;"disabled": false,&lt;BR /&gt;"existing_rule": null,&lt;BR /&gt;"file_blocking": null,&lt;BR /&gt;"group_profile": null,&lt;BR /&gt;"group_tag": null,&lt;BR /&gt;"hip_profiles": null,&lt;BR /&gt;"icmp_unreachable": null,&lt;BR /&gt;"ip_address": " 1.1.1.1 ",&lt;BR /&gt;"location": null,&lt;BR /&gt;"log_end": true,&lt;BR /&gt;"log_setting": null,&lt;BR /&gt;"log_start": false,&lt;BR /&gt;"negate_destination": false,&lt;BR /&gt;"negate_source": false,&lt;BR /&gt;"negate_target": null,&lt;BR /&gt;"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",&lt;BR /&gt;"port": 443,&lt;BR /&gt;"provider": null,&lt;BR /&gt;"rule_name": null,&lt;BR /&gt;"rule_type": "universal",&lt;BR /&gt;"rulebase": "rulebase",&lt;BR /&gt;"schedule": null,&lt;BR /&gt;"service": [&lt;BR /&gt;"application-default"&lt;BR /&gt;],&lt;BR /&gt;"source_ip": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"source_user": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"source_zone": [&lt;BR /&gt;"any"&lt;BR /&gt;],&lt;BR /&gt;"spyware": null,&lt;BR /&gt;"state": "gathered",&lt;BR /&gt;"tag_name": null,&lt;BR /&gt;"target": null,&lt;BR /&gt;"url_filtering": null,&lt;BR /&gt;"username": " ansible ",&lt;BR /&gt;"uuid": null,&lt;BR /&gt;"vsys": "vsys1",&lt;BR /&gt;"vulnerability": null,&lt;BR /&gt;"wildfire_analysis": null&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"msg": "missing required arguments: rule_name"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;PLAY RECAP ***************************************************************************************************************************************************************&lt;BR /&gt;1.1.1.1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Im runing against a single device not panorama, if that matter?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 11:15:41 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/516742#M3193</guid>
      <dc:creator>zol123</dc:creator>
      <dc:date>2022-10-04T11:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Gather info with panos_security_rule</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/517330#M3200</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/241984"&gt;@zol123&lt;/a&gt;, the &lt;FONT face="courier new,courier"&gt;panos_security_rule_facts&lt;/FONT&gt;&amp;nbsp;module still works, it is not fully deprecated, so at this time I would recommend continuing to utilise it for this use case&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 16:29:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/517330#M3200</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2022-10-10T16:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Gather info with panos_security_rule</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/517710#M3203</link>
      <description>&lt;P&gt;The Ansible collection was just updated (v2.11.0) with a new parameter, &lt;CODE&gt;gathered_filter&lt;/CODE&gt;.&amp;nbsp; You can use this parameter to finally fully replace the panos_security_rule_facts module.&amp;nbsp; If you want everything, then it's as simple as doing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  - name: Get all security rules
    panos_security_rule:
      provider: '{{ provider_dict }}'
      state: 'gathered'
      gathered_filter: '*'
    register: ans

  - debug:
      msg: '{{ ans }}'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 20:03:00 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/517710#M3203</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2022-10-19T20:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Gather info with panos_security_rule</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/518892#M3215</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 10:19:52 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/gather-info-with-panos-security-rule/m-p/518892#M3215</guid>
      <dc:creator>zol123</dc:creator>
      <dc:date>2022-10-24T10:19:52Z</dc:date>
    </item>
  </channel>
</rss>

