Back to Ansible Reference

$ ansible-doc -t module cisco.sccfm.execute_ftd_cli

> MODULE cisco.sccfm.execute_ftd_cli (sccfm-ansible/plugins/modules/execute_ftd_cli.py)

  Execute a show command on one or more cdFMC-managed FTD devices.
  Devices can be selected by a Lucene query or by specifying a list of
  UIDs.
  Only show commands are supported (e.g. show version, show failover,
  show route).
  The command runs via the cdFMC bulk command proxy endpoint.
  See
  https://developer.cisco.com/docs/cisco-security-cloud-control-firewall-manager/create-bulk-command/
  for endpoint documentation.

OPTIONS (= indicates it is required):

- api_token  API token for SCCFM.
        set_via:
          env:
          - name: SCCFM_API_TOKEN
        default: null
        no_log: true
        type: str

- command  The show command to execute on the FTD devices.
            Only show commands are supported (e.g. show version, show
            failover).
            Mutually exclusive with `commands'.
        default: null
        type: str

- commands  Single-item list containing the show command to execute
             on the FTD devices.
             Mutually exclusive with `command'. FTD bulk execution
             supports one command per request.
        default: null
        elements: str
        type: list

- limit   Maximum number of devices to return when using `query'.
           Ignored when using `uids'.
        default: 50
        type: int

- offset  Pagination offset when using `query'.
           Ignored when using `uids'.
        default: 0
        type: int

- query   Lucene query to filter cdFMC-managed FTD devices.
           Mutually exclusive with `uids'.
           The query is automatically combined with
           `deviceType:CDFMC_MANAGED_FTD'.
        default: null
        type: str

- region  SCCFM region (int, us, eu, apj, au, uae, in, or ci).
        set_via:
          env:
          - name: SCCFM_REGION
        default: null
        type: str

- uids    List of device UIDs to execute the command on.
           Mutually exclusive with `query'.
        default: null
        elements: str
        type: list

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Execute a show command on devices matching a query
- name: Show failover on all production FTDs
  cisco.sccfm.execute_ftd_cli:
    query: "name:prod-* AND connectivityState:ONLINE"
    command: "show failover"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"
  register: cli_results

# Example 2: Execute a command on specific devices by UID
- name: Show version on specific FTDs
  cisco.sccfm.execute_ftd_cli:
    uids:
      - "12345678-1234-1234-1234-123456789abc"
      - "87654321-4321-4321-4321-cba987654321"
    command: "show version"
  register: cli_results

# Example 3: Using module_defaults (recommended)
- name: Execute show commands on FTDs
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ sccfm_api_token }}"
  tasks:
    - name: Show route on branch FTDs
      cisco.sccfm.execute_ftd_cli:
        query: "name:branch-* AND connectivityState:ONLINE"
        command: "show route"

RETURN VALUES:

- command  The show command that was executed.
        returned: success
        type: str

- commands  Single-item command list that was executed.
        elements: str
        returned: success
        type: list

- device_count  Number of target devices matched by the module.
        returned: success
        type: int

- results  List of CLI execution results per device.
        elements: dict
        returned: success
        type: list
        contains:

        - device_name  The device name.
          type: str

        - device_uuid  The FMC device record UUID.
          type: str

        - error_msg  Error message if execution failed (null if
                      successful).
          type: str

        - is_error  Whether execution failed on this device.
          type: bool

        - response  The CLI command output (null if error).
          type: str