paloaltonetworks.panos.panos_config_element (2.19.1) — module

Modifies an element in the PAN-OS configuration.

| "added in version" 2.7.0 of paloaltonetworks.panos"

Authors: Michael Richardson (@mrichardson03), Nathan Embery (@nembery)

Install collection

Install with ansible-galaxy collection install paloaltonetworks.panos:==2.19.1


Add to requirements.yml

  collections:
    - name: paloaltonetworks.panos
      version: 2.19.1

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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>'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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>
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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'

Inputs

    
edit:
    default: false
    description:
    - 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.
    required: false
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - The state.
    type: str

xpath:
    description:
    - Location of the specified element in the XML configuration.
    required: true
    type: str

element:
    description:
    - The element, in XML format.
    type: str

provider:
    description:
    - A dict object containing connection details.
    required: true
    suboptions:
      api_key:
        description:
        - The API key to use instead of generating it using I(username) / I(password).
        type: str
      ip_address:
        description:
        - The IP address or hostname of the PAN-OS device being configured.
        required: true
        type: str
      password:
        description:
        - The password to use for authentication.  This is ignored if I(api_key) is specified.
        type: str
      port:
        default: 443
        description:
        - The port number to connect to the PAN-OS device on.
        type: int
      serial_number:
        description:
        - The serial number of a firewall to use for targeted commands. If I(ip_address)
          is not a Panorama PAN-OS device, then this param is ignored.
        type: str
      username:
        default: admin
        description:
        - The username to use for authentication.  This is ignored if I(api_key) is specified.
        type: str
    type: dict
    version_added: 1.0.0
    version_added_collection: paloaltonetworks.panos

Outputs

changed:
  description: A boolean value indicating if the task had to make changes.
  returned: always
  type: bool
diff:
  description:
  - Information about the differences between the previous and current state.
  - Contains 'before' and 'after' keys.
  elements: str
  returned: success, when needed
  type: dict
msg:
  description: A string with an error message, if any.
  returned: failure, always
  type: str