paloaltonetworks.panos.panos_type_cmd (2.19.1) — module

Execute arbitrary TYPE commands on PAN-OS

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

Authors: Garfield Lee Freeman (@shinmog)

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 you to execute arbitrary TYPE commands on PAN-OS.

This module does not provide guards of any sort, so USE AT YOUR OWN RISK.

Refer to the PAN-OS and Panorama API guide for more info.

https://docs.paloaltonetworks.com/pan-os.html


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create an address object using set.
  paloaltonetworks.panos.panos_type_cmd:
    provider: '{{ provider }}'
    xpath: |
      /config/devices/entry[@name='localhost.localdomain']
      /vsys/entry[@name='vsys1']
      /address
    element: |
      <entry name="sales-block">
        <ip-netmask>192.168.55.0/24</ip-netmask>
        <description>Address CIDR for sales org</description>
      </entry>
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Then rename it.
  paloaltonetworks.panos.panos_type_cmd:
    provider: '{{ provider }}'
    cmd: 'rename'
    xpath: |
      /config/devices/entry[@name='localhost.localdomain']
      /vsys/entry[@name='vsys1']
      /address/entry[@name='sales-block']
    new_name: 'dmz-block'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Show the address object.
  paloaltonetworks.panos.panos_type_cmd:
    provider: '{{ provider }}'
    cmd: 'show'
    xpath: |
      /config/devices/entry[@name='localhost.localdomain']
      /vsys/entry[@name='vsys1']
      /address/entry[@name='dmz-block']

Inputs

    
cmd:
    choices:
    - show
    - get
    - delete
    - set
    - edit
    - move
    - rename
    - clone
    - override
    default: set
    description:
    - The command to run.
    type: str

dst:
    description:
    - Used in I(cmd=move).
    - The reference object.
    type: str

port:
    default: 443
    description:
    - B(Deprecated)
    - Use I(provider) to specify PAN-OS connectivity instead.
    - HORIZONTALLINE
    - The port number to connect to the PAN-OS device on.
    type: int

where:
    description:
    - Used in I(cmd=move).
    - The movement keyword.
    type: str

xpath:
    description:
    - The XPATH.
    - All newlines are removed from the XPATH to allow for shorter lines.
    required: true
    type: str

api_key:
    description:
    - B(Deprecated)
    - Use I(provider) to specify PAN-OS connectivity instead.
    - HORIZONTALLINE
    - The API key to use instead of generating it using I(username) / I(password).
    type: str

element:
    description:
    - Used in I(cmd=set), I(cmd=edit), and I(cmd=override).
    - The element payload.
    type: str

extra_qs:
    description:
    - A dict of extra params to pass in.
    type: dict

new_name:
    description:
    - Used in I(cmd=rename) and I(cmd=clone).
    - The new name.
    type: str

password:
    description:
    - B(Deprecated)
    - Use I(provider) to specify PAN-OS connectivity instead.
    - HORIZONTALLINE
    - The password to use for authentication.  This is ignored if I(api_key) is specified.
    type: str

provider:
    description:
    - A dict object containing connection details.
    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.
        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

username:
    default: admin
    description:
    - B(Deprecated)
    - Use I(provider) to specify PAN-OS connectivity instead.
    - HORIZONTALLINE
    - The username to use for authentication.  This is ignored if I(api_key) is specified.
    type: str

ip_address:
    description:
    - B(Deprecated)
    - Use I(provider) to specify PAN-OS connectivity instead.
    - HORIZONTALLINE
    - The IP address or hostname of the PAN-OS device being configured.
    type: str

xpath_from:
    description:
    - Used in I(cmd=clone).
    - The from xpath.
    type: str

Outputs

stdout:
  description: output (if any) of the given API command as JSON formatted string
  returned: success
  sample: '{entry: {@name: dmz-block, ip-netmask: 192.168.55.0/24, description: Address
    CIDR for sales org}}'
  type: str
stdout_xml:
  description: output of the given API command as an XML formatted string
  returned: success
  sample: <entry name=dmz-block><ip-netmask>192.168.55.0/24</ip-netmask>...</entry>
  type: str