ansible.netcommon.network_resource (3.1.3) — module

Manage resource modules

| "added in version" 2.4.0 of ansible.netcommon"

Authors: Ganesh B. Nalawade (@ganeshrn)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install ansible.netcommon:==3.1.3


Add to requirements.yml

  collections:
    - name: ansible.netcommon
      version: 3.1.3

Description

Get list of available resource modules for given os name

Retrieve given resource module configuration facts

Push given resource module configuration

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: get list of resource modules for given network_os
  ansible.netcommon.network_resource:
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: fetch acl config for
  ansible.netcommon.network_resource:
    os_name: cisco.ios.ios
    name: acls
    state: gathered
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: manage acl config for cisco.ios.ios network os.
  ansible.netcommon.network_resource:
    name: acls
    config:
      - afi: ipv4
        acls:
          - name: test_acl
            acl_type: extended
            aces:
              - grant: deny
                protocol_options:
                  tcp:
                    fin: true
                source:
                  address: 192.0.2.0
                  wildcard_bits: 0.0.0.255
                destination:
                  address: 192.0.3.0
                  wildcard_bits: 0.0.0.255
                  port_protocol:
                    eq: www
                option:
                  traceroute: true
                ttl:
                  eq: 10
    state: merged

Inputs

    
name:
    description:
    - The name of the resource module to manage.
    - The resource module should be supported for given I(os_name), if not supported it
      will result in error.
    type: str

state:
    description:
    - The state the configuration should be left in.
    - For supported values refer the individual resource module platform documentation.

config:
    description:
    - The resource module configuration. For details on the type and structure of this
      option refer the individual resource module platform documentation.
    type: raw

os_name:
    description:
    - The name of the os to manage the resource modules.
    - The name should be fully qualified collection name format, that is I(<namespace>.<collection-name>.<plugin-name>).
    - If value of this option is not set the os value will be read from I(ansible_network_os)
      variable.
    - If value of both I(os_name) and I(ansible_network_os) is not set it will result
      in error.
    type: str

running_config:
    description:
    - This option is used only with state I(parsed).
    - The value of this option should be the output received from the host device by executing
      the cli command to get the resource configuration on host.
    - The state I(parsed) reads the configuration from C(running_config) option and transforms
      it into Ansible structured data as per the resource module's argspec and the value
      is then returned in the I(parsed) key within the result.

Outputs

after:
  description: The configuration as structured data after module completion.
  returned: when changed and  when I(state) and/or I(config) option is set
  sample: The configuration returned will always be in the same format of the parameters
    above.
  type: list
before:
  description: The configuration as structured data prior to module invocation.
  returned: When I(state) and/or I(config) option is set
  sample: The configuration returned will always be in the same format of the parameters
    above.
  type: list
commands:
  description: The set of commands pushed to the remote device
  returned: When I(state) and/or I(config) option is set
  sample:
  - ip access-list extended 110
  type: list
modules:
  description: List of resource modules supported for given OS.
  returned: When only I(os_name) or I(ansible_network_os) is set
  sample:
  - acl_interfaces
  - acls
  - bgp_global
  type: list