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

edit

boolean

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:

element

string

The element, in XML format.

provider

dictionary / required

added in paloaltonetworks.panos 1.0.0

A dict object containing connection details.

api_key

string

The API key to use instead of generating it using username / password.

ip_address

string / required

The IP address or hostname of the PAN-OS device being configured.

password

string

The password to use for authentication. This is ignored if api_key is specified.

port

integer

The port number to connect to the PAN-OS device on.

Default: :ansible-option-default:`443`

serial_number

string

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.

username

string

The username to use for authentication. This is ignored if api_key is specified.

Default: :ansible-option-default:`"admin"`

state

string

xpath

string / required

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

changed

boolean

A boolean value indicating if the task had to make changes.

Returned: always

diff

dictionary

Information about the differences between the previous and current state.

Contains ‘before’ and ‘after’ keys.

Returned: success, when needed

msg

string

A string with an error message, if any.

Returned: failure, always

Authors

  • Michael Richardson (@mrichardson03)

  • Nathan Embery (@nembery)