paloaltonetworks.panos.panos_config_element module – Modifies an element in the PAN-OS configuration.
Note
This module is part of the paloaltonetworks.panos collection (version 2.21.2).
To install it, use: ansible-galaxy collection install paloaltonetworks.panos
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: paloaltonetworks.panos.panos_config_element
.
New in paloaltonetworks.panos 2.7.0
Synopsis
This module allows the user to modify an element in the PAN-OS configuration by specifying an element and its location in the configuration (xpath).
Requirements
The below requirements are needed on the host that executes this module.
pan-os-python
Parameters
Parameter |
Comments |
---|---|
If **true**, replace any existing configuration at the specified location with the contents of *element*. If **false**, merge the contents of *element* with any existing configuration at the specified location. Choices: |
|
The element, in XML format. |
|
A dict object containing connection details. |
|
The API key to use instead of generating it using username / password. |
|
The IP address or hostname of the PAN-OS device being configured. |
|
The password to use for authentication. This is ignored if api_key is specified. |
|
The port number to connect to the PAN-OS device on. Default: :ansible-option-default:`443` |
|
The serial number of a firewall to use for targeted commands. If ip_address is not a Panorama PAN-OS device, then this param is ignored. |
|
The username to use for authentication. This is ignored if api_key is specified. Default: :ansible-option-default:`"admin"` |
|
The state. Choices: |
|
Location of the specified element in the XML configuration. |
Notes
Note
Checkmode is supported.
Panorama is supported.
Examples
- name: Configure login banner
vars:
banner_text: 'Authorized Personnel Only!'
paloaltonetworks.panos.panos_config_element:
provider: '{{ provider }}'
xpath: '/config/devices/entry[@name="localhost.localdomain"]/deviceconfig/system'
element: '<login-banner>{{ banner_text }}</login-banner>'
- name: Create address object
paloaltonetworks.panos.panos_config_element:
provider: '{{ provider }}'
xpath: "/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address"
element: |
<entry name="Test-One">
<ip-netmask>1.1.1.1</ip-netmask>
</entry>
- name: Delete address object 'Test-One'
paloaltonetworks.panos.panos_config_element:
provider: '{{ provider }}'
xpath: "/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address/entry[@name='Test-One']"
state: 'absent'
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A boolean value indicating if the task had to make changes. Returned: always |
|
Information about the differences between the previous and current state. Contains ‘before’ and ‘after’ keys. Returned: success, when needed |
|
A string with an error message, if any. Returned: failure, always |