- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
01-15-2019 10:09 AM
Looking at the module code, it looks like the disabled
flag is not currently exposed as a param for playbooks. Adding it shouldn't be that big a deal tho. If you are so inclined yourself, you could open a PR against the Ansible libraries yourself, otherwise just open a GitHub issue so we know we need to add this in:
01-16-2019 04:56 AM
Thanks, I'll open an issue at Git.
But in general, is there a way to disable tunnel via API? If there is, I'd like to test that, since couldn't find anything yet browsing palo api.
01-16-2019 08:48 AM
There is (replace foobar
below with the real name of your IPSec tunnel):
/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='foobar']/disabled
If you look at the code of the Ansible playbook, it's actually statically setting this param to False
when it performs the configuration. This is why I said that making this addition shouldn't be too hard.
01-17-2019 01:25 AM - edited 01-17-2019 01:57 AM
Thanks!
The reason I started this thread is that this one didn't work 🙂
tried from /api of the FW:
/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='xxx']/member[@name='disabled'
didn't work
/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='xxx']/disabled
Didn't work either
With all those I get
01-17-2019 04:28 AM
The xpath that I gave (and that the CLI is reporting) is the correct one. You just need to give all the rest of the usual PAN-OS XML API params and it will work:
type: config
action: set
xpath:
/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='xxx']/disabled
element: <disabled>yes</disabled>
key: <your api key here>
01-17-2019 04:32 AM
Ok, sorry, looking at what I said, I said setting it to False, which in the PAN-OS XML schema world means the word "yes" or "no", I should have been more clear about that.
01-17-2019 04:34 AM
Thanks, will give it a try and update!
01-17-2019 10:39 AM
One other thing I'll mention: I don't know how you're doing these API calls, but I think it's time to plug pandevice at this point.
Doing this with pandevice is pretty straight forward:
from pandevice.firewall import Firewall
from pandevice.network import IpsecTunnel
fw = Firewall('192.168.1.1', 'admin', 'admin')
tun = IpsecTunnel('foobar')
fw.add(tun)
tun.refresh()
tun.disabled = True
tun.apply()
fw.commit(sync=True)
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!