<?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 Deleting interface + dhcp relay  using ansible in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/496813#M3037</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Versions in use:&lt;/P&gt;&lt;P&gt;ansible 2.9.22&lt;BR /&gt;pan-python==0.19.0&lt;BR /&gt;pandevice==0.14.0&lt;BR /&gt;panos firewall 9.1.10&lt;/P&gt;&lt;P&gt;I have created a playbook that adds a DHCP relay element and now i need to do the delete the DHCP relay and haven't found the way.&lt;BR /&gt;This is the playbook for adding one:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;---
- name: DHCP
hosts: localhost
connection: local
vars:
- ansible_python_interpreter: /usr/bin/env python3
roles:
- role: PaloAltoNetworks.paloaltonetworks
gather_facts: False
tasks:
- name: Grab the credentials
include_vars: 'firewall-secrets.yml'
- name: Create DHCP relay on interface
panos_type_cmd:
ip_address: '{{ ip_address }}'
username: '{{ username }}'
password: '{{ password }}'
cmd: "set"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/dhcp/interface/entry[@name='a5.22']/relay"
element: "&amp;lt;ip&amp;gt;&amp;lt;server&amp;gt;&amp;lt;member&amp;gt;10.x.x.x1&amp;lt;/member&amp;gt;&amp;lt;/server&amp;gt;&amp;lt;enabled&amp;gt;yes&amp;lt;/enabled&amp;gt;&amp;lt;/ip&amp;gt;&amp;lt;ip&amp;gt;&amp;lt;server&amp;gt;&amp;lt;member&amp;gt;10.x.x.x2&amp;lt;/member&amp;gt;&amp;lt;/server&amp;gt;&amp;lt;enabled&amp;gt;yes&amp;lt;/enabled&amp;gt;&amp;lt;/ip&amp;gt;"&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;When trying to delete i have used this:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;tasks:
- name: delete DHCP relay on interface
panos_type_cmd:
ip_address: '{{ ip_address }}'
username: '{{ username }}'
password: '{{ password }}'
cmd: "delete"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/dhcp/interface/entry[@name='a5.22']/relay"

&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Ansible verbose doesn't give any error,&lt;BR /&gt;Its only getting the firewall stuck(i cannot preform any commits until I delete the change) , The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;main task&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is to remove the interface "a5.22" using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;panos_l3_subinterface&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;module. but it doesn't give me to delete a device before I delete the relay.&lt;BR /&gt;there is no docs for this - does anyone know how?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 08:45:39 GMT</pubDate>
    <dc:creator>batchenr</dc:creator>
    <dc:date>2022-06-01T08:45:39Z</dc:date>
    <item>
      <title>Deleting interface + dhcp relay  using ansible</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/496813#M3037</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Versions in use:&lt;/P&gt;&lt;P&gt;ansible 2.9.22&lt;BR /&gt;pan-python==0.19.0&lt;BR /&gt;pandevice==0.14.0&lt;BR /&gt;panos firewall 9.1.10&lt;/P&gt;&lt;P&gt;I have created a playbook that adds a DHCP relay element and now i need to do the delete the DHCP relay and haven't found the way.&lt;BR /&gt;This is the playbook for adding one:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;---
- name: DHCP
hosts: localhost
connection: local
vars:
- ansible_python_interpreter: /usr/bin/env python3
roles:
- role: PaloAltoNetworks.paloaltonetworks
gather_facts: False
tasks:
- name: Grab the credentials
include_vars: 'firewall-secrets.yml'
- name: Create DHCP relay on interface
panos_type_cmd:
ip_address: '{{ ip_address }}'
username: '{{ username }}'
password: '{{ password }}'
cmd: "set"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/dhcp/interface/entry[@name='a5.22']/relay"
element: "&amp;lt;ip&amp;gt;&amp;lt;server&amp;gt;&amp;lt;member&amp;gt;10.x.x.x1&amp;lt;/member&amp;gt;&amp;lt;/server&amp;gt;&amp;lt;enabled&amp;gt;yes&amp;lt;/enabled&amp;gt;&amp;lt;/ip&amp;gt;&amp;lt;ip&amp;gt;&amp;lt;server&amp;gt;&amp;lt;member&amp;gt;10.x.x.x2&amp;lt;/member&amp;gt;&amp;lt;/server&amp;gt;&amp;lt;enabled&amp;gt;yes&amp;lt;/enabled&amp;gt;&amp;lt;/ip&amp;gt;"&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;When trying to delete i have used this:&lt;/P&gt;&lt;DIV class=""&gt;&lt;PRE&gt;tasks:
- name: delete DHCP relay on interface
panos_type_cmd:
ip_address: '{{ ip_address }}'
username: '{{ username }}'
password: '{{ password }}'
cmd: "delete"
xpath: "/config/devices/entry[@name='localhost.localdomain']/network/dhcp/interface/entry[@name='a5.22']/relay"

&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Ansible verbose doesn't give any error,&lt;BR /&gt;Its only getting the firewall stuck(i cannot preform any commits until I delete the change) , The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;main task&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is to remove the interface "a5.22" using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;panos_l3_subinterface&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;module. but it doesn't give me to delete a device before I delete the relay.&lt;BR /&gt;there is no docs for this - does anyone know how?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 08:45:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/496813#M3037</guid>
      <dc:creator>batchenr</dc:creator>
      <dc:date>2022-06-01T08:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting interface + dhcp relay  using ansible</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/503054#M3045</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;no it is not resolved if i figure this out ill post here&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:24:01 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/503054#M3045</guid>
      <dc:creator>batchenr</dc:creator>
      <dc:date>2022-06-13T10:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting interface + dhcp relay  using ansible</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/514584#M3133</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/215208"&gt;@batchenr&lt;/a&gt;, when adapted to my lab, the code you posted works ok for me:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    - name: Create DHCP relay on interface
      paloaltonetworks.panos.panos_type_cmd:
        provider: "{{ device }}"
        cmd: "set"
        xpath: "/config/devices/entry[@name='localhost.localdomain']/network/dhcp/interface/entry[@name='{{ interface }}']/relay"
        element: "&amp;lt;ip&amp;gt;&amp;lt;server&amp;gt;&amp;lt;member&amp;gt;{{ relay_ip_1 }}&amp;lt;/member&amp;gt;&amp;lt;member&amp;gt;{{ relay_ip_2 }}&amp;lt;/member&amp;gt;&amp;lt;/server&amp;gt;&amp;lt;enabled&amp;gt;yes&amp;lt;/enabled&amp;gt;&amp;lt;/ip&amp;gt;"

    - name: delete DHCP relay on interface
      paloaltonetworks.panos.panos_type_cmd:
        provider: "{{ device }}"
        cmd: "delete"
        xpath: "/config/devices/entry[@name='localhost.localdomain']/network/dhcp/interface/entry[@name='{{ interface }}']/relay"
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Sep 2022 13:29:08 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/deleting-interface-dhcp-relay-using-ansible/m-p/514584#M3133</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2022-09-12T13:29:08Z</dc:date>
    </item>
  </channel>
</rss>

