paloaltonetworks.panos.panos_op (2.19.1) — module

execute arbitrary OP commands on PANW devices (e.g. show interface all)

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

Authors: Ivan Bojer (@ivanbojer), 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 will allow user to pass and execute any supported OP command on the PANW device.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: show list of all interfaces
  paloaltonetworks.panos.panos_op:
    provider: '{{ provider }}'
    cmd: 'show interfaces all'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: show system info
  paloaltonetworks.panos.panos_op:
    provider: '{{ provider }}'
    cmd: 'show system info'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: show system info as XML command
  paloaltonetworks.panos.panos_op:
    provider: '{{ provider }}'
    cmd: '<show><system><info/></system></show>'
    cmd_is_xml: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: set serial number with error ignore
  paloaltonetworks.panos.panos_op:
    provider: '{{ provider }}'
    cmd: 'set serial-number "123456"'
    ignore_disconnect: true

Inputs

    
cmd:
    description:
    - The OP command to be performed.
    required: true
    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

vsys:
    default: vsys1
    description:
    - The vsys target where the OP command will be performed.
    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

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

cmd_is_xml:
    default: false
    description:
    - The cmd is already given in XML format, so don't convert it.
    type: bool

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

ignore_disconnect:
    description:
    - Some op commands disconnect the client before returning a response.
    - Enable this to prevent this module from erroring out if the command could cause
      this.
    - If running such a command, you can use M(paloaltonetworks.panos.panos_check) to
      wait for PAN-OS to be accessible.
    type: bool

Outputs

disconnected:
  description: If a disconnect was ignored or not.
  returned: success
  sample: true
  type: bool
stdout:
  description: output of the given OP command as JSON formatted string
  returned: success
  sample: '{system: {app-release-date: 2017/05/01  15:09:12}}'
  type: str
stdout_xml:
  description: output of the given OP command as an XML formatted string
  returned: success
  sample: <response status=success><result><system><hostname>fw2</hostname>
  type: str