Back to Ansible Reference

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

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

  Retrieve the full details of an ASA access rule by UID.

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

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

= uid     Unique identifier (UID) of the access rule to retrieve.
        type: str

AUTHOR: Cisco SCCFM Team

EXAMPLES:
# Example 1: Get access rule details by UID
- name: Get access rule
  cisco.sccfm.get_access_rule:
    uid: "ac981dcd-9860-401e-a51d-c615c946b72f"
    region: "{{ sccfm_region }}"
    api_token: "{{ sccfm_api_token }}"
  register: result

- name: Show rule
  ansible.builtin.debug:
    var: result.access_rule

# Example 2: Using module_defaults
- name: Inspect access rule
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/cisco.sccfm.all:
      region: "{{ sccfm_region }}"
      api_token: "{{ lookup('env', 'SCCFM_API_TOKEN') }}"
  tasks:
    - name: Get access rule details
      cisco.sccfm.get_access_rule:
        uid: "{{ rule_uid }}"
      register: rule_result

    - name: Show rule action
      ansible.builtin.debug:
        msg: "Rule action: {{ rule_result.access_rule.rule_action }}"

RETURN VALUES:

- access_rule  Full details of the access rule.
        returned: success
        type: dict
        contains:

        - access_group_uid  UID of the associated access group.
          type: str

        - destination_network  Destination network details.
          type: dict

        - entity_uid  UID of the device or manager.
          type: str

        - index  Position in the rule list.
          type: int

        - remark  Rule description.
          type: str

        - rule_action  PERMIT or DENY.
          type: str

        - source_network  Source network details.
          type: dict

        - uid  Unique identifier of the access rule.
          type: str