ansible.netcommon.network_resource module – Manage resource modules
Note
This module is part of the ansible.netcommon collection (version 6.1.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install ansible.netcommon
.
To use it in a playbook, specify: ansible.netcommon.network_resource
.
New in ansible.netcommon 2.4.0
Synopsis
Get list of available resource modules for given os name
Retrieve given resource module configuration facts
Push given resource module configuration
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
---|---|
The resource module configuration. For details on the type and structure of this option refer the individual resource module platform documentation. |
|
The name of the resource module to manage. The resource module should be supported for given os_name, if not supported it will result in error. |
|
The name of the os to manage the resource modules. The name should be fully qualified collection name format, that is <namespace>.<collection-name>.<plugin-name>. If value of this option is not set the os value will be read from ansible_network_os variable. If value of both os_name and ansible_network_os is not set it will result in error. |
|
This option is used only with state 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 parsed reads the configuration from |
|
The state the configuration should be left in. For supported values refer the individual resource module platform documentation. |
Notes
Note
Refer the individual module documentation for the valid inputs of state and config modules.
Examples
- name: get list of resource modules for given network_os
ansible.netcommon.network_resource:
register: result
- name: fetch acl config for
ansible.netcommon.network_resource:
os_name: cisco.ios.ios
name: acls
state: gathered
- 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The configuration as structured data after module completion. Returned: when changed and when state and/or config option is set Sample: |
|
The configuration as structured data prior to module invocation. Returned: When state and/or config option is set Sample: |
|
The set of commands pushed to the remote device Returned: When state and/or config option is set Sample: |
|
List of resource modules supported for given OS. Returned: When only os_name or ansible_network_os is set Sample: |