diff options
author | Gaige B Paulsen <gaige@cluetrust.com> | 2024-11-25 16:08:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 16:08:54 -0500 |
commit | bf38875af0a7e5166ce0330f16441b7d8b434e6a (patch) | |
tree | a01b371d37ae88136eec0d50868da6aebcea1414 | |
parent | 04c837af1cf89ff42adc42062df48a0dd209a0e1 (diff) | |
download | vyos.vyos-bf38875af0a7e5166ce0330f16441b7d8b434e6a.tar.gz vyos.vyos-bf38875af0a7e5166ce0330f16441b7d8b434e6a.zip |
T6910: fix documentation and argspecs are out of alignment (#358)
chore: update firewall_rules from module
fix: update firewall_global from resource model
chore: update to sync with resource module
chore: update README
fix: comment and formatting
fix: formatting issues
fix: missing imports
fix: import and metadata violations
fix: interface fixes
fix: move the arg spec comment
fix: update interface docs
fix: remove comments for non-RM versions
* T6910: fix documentation and argspecs
* T6910: docs: update per review
* T6910: docs: fix missing pipe
60 files changed, 3344 insertions, 2280 deletions
@@ -48,29 +48,29 @@ Name | Description Name | Description --- | --- [vyos.vyos.vyos_banner](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_banner_module.rst)|Manage multiline banners on VyOS devices -[vyos.vyos.vyos_bgp_address_family](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_bgp_address_family_module.rst)|BGP Address Family Resource Module. -[vyos.vyos.vyos_bgp_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_bgp_global_module.rst)|BGP Global Resource Module. +[vyos.vyos.vyos_bgp_address_family](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_bgp_address_family_module.rst)|BGP Address Family resource module +[vyos.vyos.vyos_bgp_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_bgp_global_module.rst)|BGP global resource module [vyos.vyos.vyos_command](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_command_module.rst)|Run one or more commands on VyOS devices [vyos.vyos.vyos_config](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_config_module.rst)|Manage VyOS configuration on remote device [vyos.vyos.vyos_facts](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_facts_module.rst)|Get facts about vyos devices. -[vyos.vyos.vyos_firewall_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_global_module.rst)|FIREWALL global resource module -[vyos.vyos.vyos_firewall_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_interfaces_module.rst)|Manage firewall rules attributes of interfaces on VyOS devices -[vyos.vyos.vyos_firewall_rules](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_rules_module.rst)|FIREWALL rules resource module +[vyos.vyos.vyos_firewall_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_global_module.rst)|Firewall global resource module +[vyos.vyos.vyos_firewall_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_interfaces_module.rst)|Firewall interfaces resource module +[vyos.vyos.vyos_firewall_rules](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_firewall_rules_module.rst)|Firewall rules resource module [vyos.vyos.vyos_hostname](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_hostname_module.rst)|Manages hostname resource module -[vyos.vyos.vyos_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_interfaces_module.rst)|Interfaces resource module -[vyos.vyos.vyos_l3_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_l3_interfaces_module.rst)|L3 interfaces resource module +[vyos.vyos.vyos_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_interfaces_module.rst)|Manages interface attributes of VyOS network devices. +[vyos.vyos.vyos_l3_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_l3_interfaces_module.rst)|Layer 3 interfaces resource module. [vyos.vyos.vyos_lag_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_lag_interfaces_module.rst)|LAG interfaces resource module [vyos.vyos.vyos_lldp_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_lldp_global_module.rst)|LLDP global resource module [vyos.vyos.vyos_lldp_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_lldp_interfaces_module.rst)|LLDP interfaces resource module [vyos.vyos.vyos_logging](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_logging_module.rst)|Manage logging on network devices [vyos.vyos.vyos_logging_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_logging_global_module.rst)|Logging resource module -[vyos.vyos.vyos_ntp_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ntp_global_module.rst)|Manages ntp modules of Vyos network devices +[vyos.vyos.vyos_ntp_global](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ntp_global_module.rst)|NTP global resource module [vyos.vyos.vyos_ospf_interfaces](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ospf_interfaces_module.rst)|OSPF Interfaces Resource Module. [vyos.vyos.vyos_ospfv2](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ospfv2_module.rst)|OSPFv2 resource module -[vyos.vyos.vyos_ospfv3](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ospfv3_module.rst)|OSPFV3 resource module +[vyos.vyos.vyos_ospfv3](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ospfv3_module.rst)|OSPFv3 resource module [vyos.vyos.vyos_ping](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ping_module.rst)|Tests reachability using ping from VyOS network devices [vyos.vyos.vyos_prefix_lists](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_prefix_lists_module.rst)|Prefix-Lists resource module for VyOS -[vyos.vyos.vyos_route_maps](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_route_maps_module.rst)|Route Map Resource Module. +[vyos.vyos.vyos_route_maps](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_route_maps_module.rst)|Route Map resource module [vyos.vyos.vyos_snmp_server](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_snmp_server_module.rst)|Manages snmp_server resource module [vyos.vyos.vyos_static_routes](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_static_routes_module.rst)|Static routes resource module [vyos.vyos.vyos_system](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_system_module.rst)|Run `set system` commands on VyOS devices @@ -155,6 +155,56 @@ This collection follows the Ansible project's [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). Please read and familiarize yourself with this document. +### Updating from resource module models + +Some of our modules were templated using `resource_module_builder`, but some use +the newer [`cli_rm_builder`](https://github.com/ansible-network/cli_rm_builder) +which tempaltes baed on in-place device information, but also uses a new network +parsing engine designed to simplify and standardize the parsing of network +configuration. + +#### Using older *resource_module_builder* modules + +Last build was with a slightly-modified version of resource_module_builder. +This changes the calling parameters for the resources. + +To update the collection from the resource module models, run the following command: + +```bash +ansible-playbook -e rm_dest=`pwd` \ + -e structure=collection \ + -e collection_org=vyos \ + -e collection_name=vyos \ + -e model=../../../resource_module_models/models/vyos/firewall_rules/vyos_firewall_rules.yaml \ + ../../../resource_module_builder/site.yml +``` + +#### Using *cli_rm_builder* modules + +The newer `cli_rm_builder` works similarly to the older `resource_module_builder`, but +pulls the information directly from the `DOCUMENTATION`, `EXAMPLES` and `RETURN` +blocks in the module itself. + +To update the collection from the `cli_rm_builder` models, run the following command: + +```bash +ansible-playbook -e rm_dest=`pwd` \ + -e collection_org=vyos \ + -e collection_name=vyos \ + -e resource=bgp_address_family \ + ../../../cli_rm_builder/run.yml +``` + +Unlike the `resource_module_builder`, the `cli_rm_builder` does not require the `model` parameter. Instead, it uses the `resource` parameter to specify the resource to build. + + + +### Testing playbooks + +You can use `ANSIBLE_COLLECTIONS_PATH` to test the collection locally. For example: +``` +ANSIBLE_COLLECTIONS_PATHS=~/my_dev_path ansible-playbook -i inventory.network test.yml +``` ## Changelogs <!--Add a link to a changelog.md file or an external docsite to cover this information. --> diff --git a/changelogs/fragments/resource_updates.yml b/changelogs/fragments/resource_updates.yml new file mode 100644 index 0000000..6149890 --- /dev/null +++ b/changelogs/fragments/resource_updates.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - updated resources and re-ran resource templates for existing older template code diff --git a/docs/vyos.vyos.vyos_bgp_address_family_module.rst b/docs/vyos.vyos.vyos_bgp_address_family_module.rst index f860ab7..ec4a639 100644 --- a/docs/vyos.vyos.vyos_bgp_address_family_module.rst +++ b/docs/vyos.vyos.vyos_bgp_address_family_module.rst @@ -5,10 +5,10 @@ vyos.vyos.vyos_bgp_address_family ********************************* -**BGP Address Family Resource Module.** +**BGP Address Family resource module** -Version added: 2.1.0 +Version added: 1.0.0 .. contents:: :local: @@ -376,7 +376,7 @@ Parameters <td> </td> <td> - <div>AS number.</div> + <div>AS number</div> </td> </tr> <tr> @@ -2074,6 +2074,123 @@ Examples +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when changed</td> + <td> + <div>The resulting configuration after module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The configuration prior to the module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The set of commands pushed to the remote device.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['sample command 1', 'sample command 2', 'sample command 3']</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['sample command 1', 'sample command 2', 'sample command 3']</div> + </td> + </tr> + </table> + <br/><br/> + Status ------ diff --git a/docs/vyos.vyos.vyos_bgp_global_module.rst b/docs/vyos.vyos.vyos_bgp_global_module.rst index a2e3db7..4479124 100644 --- a/docs/vyos.vyos.vyos_bgp_global_module.rst +++ b/docs/vyos.vyos.vyos_bgp_global_module.rst @@ -5,10 +5,10 @@ vyos.vyos.vyos_bgp_global ************************* -**BGP Global Resource Module.** +**BGP global resource module** -Version added: 2.0.0 +Version added: 1.0.0 .. contents:: :local: @@ -1056,7 +1056,7 @@ Parameters <td> </td> <td> - <div>description text</div> + <div>Description of the neighbor</div> </td> </tr> <tr> @@ -3064,6 +3064,123 @@ Examples +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when changed</td> + <td> + <div>The resulting configuration after module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The configuration prior to the module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The set of commands pushed to the remote device.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set protocols bgp 65536 redistribute static route-map map01', 'set protocols bgp 65536 network 203.0.113.0/24 route-map map01', 'set protocols bgp 65536 parameters always-compare-med']</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set protocols bgp 65536 redistribute static route-map map01', 'set protocols bgp 65536 network 203.0.113.0/24 route-map map01', 'set protocols bgp 65536 parameters always-compare-med']</div> + </td> + </tr> + </table> + <br/><br/> + Status ------ diff --git a/docs/vyos.vyos.vyos_firewall_global_module.rst b/docs/vyos.vyos.vyos_firewall_global_module.rst index 8c234af..76f2ca7 100644 --- a/docs/vyos.vyos.vyos_firewall_global_module.rst +++ b/docs/vyos.vyos.vyos_firewall_global_module.rst @@ -5,7 +5,7 @@ vyos.vyos.vyos_firewall_global ****************************** -**FIREWALL global resource module** +**Firewall global resource module** Version added: 1.0.0 @@ -354,7 +354,7 @@ Parameters <td> </td> <td> - <div>Allows you to specify a brief description for the port group.</div> + <div>A brief description for the port group.</div> </td> </tr> <tr> @@ -392,7 +392,7 @@ Parameters <td> </td> <td> - <div>Defines the number.</div> + <div>Specified port.</div> </td> </tr> @@ -514,7 +514,7 @@ Parameters <td> </td> <td> - <div>-A dictionary of Firewall icmp redirect and source route global configuration options.</div> + <div>A dictionary of Firewall ICMP redirect and source route global configuration options.</div> </td> </tr> <tr> @@ -729,6 +729,7 @@ Parameters </ul> </td> <td> + <div>Specify log level for packets logged.</div> <div>Only available in 1.4+</div> </td> </tr> @@ -846,7 +847,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8. - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -879,6 +880,7 @@ Examples - connection_type: established action: accept log: true + log_level: emerg - connection_type: invalid action: reject route_redirects: @@ -918,19 +920,20 @@ Examples # "set firewall group network-group MGMT network 192.0.1.0/24", # "set firewall group network-group MGMT description 'This group has the Management network addresses'", # "set firewall group network-group MGMT", - # "set firewall ip-src-route 'enable'", - # "set firewall receive-redirects 'disable'", - # "set firewall send-redirects 'enable'", - # "set firewall config-trap 'enable'", - # "set firewall state-policy established action 'accept'", - # "set firewall state-policy established log 'enable'", - # "set firewall state-policy invalid action 'reject'", - # "set firewall broadcast-ping 'enable'", - # "set firewall all-ping 'enable'", - # "set firewall log-martians 'enable'", - # "set firewall twa-hazards-protection 'enable'", - # "set firewall syn-cookies 'enable'", - # "set firewall source-validation 'strict'" + # "set firewall global-options ip-src-route 'enable'", + # "set firewall global-options receive-redirects 'disable'", + # "set firewall global-options send-redirects 'enable'", + # "set firewall global-options config-trap 'enable'", + # "set firewall global-options state-policy established action 'accept'", + # "set firewall global-options state-policy established log 'enable'", + # "set firewall global-options state-policy established log-level 'emerg'", + # "set firewall global-options state-policy invalid action 'reject'", + # "set firewall global-options broadcast-ping 'enable'", + # "set firewall global-options all-ping 'enable'", + # "set firewall global-options log-martians 'enable'", + # "set firewall global-options twa-hazards-protection 'enable'", + # "set firewall global-options syn-cookies 'enable'", + # "set firewall global-options source-validation 'strict'" # ] # # "after": { @@ -1000,36 +1003,48 @@ Examples # ------------- # # vyos@192# run show configuration commands | grep firewall - # set firewall all-ping 'enable' - # set firewall broadcast-ping 'enable' - # set firewall config-trap 'enable' + # set firewall global-options all-ping 'enable' + # set firewall global-options broadcast-ping 'enable' + # set firewall global-options config-trap 'enable' + # set firewall global-options ip-src-route 'enable' + # set firewall global-options log-martians 'enable' + # set firewall global-options receive-redirects 'disable' + # set firewall global-options send-redirects 'enable' + # set firewall global-options source-validation 'strict' + # set firewall global-options state-policy established action 'accept' + # set firewall global-options state-policy established log 'enable' + # set firewall global-options state-policy invalid action 'reject' + # set firewall global-options syn-cookies 'enable' + # set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group MGMT-HOSTS address '192.0.1.1' # set firewall group address-group MGMT-HOSTS address '192.0.1.3' # set firewall group address-group MGMT-HOSTS address '192.0.1.5' # set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' - # set firewall ip-src-route 'enable' - # set firewall log-martians 'enable' - # set firewall receive-redirects 'disable' - # set firewall send-redirects 'enable' - # set firewall source-validation 'strict' - # set firewall state-policy established action 'accept' - # set firewall state-policy established log 'enable' - # set firewall state-policy invalid action 'reject' - # set firewall syn-cookies 'enable' - # set firewall twa-hazards-protection 'enable' # # + + # Using parsed # # - name: Render the commands for provided configuration vyos.vyos.vyos_firewall_global: - running_config: - "set firewall all-ping 'enable' - set firewall broadcast-ping 'enable' - set firewall config-trap 'enable' + running_config: | + set firewall global-options all-ping 'enable' + set firewall global-options broadcast-ping 'enable' + set firewall global-options config-trap 'enable' + set firewall global-options ip-src-route 'enable' + set firewall global-options log-martians 'enable' + set firewall global-options receive-redirects 'disable' + set firewall global-options send-redirects 'enable' + set firewall global-options source-validation 'strict' + set firewall global-options state-policy established action 'accept' + set firewall global-options state-policy established log 'enable' + set firewall global-options state-policy invalid action 'reject' + set firewall global-options syn-cookies 'enable' + set firewall global-options twa-hazards-protection 'enable'" set firewall group address-group ENG-HOSTS address '192.0.3.1' set firewall group address-group ENG-HOSTS address '192.0.3.2' set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -1039,16 +1054,6 @@ Examples set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' set firewall group network-group MGMT description 'This group has the Management network addresses' set firewall group network-group MGMT network '192.0.1.0/24' - set firewall ip-src-route 'enable' - set firewall log-martians 'enable' - set firewall receive-redirects 'disable' - set firewall send-redirects 'enable' - set firewall source-validation 'strict' - set firewall state-policy established action 'accept' - set firewall state-policy established log 'enable' - set firewall state-policy invalid action 'reject' - set firewall syn-cookies 'enable' - set firewall twa-hazards-protection 'enable'" state: parsed # # @@ -1133,6 +1138,8 @@ Examples # } # } # + + # # Using deleted # @@ -1140,25 +1147,26 @@ Examples # ------------- # # vyos@192# run show configuration commands | grep firewall - # set firewall all-ping 'enable' - # set firewall broadcast-ping 'enable' - # set firewall config-trap 'enable' + # set firewall global-options all-ping 'enable' + # set firewall global-options broadcast-ping 'enable' + # set firewall global-options config-trap 'enable' + # set firewall global-options ip-src-route 'enable' + # set firewall global-options log-martians 'enable' + # set firewall global-options receive-redirects 'disable' + # set firewall global-options send-redirects 'enable' + # set firewall global-options source-validation 'strict' + # set firewall global-options state-policy established action 'accept' + # set firewall global-options state-policy established log 'enable' + # set firewall global-options state-policy invalid action 'reject' + # set firewall global-options syn-cookies 'enable' + # set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group MGMT-HOSTS address '192.0.1.1' # set firewall group address-group MGMT-HOSTS address '192.0.1.3' # set firewall group address-group MGMT-HOSTS address '192.0.1.5' # set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' - # set firewall ip-src-route 'enable' - # set firewall log-martians 'enable' - # set firewall receive-redirects 'disable' - # set firewall send-redirects 'enable' - # set firewall source-validation 'strict' - # set firewall state-policy established action 'accept' - # set firewall state-policy established log 'enable' - # set firewall state-policy invalid action 'reject' - # set firewall syn-cookies 'enable' - # set firewall twa-hazards-protection 'enable' + - name: Delete attributes of firewall. vyos.vyos.vyos_firewall_global: config: @@ -1171,6 +1179,7 @@ Examples ping: group: state: deleted + # # # ------------------------ @@ -1240,18 +1249,18 @@ Examples # "validation": "strict" # } # "commands": [ - # "delete firewall source-validation", - # "delete firewall group", - # "delete firewall log-martians", - # "delete firewall ip-src-route", - # "delete firewall receive-redirects", - # "delete firewall send-redirects", - # "delete firewall config-trap", - # "delete firewall state-policy", - # "delete firewall syn-cookies", - # "delete firewall broadcast-ping", - # "delete firewall all-ping", - # "delete firewall twa-hazards-protection" + # "delete firewall global-options source-validation", + # "delete firewall global-options group", + # "delete firewall global-options log-martians", + # "delete firewall global-options ip-src-route", + # "delete firewall global-options receive-redirects", + # "delete firewall global-options send-redirects", + # "delete firewall global-options config-trap", + # "delete firewall global-options state-policy", + # "delete firewall global-options syn-cookies", + # "delete firewall global-options broadcast-ping", + # "delete firewall global-options all-ping", + # "delete firewall global-options twa-hazards-protection" # ] # # "after": [] @@ -1261,6 +1270,8 @@ Examples # vyos@192# run show configuration commands | grep firewall # set 'firewall' # + + # # Using replaced # @@ -1268,25 +1279,25 @@ Examples # ------------- # # vyos@vyos:~$ show configuration commands| grep firewall - # set firewall all-ping 'enable' - # set firewall broadcast-ping 'enable' - # set firewall config-trap 'enable' + # set firewall global-options all-ping 'enable' + # set firewall global-options broadcast-ping 'enable' + # set firewall global-options config-trap 'enable' + # set firewall global-options ip-src-route 'enable' + # set firewall global-options log-martians 'enable' + # set firewall global-options receive-redirects 'disable' + # set firewall global-options send-redirects 'enable' + # set firewall global-options source-validation 'strict' + # set firewall global-options state-policy established action 'accept' + # set firewall global-options state-policy established log 'enable' + # set firewall global-options state-policy invalid action 'reject' + # set firewall global-options syn-cookies 'enable' + # set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group MGMT-HOSTS address '192.0.1.1' # set firewall group address-group MGMT-HOSTS address '192.0.1.3' # set firewall group address-group MGMT-HOSTS address '192.0.1.5' # set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' - # set firewall ip-src-route 'enable' - # set firewall log-martians 'enable' - # set firewall receive-redirects 'disable' - # set firewall send-redirects 'enable' - # set firewall source-validation 'strict' - # set firewall state-policy established action 'accept' - # set firewall state-policy established log 'enable' - # set firewall state-policy invalid action 'reject' - # set firewall syn-cookies 'enable' - # set firewall twa-hazards-protection 'enable' - name: Replace firewall global attributes configuration. vyos.vyos.vyos_firewall_global: @@ -1491,9 +1502,19 @@ Examples # ------------- # # vyos@192# run show configuration commands | grep firewall - # set firewall all-ping 'enable' - # set firewall broadcast-ping 'enable' - # set firewall config-trap 'enable' + # set firewall global-options all-ping 'enable' + # set firewall global-options broadcast-ping 'enable' + # set firewall global-options config-trap 'enable' + # set firewall global-options ip-src-route 'enable' + # set firewall global-options log-martians 'enable' + # set firewall global-options receive-redirects 'disable' + # set firewall global-options send-redirects 'enable' + # set firewall global-options source-validation 'strict' + # set firewall global-options state-policy established action 'accept' + # set firewall global-options state-policy established log 'enable' + # set firewall global-options state-policy invalid action 'reject' + # set firewall global-options syn-cookies 'enable' + # set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group ENG-HOSTS address '192.0.3.1' # set firewall group address-group ENG-HOSTS address '192.0.3.2' # set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -1503,27 +1524,29 @@ Examples # set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' - # set firewall ip-src-route 'enable' - # set firewall log-martians 'enable' - # set firewall receive-redirects 'disable' - # set firewall send-redirects 'enable' - # set firewall source-validation 'strict' - # set firewall state-policy established action 'accept' - # set firewall state-policy established log 'enable' - # set firewall state-policy invalid action 'reject' - # set firewall syn-cookies 'enable' - # set firewall twa-hazards-protection 'enable' # # + + # Using gathered # # Before state: # ------------- # # vyos@192# run show configuration commands | grep firewall - # set firewall all-ping 'enable' - # set firewall broadcast-ping 'enable' - # set firewall config-trap 'enable' + # set firewall global-options all-ping 'enable' + # set firewall global-options broadcast-ping 'enable' + # set firewall global-options config-trap 'enable' + # set firewall global-options ip-src-route 'enable' + # set firewall global-options log-martians 'enable' + # set firewall global-options receive-redirects 'disable' + # set firewall global-options send-redirects 'enable' + # set firewall global-options source-validation 'strict' + # set firewall global-options state-policy established action 'accept' + # set firewall global-options state-policy established log 'enable' + # set firewall global-options state-policy invalid action 'reject' + # set firewall global-options syn-cookies 'enable' + # set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group ENG-HOSTS address '192.0.3.1' # set firewall group address-group ENG-HOSTS address '192.0.3.2' # set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -1533,17 +1556,7 @@ Examples # set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' - # set firewall ip-src-route 'enable' - # set firewall log-martians 'enable' - # set firewall receive-redirects 'disable' - # set firewall send-redirects 'enable' - # set firewall source-validation 'strict' - # set firewall state-policy established action 'accept' - # set firewall state-policy established log 'enable' - # set firewall state-policy invalid action 'reject' - # set firewall syn-cookies 'enable' - # set firewall twa-hazards-protection 'enable' - # + - name: Gather firewall global config with provided configurations vyos.vyos.vyos_firewall_global: state: gathered @@ -1633,9 +1646,19 @@ Examples # ------------- # # vyos@192# run show configuration commands | grep firewall - # set firewall all-ping 'enable' - # set firewall broadcast-ping 'enable' - # set firewall config-trap 'enable' + # set firewall global-options all-ping 'enable' + # set firewall global-options broadcast-ping 'enable' + # set firewall global-options config-trap 'enable' + # set firewall global-options ip-src-route 'enable' + # set firewall global-options log-martians 'enable' + # set firewall global-options receive-redirects 'disable' + # set firewall global-options send-redirects 'enable' + # set firewall global-options source-validation 'strict' + # set firewall global-options state-policy established action 'accept' + # set firewall global-options state-policy established log 'enable' + # set firewall global-options state-policy invalid action 'reject' + # set firewall global-options syn-cookies 'enable' + # set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group ENG-HOSTS address '192.0.3.1' # set firewall group address-group ENG-HOSTS address '192.0.3.2' # set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -1645,16 +1668,6 @@ Examples # set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' - # set firewall ip-src-route 'enable' - # set firewall log-martians 'enable' - # set firewall receive-redirects 'disable' - # set firewall send-redirects 'enable' - # set firewall source-validation 'strict' - # set firewall state-policy established action 'accept' - # set firewall state-policy established log 'enable' - # set firewall state-policy invalid action 'reject' - # set firewall syn-cookies 'enable' - # set firewall twa-hazards-protection 'enable' # Using rendered @@ -1723,22 +1736,21 @@ Examples # "set firewall group network-group MGMT network 192.0.1.0/24", # "set firewall group network-group MGMT description 'This group has the Management network addresses'", # "set firewall group network-group MGMT", - # "set firewall ip-src-route 'enable'", - # "set firewall receive-redirects 'disable'", - # "set firewall send-redirects 'enable'", - # "set firewall config-trap 'enable'", - # "set firewall state-policy established action 'accept'", - # "set firewall state-policy established log 'enable'", - # "set firewall state-policy invalid action 'reject'", - # "set firewall broadcast-ping 'enable'", - # "set firewall all-ping 'enable'", - # "set firewall log-martians 'enable'", - # "set firewall twa-hazards-protection 'enable'", - # "set firewall syn-cookies 'enable'", - # "set firewall source-validation 'strict'" + # "set firewall global-options ip-src-route 'enable'", + # "set firewall global-options receive-redirects 'disable'", + # "set firewall global-options send-redirects 'enable'", + # "set firewall global-options config-trap 'enable'", + # "set firewall global-options state-policy established action 'accept'", + # "set firewall global-options state-policy established log 'enable'", + # "set firewall global-options state-policy invalid action 'reject'", + # "set firewall global-options broadcast-ping 'enable'", + # "set firewall global-options all-ping 'enable'", + # "set firewall global-options log-martians 'enable'", + # "set firewall global-options twa-hazards-protection 'enable'", + # "set firewall global-options syn-cookies 'enable'", + # "set firewall global-options source-validation 'strict'" # ] # - # @@ -1760,16 +1772,15 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>after</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> <td>when changed</td> <td> - <div>The resulting configuration model invocation.</div> + <div>The resulting configuration after module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> </td> </tr> <tr> @@ -1778,16 +1789,15 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>before</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> - <td>always</td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> - <div>The configuration prior to the model invocation.</div> + <div>The configuration prior to the module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> </td> </tr> <tr> @@ -1807,6 +1817,57 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set firewall group address-group ENG-HOSTS', 'set firewall group address-group ENG-HOSTS address 192.0.3.1']</div> </td> </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set firewall group address-group ENG-HOSTS', 'set firewall group address-group ENG-HOSTS address 192.0.3.1']</div> + </td> + </tr> </table> <br/><br/> diff --git a/docs/vyos.vyos.vyos_firewall_interfaces_module.rst b/docs/vyos.vyos.vyos_firewall_interfaces_module.rst index 386d52b..34251fc 100644 --- a/docs/vyos.vyos.vyos_firewall_interfaces_module.rst +++ b/docs/vyos.vyos.vyos_firewall_interfaces_module.rst @@ -5,10 +5,10 @@ vyos.vyos.vyos_firewall_interfaces ********************************** -**Manage firewall rules attributes of interfaces on VyOS devices** +**Firewall interfaces resource module** -Version added: 2.10.0 +Version added: 1.0.0 .. contents:: :local: diff --git a/docs/vyos.vyos.vyos_firewall_rules_module.rst b/docs/vyos.vyos.vyos_firewall_rules_module.rst index ad363b4..97f8b5e 100644 --- a/docs/vyos.vyos.vyos_firewall_rules_module.rst +++ b/docs/vyos.vyos.vyos_firewall_rules_module.rst @@ -5,7 +5,7 @@ vyos.vyos.vyos_firewall_rules ***************************** -**FIREWALL rules resource module** +**Firewall rules resource module** Version added: 1.0.0 @@ -110,7 +110,8 @@ Parameters <div>Default action for rule-set.</div> <div>drop (Drop if no prior rules are hit (default))</div> <div>reject (Drop and notify source if no prior rules are hit)</div> - <div>accept (Accept if no prior rules are hit) - jump (Jump to another rule-set, 1.4+)</div> + <div>accept (Accept if no prior rules are hit)</div> + <div>jump (Jump to another rule-set, 1.4+)</div> </td> </tr> <tr> @@ -667,6 +668,8 @@ Parameters </td> <td> <div>Inbound ip sec packets.</div> + <div>VyOS 1.4 and older match-ipsec/match-none</div> + <div>VyOS 1.5 and later require -in/-out suffixes</div> </td> </tr> <tr> @@ -808,7 +811,7 @@ Parameters </ul> </td> <td> - <div>Log matching packets.</div> + <div>Option to log packets matching rule.</div> </td> </tr> <tr> @@ -1827,7 +1830,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8. - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -2500,7 +2503,6 @@ Examples description: Rule 502 is configured by Ansible ipsec: match-ipsec state: overridden - # # # ------------------------- @@ -2636,6 +2638,7 @@ Examples # - name: Gather listed firewall rules with provided configurations vyos.vyos.vyos_firewall_rules: + config: state: gathered # # @@ -2784,7 +2787,6 @@ Examples invalid: false related: true state: rendered - # # # ------------------------- @@ -2820,7 +2822,7 @@ Examples # Using parsed # # - - name: Parsed the provided input commands. + - name: Parse the commands for provided configuration vyos.vyos.vyos_firewall_rules: running_config: "set firewall group address-group 'inbound' @@ -2892,11 +2894,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when changed</td> <td> - <div>The resulting configuration model invocation.</div> + <div>The resulting configuration after module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> </td> </tr> <tr> @@ -2908,13 +2909,12 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">dictionary</span> </div> </td> - <td>always</td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> - <div>The configuration prior to the model invocation.</div> + <div>The configuration prior to the module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> </td> </tr> <tr> @@ -2934,6 +2934,57 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set firewall name Downlink default-action 'accept'", "set firewall name Downlink description 'IPv4 INBOUND rule set'", "set firewall name Downlink rule 501 action 'accept'", "set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'", "set firewall name Downlink rule 502 ipsec 'match-ipsec'"]</div> </td> </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set firewall name Downlink default-action 'accept'", "set firewall name Downlink description 'IPv4 INBOUND rule set'", "set firewall name Downlink rule 501 action 'accept'", "set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'", "set firewall name Downlink rule 502 ipsec 'match-ipsec'"]</div> + </td> + </tr> </table> <br/><br/> @@ -2946,3 +2997,4 @@ Authors ~~~~~~~ - Rohit Thakur (@rohitthakur2590) +- Gaige B. Paulsen (@gaige) diff --git a/docs/vyos.vyos.vyos_interfaces_module.rst b/docs/vyos.vyos.vyos_interfaces_module.rst index f5f6941..2415627 100644 --- a/docs/vyos.vyos.vyos_interfaces_module.rst +++ b/docs/vyos.vyos.vyos_interfaces_module.rst @@ -5,10 +5,10 @@ vyos.vyos.vyos_interfaces ************************* -**Interfaces resource module** +**Manages interface attributes of VyOS network devices.** -Version added: 1.0.0 +Version added: 2.9.0 .. contents:: :local: @@ -47,7 +47,7 @@ Parameters <td> </td> <td> - <div>The provided interfaces configuration.</div> + <div>The provided interface configuration.</div> </td> </tr> <tr> @@ -107,6 +107,7 @@ Parameters <td> <div>Administrative state of the interface.</div> <div>Set the value to <code>true</code> to administratively enable the interface or <code>false</code> to disable it.</div> + <div style="font-size: small; color: darkgreen"><br/>aliases: enable</div> </td> </tr> <tr> @@ -223,6 +224,7 @@ Parameters <td> <div>Administrative state of the virtual sub-interface.</div> <div>Set the value to <code>true</code> to administratively enable the interface or <code>false</code> to disable it.</div> + <div style="font-size: small; color: darkgreen"><br/>aliases: enable</div> </td> </tr> <tr> @@ -311,9 +313,8 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8 - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. - - The examples use the stdout_callback as yaml to produce task outputs. @@ -1025,11 +1026,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when changed</td> <td> - <div>The configuration as structured data after module completion.</div> + <div>The resulting configuration after module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> </td> </tr> <tr> @@ -1041,13 +1041,12 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>always</td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> - <div>The configuration as structured data prior to module invocation.</div> + <div>The configuration prior to the module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> </td> </tr> <tr> @@ -1067,6 +1066,57 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set interfaces ethernet eth1 mtu 1200', 'set interfaces ethernet eth2 vif 100 description VIF 100']</div> </td> </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set interfaces ethernet eth1 mtu 1200', 'set interfaces ethernet eth2 vif 100 description VIF 100']</div> + </td> + </tr> </table> <br/><br/> diff --git a/docs/vyos.vyos.vyos_l3_interfaces_module.rst b/docs/vyos.vyos.vyos_l3_interfaces_module.rst index 4f93705..7744cd5 100644 --- a/docs/vyos.vyos.vyos_l3_interfaces_module.rst +++ b/docs/vyos.vyos.vyos_l3_interfaces_module.rst @@ -5,7 +5,7 @@ vyos.vyos.vyos_l3_interfaces **************************** -**L3 interfaces resource module** +**Layer 3 interfaces resource module.** Version added: 1.0.0 @@ -116,6 +116,7 @@ Parameters </td> <td> <div>IPv6 address of the interface.</div> + <div><code>auto-config</code> to use SLAAC to chose an address.</div> </td> </tr> @@ -150,7 +151,7 @@ Parameters <td> </td> <td> - <div>Virtual sub-interfaces L3 configurations.</div> + <div>List of virtual sub-interfaces (VIFs) of the interface.</div> </td> </tr> <tr> @@ -168,7 +169,7 @@ Parameters <td> </td> <td> - <div>List of IPv4 addresses of the virtual interface.</div> + <div>List of IPv4 addresses of the VIF.</div> </td> </tr> <tr> @@ -186,7 +187,7 @@ Parameters <td> </td> <td> - <div>IPv4 address of the virtual interface.</div> + <div>IPv4 address of the VIF.</div> </td> </tr> @@ -205,7 +206,7 @@ Parameters <td> </td> <td> - <div>List of IPv6 addresses of the virtual interface.</div> + <div>List of IPv6 addresses of the VIF.</div> </td> </tr> <tr> @@ -223,7 +224,8 @@ Parameters <td> </td> <td> - <div>IPv6 address of the virtual interface.</div> + <div>IPv6 address of the virtual VIF</div> + <div><code>auto-config</code> to use SLAAC to chose an address.</div> </td> </tr> @@ -241,7 +243,7 @@ Parameters <td> </td> <td> - <div>Identifier for the virtual sub-interface.</div> + <div>Identifier for the VIF.</div> </td> </tr> @@ -278,9 +280,9 @@ Parameters <li>replaced</li> <li>overridden</li> <li>deleted</li> - <li>parsed</li> - <li>gathered</li> <li>rendered</li> + <li>gathered</li> + <li>parsed</li> </ul> </td> <td> @@ -295,7 +297,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3. - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -340,7 +342,6 @@ Examples - address: '2001:db8:1400::3/38' state: merged - # After state: # ------------- # @@ -393,7 +394,7 @@ Examples - name: eth3 ipv6: - - address: 2001:db8::11/32 + - address: '2001:db8::11/32' state: replaced # After state: @@ -450,7 +451,6 @@ Examples - address: dhcpv6 state: overridden - # After state # ------------ # @@ -492,8 +492,7 @@ Examples # set interfaces ethernet eth3 vif 102 address '2001:db8:4000::3/34' # set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34' - - name: Delete L3 attributes of given interfaces (Note - This won't delete the interface - itself) + - name: Delete L3 attributes of given interfaces (Note - This won't delete the interface itself) vyos.vyos.vyos_l3_interfaces: config: - name: eth1 @@ -715,11 +714,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when changed</td> <td> - <div>The configuration as structured data after module completion.</div> + <div>The resulting configuration module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> @@ -733,11 +731,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>always</td> <td> - <div>The configuration as structured data prior to module invocation.</div> + <div>The configuration prior to the module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> @@ -768,5 +765,5 @@ Status Authors ~~~~~~~ -- Nilashish Chakraborty (@NilashishC) - Rohit Thakur (@rohitthakur2590) +- Nilashish Chakraborty (@nilashishc) diff --git a/docs/vyos.vyos.vyos_lag_interfaces_module.rst b/docs/vyos.vyos.vyos_lag_interfaces_module.rst index e389654..4f3e559 100644 --- a/docs/vyos.vyos.vyos_lag_interfaces_module.rst +++ b/docs/vyos.vyos.vyos_lag_interfaces_module.rst @@ -265,7 +265,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8. - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -603,8 +603,7 @@ Examples # set interfaces ethernet eth2 bond-group 'bond2' # set interfaces ethernet eth3 bond-group 'bond3' # - - name: Delete LAG attributes of given interfaces (Note This won't delete the interface - itself) + - name: Delete LAG attributes of given interfaces (Note - This won't delete the interface itself) vyos.vyos.vyos_lag_interfaces: config: - name: bond2 @@ -891,11 +890,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when changed</td> <td> - <div>The configuration as structured data after module completion.</div> + <div>The resulting configuration module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> @@ -909,11 +907,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>always</td> <td> - <div>The configuration as structured data prior to module invocation.</div> + <div>The configuration prior to the module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> diff --git a/docs/vyos.vyos.vyos_lldp_global_module.rst b/docs/vyos.vyos.vyos_lldp_global_module.rst index f858003..d9e002a 100644 --- a/docs/vyos.vyos.vyos_lldp_global_module.rst +++ b/docs/vyos.vyos.vyos_lldp_global_module.rst @@ -172,7 +172,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8 - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -204,32 +204,24 @@ Examples # Module Execution Results # ------------------------ # - # "before": [] - # - # "commands": [ - # "set service lldp legacy-protocols fdp", - # "set service lldp legacy-protocols cdp", - # "set service lldp snmp enable", - # "set service lldp management-address '192.0.2.11'" - # ] - # - # "after": [ - # { - # "snmp": "enable" - # }, - # { - # "address": "192.0.2.11" - # }, - # { - # "legacy_protocols": [ - # "cdp", - # "fdp" - # ] - # } - # { - # "enable": true - # } + # before": {} + # + # commands": [ + # "set service lldp legacy-protocols fdp", + # "set service lldp legacy-protocols cdp", + # "set service lldp snmp enable", + # "set service lldp management-address '192.0.2.11'" + # ] + # + # after": { + # "snmp": "enable" + # "address": "192.0.2.11" + # "legacy_protocols": [ + # "cdp", + # "fdp" # ] + # "enable": true + # } # # After state: # ------------- @@ -267,23 +259,16 @@ Examples # ------------------------ # # - # "before": [ - # { - # "snmp": "enable" - # }, - # { - # "address": "192.0.2.11" - # }, - # { - # "legacy_protocols": [ - # "cdp", - # "fdp" - # ] - # } - # { - # "enable": true - # } + # "before": { + # "snmp": "enable" + # "address": "192.0.2.11" + # "legacy_protocols": [ + # "cdp", + # "fdp" # ] + # "enable": true + # } + # # "commands": [ # "delete service lldp snmp", # "delete service lldp legacy-protocols fdp", @@ -292,21 +277,15 @@ Examples # "set service lldp legacy-protocols sonmp" # ] # - # "after": [ - # { - # "address": "192.0.2.14" - # }, - # { - # "legacy_protocols": [ - # "cdp", - # "edp", - # "sonmp" - # ] - # } - # { - # "enable": true - # } + # "after": { + # "address": "192.0.2.14" + # "legacy_protocols": [ + # "cdp", + # "edp", + # "sonmp" # ] + # "enable": true + # } # # After state: # ------------- @@ -339,32 +318,24 @@ Examples # Module Execution Results # ------------------------ # - # "before": [ - # { - # "address": "192.0.2.14" - # }, - # { - # "legacy_protocols": [ - # "cdp", - # "edp", - # "sonmp" - # ] - # } - # { - # "enable": true - # } + # "before": { + # "address": "192.0.2.14" + # "legacy_protocols": [ + # "cdp", + # "edp", + # "sonmp" # ] + # "enable": true + # } # # "commands": [ - # "delete service lldp management-address", - # "delete service lldp legacy-protocols" - # ] + # "delete service lldp management-address", + # "delete service lldp legacy-protocols" + # ] # - # "after": [ - # { - # "enable": true - # } - # ] + # "after": { + # "enable": true + # } # # After state # ------------ @@ -391,8 +362,7 @@ Examples # Module Execution Result # ------------------------- # - # "gathered": [ - # { + # "gathered": { # "config_trap": true, # "group": { # "address_group": [ @@ -494,10 +464,10 @@ Examples # # # "rendered": [ - # "set service lldp legacy-protocols 'cdp'", - # "set service lldp", - # "set service lldp management-address '192.0.2.17'" - # ] + # "set service lldp legacy-protocols 'cdp'", + # "set service lldp", + # "set service lldp management-address '192.0.2.17'" + # ] # @@ -519,14 +489,13 @@ Examples # # # "parsed": { - # "address": "192.0.2.11", - # "enable": true, - # "legacy_protocols": [ - # "cdp", - # "fdp" - # ] - # } - # + # "address": "192.0.2.11", + # "enable": true, + # "legacy_protocols": [ + # "cdp", + # "fdp" + # ] + # } @@ -548,16 +517,15 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>after</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> <td>when changed</td> <td> - <div>The configuration as structured data after module completion.</div> + <div>The resulting configuration after module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> @@ -566,16 +534,15 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>before</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> <td>always</td> <td> - <div>The configuration as structured data prior to module invocation.</div> + <div>The configuration prior to the module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> diff --git a/docs/vyos.vyos.vyos_lldp_interfaces_module.rst b/docs/vyos.vyos.vyos_lldp_interfaces_module.rst index d46c506..78b0a73 100644 --- a/docs/vyos.vyos.vyos_lldp_interfaces_module.rst +++ b/docs/vyos.vyos.vyos_lldp_interfaces_module.rst @@ -46,7 +46,7 @@ Parameters <td> </td> <td> - <div>A list of lldp interfaces configurations.</div> + <div>A list of LLDP interfaces configurations.</div> </td> </tr> <tr> @@ -66,7 +66,7 @@ Parameters </ul> </td> <td> - <div>to disable lldp on the interface.</div> + <div>Disable LLDP on the interfaces.</div> </td> </tr> <tr> @@ -132,6 +132,7 @@ Parameters <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> <div style="font-size: small"> <span style="color: purple">integer</span> + / <span style="color: red">required</span> </div> </td> <td> @@ -151,6 +152,7 @@ Parameters <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> <div style="font-size: small"> <span style="color: purple">string</span> + / <span style="color: red">required</span> </div> </td> <td> @@ -309,7 +311,7 @@ Parameters <td> </td> <td> - <div>Name of the lldp interface.</div> + <div>Name of the LLDP interface.</div> </td> </tr> @@ -362,7 +364,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8 - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -397,18 +399,19 @@ Examples longitude: 222.267255W latitude: 33.524449N state: merged - # # # ------------------------- # Module Execution Result # ------------------------- # - # before": [] + # before": {} # # "commands": [ # "set service lldp interface eth1 location civic-based country-code 'US'", # "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'", + # "set service lldp interface eth1 location civic-based country-code 'US'", + # "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'", # "set service lldp interface eth1", # "set service lldp interface eth2 location coordinate-based latitude '33.524449N'", # "set service lldp interface eth2 location coordinate-based altitude '2200'", @@ -419,34 +422,33 @@ Examples # "set service lldp interface eth2 location coordinate-based datum 'WGS84'", # "set service lldp interface eth2 location coordinate-based longitude '222.267255W'", # "set service lldp interface eth2" + # ] # - # "after": [ - # { - # "location": { - # "coordinate_based": { - # "altitude": 2200, - # "datum": "WGS84", - # "latitude": "33.524449N", - # "longitude": "222.267255W" - # } - # }, - # "name": "eth2" - # }, - # { - # "location": { - # "civic_based": { - # "ca_info": [ - # { - # "ca_type": 0, - # "ca_value": "ENGLISH" - # } - # ], - # "country_code": "US" - # } - # }, - # "name": "eth1" - # } - # ], + # "after": { + # "location": { + # "coordinate_based": { + # "altitude": 2200, + # "datum": "WGS84", + # "latitude": "33.524449N", + # "longitude": "222.267255W" + # } + # }, + # "name": "eth2" + # }, + # { + # "location": { + # "civic_based": { + # "ca_info": [ + # { + # "ca_type": 0, + # "ca_value": "ENGLISH" + # } + # ], + # "country_code": "US" + # } + # }, + # "name": "eth1" + # } # # After state: # ------------- @@ -540,33 +542,31 @@ Examples # "set service lldp interface eth1 location coordinate-based longitude '222.267255W'" # ] # - # "after": [ - # { - # "location": { - # "civic_based": { - # "ca_info": [ - # { - # "ca_type": 0, - # "ca_value": "ENGLISH" - # } - # ], - # "country_code": "US" - # } - # }, - # "name": "eth2" + # "after": { + # "location": { + # "civic_based": { + # "ca_info": [ + # { + # "ca_type": 0, + # "ca_value": "ENGLISH" + # } + # ], + # "country_code": "US" + # } # }, - # { - # "location": { - # "coordinate_based": { - # "altitude": 2200, - # "datum": "WGS84", - # "latitude": "33.524449N", - # "longitude": "222.267255W" - # } - # }, - # "name": "eth1" - # } - # ] + # "name": "eth2" + # }, + # { + # "location": { + # "coordinate_based": { + # "altitude": 2200, + # "datum": "WGS84", + # "latitude": "33.524449N", + # "longitude": "222.267255W" + # } + # }, + # "name": "eth1" + # } # # After state: # ------------- @@ -612,49 +612,49 @@ Examples # ------------------------- # # "before": [ - # { - # "enable": false, - # "location": { - # "civic_based": { - # "ca_info": [ - # { - # "ca_type": 0, - # "ca_value": "ENGLISH" - # } - # ], - # "country_code": "US" - # } - # }, - # "name": "eth2" - # }, - # { - # "enable": false, - # "location": { - # "coordinate_based": { - # "altitude": 2200, - # "datum": "WGS84", - # "latitude": "33.524449N", - # "longitude": "222.267255W" - # } - # }, - # "name": "eth1" + # { + # "enable": false, + # "location": { + # "civic_based": { + # "ca_info": [ + # { + # "ca_type": 0, + # "ca_value": "ENGLISH" + # } + # ], + # "country_code": "US" # } - # ] - # - # "commands": [ - # "delete service lldp interface eth2 location", - # "delete service lldp interface eth2 disable", - # "set service lldp interface eth2 location elin 0000000911" + # }, + # "name": "eth2" + # }, + # { + # "enable": false, + # "location": { + # "coordinate_based": { + # "altitude": 2200, + # "datum": "WGS84", + # "latitude": "33.524449N", + # "longitude": "222.267255W" + # } + # }, + # "name": "eth1" + # } + # ] # + # "commands": [ + # "delete service lldp interface eth2 location", + # "delete service lldp interface eth2 disable", + # "set service lldp interface eth2 location elin 0000000911" + # ] # - # "after": [ - # { - # "location": { - # "elin": 0000000911 - # }, - # "name": "eth2" - # } - # ] + # "after": [ + # { + # "location": { + # "elin": 0000000911 + # }, + # "name": "eth2" + # } + # ] # # # After state @@ -672,7 +672,7 @@ Examples # vyos@vyos# run show configuration commands | grep lldp # set service lldp interface eth2 location elin '0000000911' # - - name: Delete lldp interface attributes of given interfaces. + - name: Delete LLDP interface attributes of given interfaces. vyos.vyos.vyos_lldp_interfaces: config: - name: eth2 @@ -683,11 +683,17 @@ Examples # Module Execution Results # ------------------------ # - before: [{location: {elin: 0000000911}, name: eth2}] - # "commands": [ - # "commands": [ - # "delete service lldp interface eth2" - # ] + # "before": [ + # { + # "location": { + # "elin": 0000000911 + # }, + # "name": "eth2" + # } + # ] + # "commands": [ + # "delete service lldp interface eth2" + # ] # # "after": [] # After state @@ -877,8 +883,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The configuration as structured data after module completion.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> @@ -895,8 +900,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The configuration as structured data prior to module invocation.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format - of the parameters above.</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> </td> </tr> <tr> diff --git a/docs/vyos.vyos.vyos_logging_global_module.rst b/docs/vyos.vyos.vyos_logging_global_module.rst index 16a7722..1111b6c 100644 --- a/docs/vyos.vyos.vyos_logging_global_module.rst +++ b/docs/vyos.vyos.vyos_logging_global_module.rst @@ -1559,7 +1559,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">dictionary</span> </div> </td> - <td>when state is <em>merged</em>, <em>replaced</em>, <em>overridden</em>, <em>deleted</em> or <em>purged</em></td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> <div>The configuration prior to the module execution.</div> <br/> @@ -1576,7 +1576,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>merged</em>, <em>replaced</em>, <em>overridden</em>, <em>deleted</em> or <em>purged</em></td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> <div>The set of commands pushed to the remote device.</div> <br/> @@ -1593,7 +1593,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>gathered</em></td> + <td>when <em>state</em> is <code>gathered</code></td> <td> <div>Facts about the network resource gathered from the remote device as structured data.</div> <br/> @@ -1610,7 +1610,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>parsed</em></td> + <td>when <em>state</em> is <code>parsed</code></td> <td> <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> <br/> @@ -1627,7 +1627,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>rendered</em></td> + <td>when <em>state</em> is <code>rendered</code></td> <td> <div>The provided configuration in the task rendered in device-native format (offline).</div> <br/> diff --git a/docs/vyos.vyos.vyos_ntp_global_module.rst b/docs/vyos.vyos.vyos_ntp_global_module.rst index 8bfa05a..582aa17 100644 --- a/docs/vyos.vyos.vyos_ntp_global_module.rst +++ b/docs/vyos.vyos.vyos_ntp_global_module.rst @@ -5,10 +5,10 @@ vyos.vyos.vyos_ntp_global ************************* -**Manages ntp modules of Vyos network devices** +**NTP global resource module** -Version added: 2.4.0 +Version added: 1.0.0 .. contents:: :local: @@ -114,14 +114,15 @@ Parameters <td> <ul style="margin: 0; padding: 0"><b>Choices:</b> <li>noselect</li> - <li>dynamic (v1.2)</li> - <li>pool (v1.3+))</li> + <li>dynamic</li> + <li>pool</li> <li>preempt</li> <li>prefer</li> </ul> </td> <td> <div>server options for NTP</div> + <div>`dynamic` changed to `pool` after v1.3</div> </td> </tr> <tr> @@ -195,7 +196,7 @@ Notes .. note:: - Tested against vyos 1.3 - This module works with connection ``network_cli``. - - VyOS v.1.4+ uses chronyd, and path changes from ``system`` to ``service`` + - VyOS v.1.4+ uses chronyd, and path changes from `system` to `service` @@ -212,8 +213,8 @@ Examples # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp # set service ntp server time1.vyos.net - # set system/service ntp server time2.vyos.net - # set system/service ntp server time3.vyos.net + # set service ntp server time2.vyos.net + # set service ntp server time3.vyos.net # vyos@vyos:~$ # # Task @@ -262,20 +263,20 @@ Examples # }, # "changed": true, # "commands": [ - # "set system/service ntp allow-clients address 10.6.6.0/24", - # "set system/service ntp listen-address 10.1.3.1", - # "set system/service ntp server 203.0.113.0 prefer" + # "set service ntp allow-clients address 10.6.6.0/24", + # "set service ntp listen-address 10.1.3.1", + # "set service ntp server 203.0.113.0 prefer" # ] # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp - # set system/service ntp allow-clients address '10.6.6.0/24' - # set system/service ntp listen-address '10.1.3.1' - # set system/service ntp server 203.0.113.0 prefer, - # set system/service ntp server time1.vyos.net - # set system/service ntp server time2.vyos.net - # set system/service ntp server time3.vyos.net + # set service ntp allow-clients address '10.6.6.0/24' + # set service ntp listen-address '10.1.3.1' + # set service ntp server 203.0.113.0 prefer, + # set service ntp server time1.vyos.net + # set service ntp server time2.vyos.net + # set service ntp server time3.vyos.net # vyos@vyos:~$ @@ -286,25 +287,25 @@ Examples # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp - # set system/service ntp allow-clients address '10.4.9.0/24' - # set system/service ntp allow-clients address '10.4.7.0/24' - # set system/service ntp allow-clients address '10.1.2.0/24' - # set system/service ntp allow-clients address '10.2.3.0/24' - # set system/service ntp listen-address '10.1.9.16' - # set system/service ntp listen-address '10.5.3.2' - # set system/service ntp listen-address '10.7.9.21' - # set system/service ntp listen-address '10.8.9.4' - # set system/service ntp listen-address '10.4.5.1' - # set system/service ntp server 10.3.6.5 noselect - # set system/service ntp server 10.3.6.5 dynamic - # set system/service ntp server 10.3.6.5 preempt - # set system/service ntp server 10.3.6.5 prefer - # set system/service ntp server server4 noselect - # set system/service ntp server server4 dynamic - # set system/service ntp server server5 - # set system/service ntp server time1.vyos.net - # set system/service ntp server time2.vyos.net - # set system/service ntp server time3.vyos.net + # set service ntp allow-clients address '10.4.9.0/24' + # set service ntp allow-clients address '10.4.7.0/24' + # set service ntp allow-clients address '10.1.2.0/24' + # set service ntp allow-clients address '10.2.3.0/24' + # set service ntp listen-address '10.1.9.16' + # set service ntp listen-address '10.5.3.2' + # set service ntp listen-address '10.7.9.21' + # set service ntp listen-address '10.8.9.4' + # set service ntp listen-address '10.4.5.1' + # set service ntp server 10.3.6.5 noselect + # set service ntp server 10.3.6.5 dynamic + # set service ntp server 10.3.6.5 preempt + # set service ntp server 10.3.6.5 prefer + # set service ntp server server4 noselect + # set service ntp server server4 dynamic + # set service ntp server server5 + # set service ntp server time1.vyos.net + # set service ntp server time2.vyos.net + # set service ntp server time3.vyos.net # vyos@vyos:~$ # # Task @@ -397,32 +398,32 @@ Examples # }, # "changed": true, # "commands": [ - # "delete system/service ntp allow-clients address 10.4.7.0/24", - # "delete system/service ntp allow-clients address 10.2.3.0/24", - # "delete system/service ntp allow-clients address 10.1.2.0/24", - # "delete system/service ntp allow-clients address 10.4.9.0/24", - # "delete system/service ntp listen-address 10.7.9.21", - # "delete system/service ntp listen-address 10.4.5.1", - # "delete system/service ntp listen-address 10.5.3.2", - # "delete system/service ntp listen-address 10.8.9.4", - # "delete system/service ntp listen-address 10.1.9.16", - # "delete system/service ntp server 10.3.6.5", - # "delete system/service ntp server server4", - # "delete system/service ntp server server5", - # "set system/service ntp allow-clients address 10.6.6.0/24", - # "set system/service ntp listen-address 10.1.3.1", - # "set system/service ntp server 203.0.113.0 prefer" + # "delete service ntp allow-clients address 10.4.7.0/24", + # "delete service ntp allow-clients address 10.2.3.0/24", + # "delete service ntp allow-clients address 10.1.2.0/24", + # "delete service ntp allow-clients address 10.4.9.0/24", + # "delete service ntp listen-address 10.7.9.21", + # "delete service ntp listen-address 10.4.5.1", + # "delete service ntp listen-address 10.5.3.2", + # "delete service ntp listen-address 10.8.9.4", + # "delete service ntp listen-address 10.1.9.16", + # "delete service ntp server 10.3.6.5", + # "delete service ntp server server4", + # "delete service ntp server server5", + # "set service ntp allow-clients address 10.6.6.0/24", + # "set service ntp listen-address 10.1.3.1", + # "set service ntp server 203.0.113.0 prefer" # ] # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp - # set system/service ntp allow-clients address '10.6.6.0/24' - # set system/service ntp listen-address '10.1.3.1' - # set system/service ntp server 203.0.113.0 prefer, - # set system/service ntp server time1.vyos.net - # set system/service ntp server time2.vyos.net - # set system/service ntp server time3.vyos.net + # set service ntp allow-clients address '10.6.6.0/24' + # set service ntp listen-address '10.1.3.1' + # set service ntp server 203.0.113.0 prefer, + # set service ntp server time1.vyos.net + # set service ntp server time2.vyos.net + # set service ntp server time3.vyos.net # vyos@vyos:~$ # # ------------------- @@ -432,12 +433,12 @@ Examples # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp - # set system/service ntp allow-clients address '10.6.6.0/24' - # set system/service ntp listen-address '10.1.3.1' - # set system/service ntp server 203.0.113.0 prefer, - # set system/service ntp server time1.vyos.net - # set system/service ntp server time2.vyos.net - # set system/service ntp server time3.vyos.net + # set service ntp allow-clients address '10.6.6.0/24' + # set service ntp listen-address '10.1.3.1' + # set service ntp server 203.0.113.0 prefer, + # set service ntp server time1.vyos.net + # set service ntp server time2.vyos.net + # set service ntp server time3.vyos.net # vyos@vyos:~$ # Task @@ -898,7 +899,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The set of commands pushed to the remote device.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set service ntp server server1 dynamic', 'set service ntp server server1 prefer', 'set service ntp server server2 noselect', 'set service ntp server server2 preempt', 'set service ntp server server_add preempt']</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set system ntp server server1 dynamic', 'set system ntp server server1 prefer', 'set system ntp server server2 noselect', 'set system ntp server server2 preempt', 'set system ntp server server_add preempt']</div> </td> </tr> <tr> @@ -949,7 +950,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The provided configuration in the task rendered in device-native format (offline).</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set service ntp server server1 dynamic', 'set service ntp server server1 prefer', 'set service ntp server server2 noselect', 'set service ntp server server2 preempt', 'set service ntp server server_add preempt']</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set system ntp server server1 dynamic', 'set system ntp server server1 prefer', 'set system ntp server server2 noselect', 'set system ntp server server2 preempt', 'set system ntp server server_add preempt']</div> </td> </tr> </table> diff --git a/docs/vyos.vyos.vyos_ospf_interfaces_module.rst b/docs/vyos.vyos.vyos_ospf_interfaces_module.rst index 1c4b226..a74f53c 100644 --- a/docs/vyos.vyos.vyos_ospf_interfaces_module.rst +++ b/docs/vyos.vyos.vyos_ospf_interfaces_module.rst @@ -1191,6 +1191,123 @@ Examples +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when changed</td> + <td> + <div>The resulting configuration after module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The configuration prior to the module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The set of commands pushed to the remote device.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'", "set interfaces bonding bond2 ip ospf bandwidth '70'", "set interfaces bonding bond2 ip ospf transmit-delay '45'"]</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'", "set interfaces bonding bond2 ip ospf bandwidth '70'", "set interfaces bonding bond2 ip ospf transmit-delay '45'"]</div> + </td> + </tr> + </table> + <br/><br/> + Status ------ diff --git a/docs/vyos.vyos.vyos_ospfv2_module.rst b/docs/vyos.vyos.vyos_ospfv2_module.rst index a3270ed..38e7e5e 100644 --- a/docs/vyos.vyos.vyos_ospfv2_module.rst +++ b/docs/vyos.vyos.vyos_ospfv2_module.rst @@ -1641,7 +1641,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8 - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -1668,54 +1668,54 @@ Examples administrative: true on_shutdown: 10 on_startup: 10 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: ingress - mpls_te: - enabled: true - router_address: 192.0.11.11 - auto_cost: - reference_bandwidth: 2 - neighbor: - - neighbor_id: 192.0.11.12 - poll_interval: 10 - priority: 2 - redistribute: - - route_type: bgp - metric: 10 - metric_type: 2 - passive_interface: - - eth1 - - eth2 - parameters: - router_id: 192.0.1.1 - opaque_lsa: true - rfc1583_compatibility: true - abr_type: cisco - areas: - - area_id: '2' - area_type: - normal: true - authentication: plaintext-password - shortcut: enable - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: 192.0.2.0/24 - range: - - address: 192.0.3.0/24 - cost: 10 - - address: 192.0.4.0/24 - cost: 12 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: ingress + mpls_te: + enabled: true + router_address: 192.0.11.11 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + passive_interface: + - eth1 + - eth2 + parameters: + router_id: 192.0.1.1 + opaque_lsa: true + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: 2 + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: 3 + area_type: + nssa: + set: true + - area_id: 4 + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + range: + - address: 192.0.3.0/24 + cost: 10 + - address: 192.0.4.0/24 + cost: 12 state: merged # # @@ -2199,52 +2199,51 @@ Examples administrative: true on_shutdown: 10 on_startup: 10 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: ingress - mpls_te: - enabled: true - router_address: 192.0.22.22 - auto_cost: - reference_bandwidth: 2 - neighbor: - - neighbor_id: 192.0.11.12 - poll_interval: 10 - priority: 2 - redistribute: - - route_type: bgp - metric: 10 - metric_type: 2 - passive_interface: - - eth1 - parameters: - router_id: 192.0.1.1 - opaque_lsa: true - rfc1583_compatibility: true - abr_type: cisco - areas: - - area_id: '2' - area_type: - normal: true - authentication: plaintext-password - shortcut: enable - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: 192.0.2.0/24 - - address: 192.0.12.0/24 - - address: 192.0.22.0/24 - - address: 192.0.32.0/24 - range: - - address: 192.0.42.0/24 - cost: 10 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: ingress + mpls_te: + enabled: true + router_address: 192.0.22.22 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + passive_interface: + - 'eth1' + parameters: + router_id: 192.0.1.1 + opaque_lsa: true + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: 2 + area_type: + normal: true + authentication: "plaintext-password" + shortcut: 'enable' + - area_id: 4 + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + - address: 192.0.12.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 + range: + - address: 1.1.2.0/24 + cost: 10 state: replaced - # # # ------------------------- @@ -2351,8 +2350,8 @@ Examples # "delete protocols ospf area 4 range 192.0.4.0/24 cost", # "delete protocols ospf area 4 range 192.0.4.0/24", # "set protocols ospf mpls-te router-address '192.0.22.22'", - # "set protocols ospf area 4 range 192.0.42.0/24 cost 10", - # "set protocols ospf area 4 range 192.0.42.0/24", + # "set protocols ospf area 4 range 1.1.2.0/24 cost 10", + # "set protocols ospf area 4 range 1.1.2.0/24", # "set protocols ospf area 4 network 192.0.12.0/24", # "set protocols ospf area 4 network 192.0.22.0/24", # "set protocols ospf area 4 network 192.0.32.0/24" @@ -2392,7 +2391,7 @@ Examples # ], # "range": [ # { - # "address": "192.0.42.0/24", + # "address": "1.1.2.0/24", # "cost": 10 # } # ] @@ -2458,7 +2457,7 @@ Examples # set protocols ospf area 4 network '192.0.12.0/24' # set protocols ospf area 4 network '192.0.22.0/24' # set protocols ospf area 4 network '192.0.32.0/24' - # set protocols ospf area 4 range 192.0.42.0/24 cost '10' + # set protocols ospf area 4 range 1.1.2.0/24 cost '10' # set protocols ospf auto-cost reference-bandwidth '2' # set protocols ospf default-information originate 'always' # set protocols ospf default-information originate metric '10' @@ -2493,54 +2492,54 @@ Examples administrative: true on_shutdown: 10 on_startup: 10 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: ingress - mpls_te: - enabled: true - router_address: 192.0.11.11 - auto_cost: - reference_bandwidth: 2 - neighbor: - - neighbor_id: 192.0.11.12 - poll_interval: 10 - priority: 2 - redistribute: - - route_type: bgp - metric: 10 - metric_type: 2 - passive_interface: - - eth1 - - eth2 - parameters: - router_id: 192.0.1.1 - opaque_lsa: true - rfc1583_compatibility: true - abr_type: cisco - areas: - - area_id: '2' - area_type: - normal: true - authentication: plaintext-password - shortcut: enable - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: 192.0.2.0/24 - range: - - address: 192.0.3.0/24 - cost: 10 - - address: 192.0.4.0/24 - cost: 12 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: ingress + mpls_te: + enabled: true + router_address: 192.0.11.11 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + passive_interface: + - 'eth1' + - 'eth2' + parameters: + router_id: 192.0.1.1 + opaque_lsa: true + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: 2 + area_type: + normal: true + authentication: "plaintext-password" + shortcut: enable + - area_id: 3 + area_type: + nssa: + set: true + - area_id: 4 + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + range: + - address: 192.0.3.0/24 + cost: 10 + - address: 192.0.4.0/24 + cost: 12 state: rendered # # @@ -2550,7 +2549,6 @@ Examples # # # "rendered": [ - # [ # "set protocols ospf mpls-te enable", # "set protocols ospf mpls-te router-address '192.0.11.11'", # "set protocols ospf redistribute bgp", @@ -2593,38 +2591,38 @@ Examples # Using parsed # # - - name: Parse the commands for provided structured configuration + - name: Parse the commands for provided configuration vyos.vyos.vyos_ospfv2: - running_config: - "set protocols ospf area 2 area-type 'normal' - set protocols ospf area 2 authentication 'plaintext-password' - set protocols ospf area 2 shortcut 'enable' - set protocols ospf area 3 area-type 'nssa' - set protocols ospf area 4 area-type stub default-cost '20' - set protocols ospf area 4 network '192.0.2.0/24' - set protocols ospf area 4 range 192.0.3.0/24 cost '10' - set protocols ospf area 4 range 192.0.4.0/24 cost '12' - set protocols ospf auto-cost reference-bandwidth '2' - set protocols ospf default-information originate 'always' - set protocols ospf default-information originate metric '10' - set protocols ospf default-information originate metric-type '2' - set protocols ospf default-information originate route-map 'ingress' - set protocols ospf log-adjacency-changes 'detail' - set protocols ospf max-metric router-lsa 'administrative' - set protocols ospf max-metric router-lsa on-shutdown '10' - set protocols ospf max-metric router-lsa on-startup '10' - set protocols ospf mpls-te 'enable' - set protocols ospf mpls-te router-address '192.0.11.11' - set protocols ospf neighbor 192.0.11.12 poll-interval '10' - set protocols ospf neighbor 192.0.11.12 priority '2' - set protocols ospf parameters abr-type 'cisco' - set protocols ospf parameters 'opaque-lsa' - set protocols ospf parameters 'rfc1583-compatibility' - set protocols ospf parameters router-id '192.0.1.1' - set protocols ospf passive-interface 'eth1' - set protocols ospf passive-interface 'eth2' - set protocols ospf redistribute bgp metric '10' - set protocols ospf redistribute bgp metric-type '2'" + running_config: | + set protocols ospf area 2 area-type 'normal' + set protocols ospf area 2 authentication 'plaintext-password' + set protocols ospf area 2 shortcut 'enable' + set protocols ospf area 3 area-type 'nssa' + set protocols ospf area 4 area-type stub default-cost '20' + set protocols ospf area 4 network '192.0.2.0/24' + set protocols ospf area 4 range 192.0.3.0/24 cost '10' + set protocols ospf area 4 range 192.0.4.0/24 cost '12' + set protocols ospf auto-cost reference-bandwidth '2' + set protocols ospf default-information originate 'always' + set protocols ospf default-information originate metric '10' + set protocols ospf default-information originate metric-type '2' + set protocols ospf default-information originate route-map 'ingress' + set protocols ospf log-adjacency-changes 'detail' + set protocols ospf max-metric router-lsa 'administrative' + set protocols ospf max-metric router-lsa on-shutdown '10' + set protocols ospf max-metric router-lsa on-startup '10' + set protocols ospf mpls-te 'enable' + set protocols ospf mpls-te router-address '192.0.11.11' + set protocols ospf neighbor 192.0.11.12 poll-interval '10' + set protocols ospf neighbor 192.0.11.12 priority '2' + set protocols ospf parameters abr-type 'cisco' + set protocols ospf parameters 'opaque-lsa' + set protocols ospf parameters 'rfc1583-compatibility' + set protocols ospf parameters router-id '192.0.1.1' + set protocols ospf passive-interface 'eth1' + set protocols ospf passive-interface 'eth2' + set protocols ospf redistribute bgp metric '10' + set protocols ospf redistribute bgp metric-type '2' state: parsed # # @@ -3045,7 +3043,6 @@ Examples # After state # ------------ # vyos@192# run show configuration commands | grep ospf - # diff --git a/docs/vyos.vyos.vyos_ospfv3_module.rst b/docs/vyos.vyos.vyos_ospfv3_module.rst index eb06234..2bc2f50 100644 --- a/docs/vyos.vyos.vyos_ospfv3_module.rst +++ b/docs/vyos.vyos.vyos_ospfv3_module.rst @@ -5,7 +5,7 @@ vyos.vyos.vyos_ospfv3 ********************* -**OSPFV3 resource module** +**OSPFv3 resource module** Version added: 1.0.0 @@ -340,7 +340,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8 - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -366,18 +366,18 @@ Examples parameters: router_id: 192.0.2.10 areas: - - area_id: '2' + - area_id: 2 export_list: export1 import_list: import1 + range: - address: '2001:db10::/32' - address: '2001:db20::/32' - address: '2001:db30::/32' - - area_id: '3' + - area_id: 3 range: - address: '2001:db40::/32' state: merged - # # # ------------------------- @@ -473,18 +473,18 @@ Examples parameters: router_id: 192.0.2.10 areas: - - area_id: '2' + - area_id: 2 export_list: export1 import_list: import1 + range: - address: '2001:db10::/32' - address: '2001:db30::/32' - address: '2001:db50::/32' - - area_id: '4' + - area_id: 4 range: - address: '2001:db60::/32' state: replaced - # # # ------------------------- @@ -598,18 +598,18 @@ Examples parameters: router_id: 192.0.2.10 areas: - - area_id: '2' + - area_id: 2 export_list: export1 import_list: import1 + range: - address: '2001:db10::/32' - address: '2001:db20::/32' - address: '2001:db30::/32' - - area_id: '3' + - area_id: 3 range: - address: '2001:db40::/32' state: rendered - # # # ------------------------- @@ -635,17 +635,17 @@ Examples # Using parsed # # - - name: Parse the commands to provide structured configuration. + - name: Parse the commands from the provided configuration vyos.vyos.vyos_ospfv3: - running_config: - "set protocols ospfv3 area 2 export-list 'export1' - set protocols ospfv3 area 2 import-list 'import1' - set protocols ospfv3 area 2 range '2001:db10::/32' - set protocols ospfv3 area 2 range '2001:db20::/32' - set protocols ospfv3 area 2 range '2001:db30::/32' - set protocols ospfv3 area 3 range '2001:db40::/32' - set protocols ospfv3 parameters router-id '192.0.2.10' - set protocols ospfv3 redistribute 'bgp'" + running_config: | + set protocols ospfv3 area 2 export-list 'export1' + set protocols ospfv3 area 2 import-list 'import1' + set protocols ospfv3 area 2 range '2001:db10::/32' + set protocols ospfv3 area 2 range '2001:db20::/32' + set protocols ospfv3 area 2 range '2001:db30::/32' + set protocols ospfv3 area 3 range '2001:db40::/32' + set protocols ospfv3 parameters router-id '192.0.2.10' + set protocols ospfv3 redistribute 'bgp' state: parsed # # @@ -902,7 +902,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The set of commands pushed to the remote device.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set protocols ospf parameters router-id 192.0.1.1', "set protocols ospfv3 area 2 range '2001:db10::/32'"]</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set protocols ospfv3 parameters router-id '192.0.2.10'", "set protocols ospfv3 redistribute 'bgp'"]</div> </td> </tr> </table> diff --git a/docs/vyos.vyos.vyos_prefix_lists_module.rst b/docs/vyos.vyos.vyos_prefix_lists_module.rst index 965b890..cd74a60 100644 --- a/docs/vyos.vyos.vyos_prefix_lists_module.rst +++ b/docs/vyos.vyos.vyos_prefix_lists_module.rst @@ -1481,12 +1481,12 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>after</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> <td>when changed</td> <td> - <div>The resulting configuration after the module invocation.</div> + <div>The resulting configuration after module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> @@ -1498,12 +1498,12 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>before</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> - <td>when state is <em>merged</em>, <em>replaced</em>, <em>overridden</em> or <em>deleted</em></td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> - <div>The configuration prior to the module invocation.</div> + <div>The configuration prior to the module execution.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> @@ -1518,9 +1518,9 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>merged</em>, <em>replaced</em>, <em>overridden</em> or <em>deleted</em></td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> <td> - <div>The set of commands pushed to the remote device for the required configurations to take place.</div> + <div>The set of commands pushed to the remote device.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'", "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'", "set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'"]</div> @@ -1535,7 +1535,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>gathered</em></td> + <td>when <em>state</em> is <code>gathered</code></td> <td> <div>Facts about the network resource gathered from the remote device as structured data.</div> <br/> @@ -1552,7 +1552,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>parsed</em></td> + <td>when <em>state</em> is <code>parsed</code></td> <td> <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> <br/> @@ -1569,7 +1569,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <span style="color: purple">list</span> </div> </td> - <td>when state is <em>rendered</em></td> + <td>when <em>state</em> is <code>rendered</code></td> <td> <div>The provided configuration in the task rendered in device-native format (offline).</div> <br/> diff --git a/docs/vyos.vyos.vyos_route_maps_module.rst b/docs/vyos.vyos.vyos_route_maps_module.rst index 3135b60..4e0c532 100644 --- a/docs/vyos.vyos.vyos_route_maps_module.rst +++ b/docs/vyos.vyos.vyos_route_maps_module.rst @@ -5,10 +5,10 @@ vyos.vyos.vyos_route_maps ************************* -**Route Map Resource Module.** +**Route Map resource module** -Version added: 2.3.0 +Version added: 1.0.0 .. contents:: :local: @@ -1363,7 +1363,7 @@ Notes ----- .. note:: - - Tested against vyos 1.2. + - Tested against vyos 1.3.8 - This module works with connection ``network_cli``. @@ -2030,6 +2030,123 @@ Examples +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when changed</td> + <td> + <div>The resulting configuration after module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The configuration prior to the module execution.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td> + <td> + <div>The set of commands pushed to the remote device.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set policy route-map test3 rule 1 set local-preference 6', 'set policy route-map test3 rule 1 set metric 4', 'set policy route-map test3 rule 1 set tag 4']</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>gathered</code></td> + <td> + <div>Facts about the network resource gathered from the remote device as structured data.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>parsed</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>parsed</code></td> + <td> + <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>rendered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when <em>state</em> is <code>rendered</code></td> + <td> + <div>The provided configuration in the task rendered in device-native format (offline).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set policy route-map test3 rule 1 set local-preference 6', 'set policy route-map test3 rule 1 set metric 4', 'set policy route-map test3 rule 1 set tag 4']</div> + </td> + </tr> + </table> + <br/><br/> + Status ------ diff --git a/docs/vyos.vyos.vyos_snmp_server_module.rst b/docs/vyos.vyos.vyos_snmp_server_module.rst index 325f413..9e15b8f 100644 --- a/docs/vyos.vyos.vyos_snmp_server_module.rst +++ b/docs/vyos.vyos.vyos_snmp_server_module.rst @@ -8,7 +8,7 @@ vyos.vyos.vyos_snmp_server **Manages snmp_server resource module** -Version added: 2.7.0 +Version added: 1.0.0 .. contents:: :local: @@ -1218,7 +1218,7 @@ Notes ----- .. note:: - - Tested against vyos 1.1.8 + - Tested against vyos 1.3.8 - This module works with connection ``network_cli``. - The Configuration defaults of the Vyos network devices are supposed to hinder idempotent behavior of plays @@ -2065,7 +2065,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The set of commands pushed to the remote device.</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">set service snmp community routers authorization 'ro' set service snmp community routers client '203.0.113.10' set service snmp community routers client '203.0.113.20' set service snmp community routers network '192.0.2.0/24'</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set service snmp community routers authorization 'ro'", "set service snmp community routers client '203.0.113.10'", "set service snmp community routers network '192.0.2.0/24'"]</div> </td> </tr> <tr> @@ -2116,7 +2116,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The provided configuration in the task rendered in device-native format (offline).</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">set service snmp community routers authorization 'ro' set service snmp community routers client '203.0.113.10' set service snmp community routers client '203.0.113.20' set service snmp community routers network '192.0.2.0/24'</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">["set service snmp community routers authorization 'ro'", "set service snmp community routers client '203.0.113.10'", "set service snmp community routers network '192.0.2.0/24'"]</div> </td> </tr> </table> diff --git a/docs/vyos.vyos.vyos_static_routes_module.rst b/docs/vyos.vyos.vyos_static_routes_module.rst index 4207add..0c378ff 100644 --- a/docs/vyos.vyos.vyos_static_routes_module.rst +++ b/docs/vyos.vyos.vyos_static_routes_module.rst @@ -335,7 +335,7 @@ Notes ----- .. note:: - - Tested against VyOS 1.1.8 (helium). + - Tested against VyOS 1.3.8. - This module works with connection ``ansible.netcommon.network_cli``. See `the VyOS OS Platform Options <../network/user_guide/platform_vyos.html>`_. @@ -374,7 +374,6 @@ Examples - forward_router_address: '2001:db8:2000:2::1' - forward_router_address: '2001:db8:2000:2::2' state: merged - # # # ------------------------- @@ -919,12 +918,12 @@ Examples - address_families: - afi: ipv6 routes: - - dest: 2001:db8:1000::/36 + - dest: '2001:db8:1000::/36' blackhole_config: distance: 2 next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 + - forward_router_address: '2001:db8:2000:2::1' + - forward_router_address: '2001:db8:2000:2::2' state: rendered # # @@ -950,13 +949,13 @@ Examples # - name: Parse the provided running configuration vyos.vyos.vyos_static_routes: - running_config: - "set protocols static route 192.0.2.32/28 'blackhole' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.6' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.7' - set protocols static route6 2001:db8:1000::/36 blackhole distance '2' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'" + running_config: | + set protocols static route 192.0.2.32/28 'blackhole' + set protocols static route 192.0.2.32/28 next-hop '192.0.2.6' + set protocols static route 192.0.2.32/28 next-hop '192.0.2.7' + set protocols static route6 2001:db8:1000::/36 blackhole distance '2' + set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' + set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2' state: parsed # # @@ -1105,7 +1104,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>after</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> <td>when changed</td> @@ -1123,7 +1122,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <b>before</b> <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> <div style="font-size: small"> - <span style="color: purple">list</span> + <span style="color: purple">dictionary</span> </div> </td> <td>always</td> diff --git a/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py b/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py index 9868fc6..13f9fab 100644 --- a/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py +++ b/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -12,17 +12,14 @@ __metaclass__ = type # WARNING # ############################################# # -# This file is auto generated by the resource -# module builder playbook. +# This file is auto generated by the +# cli_rm_builder. # -# Do not edit this file manually. +# Manually editing this file is not advised. # -# Changes to this file will be over written -# by the resource module builder. -# -# Changes should be made in the model used to -# generate this file or in the resource module -# builder template. +# To update the argspec make the desired changes +# in the module docstring and re-run +# cli_rm_builder. # ############################################# @@ -34,56 +31,95 @@ The arg spec for the vyos_bgp_address_family module class Bgp_address_familyArgs(object): # pylint: disable=R0903 """The arg spec for the vyos_bgp_address_family module""" - def __init__(self, **kwargs): - pass - argument_spec = { - "running_config": {}, - "state": { - "default": "merged", - "type": "str", - "choices": [ - "merged", - "replaced", - "deleted", - "gathered", - "parsed", - "rendered", - "purged", - "overridden", - ], - }, "config": { "type": "dict", "options": { - "neighbors": { + "as_number": {"type": "int"}, + "address_family": { + "type": "list", "elements": "dict", + "options": { + "afi": {"type": "str", "choices": ["ipv4", "ipv6"]}, + "aggregate_address": { + "type": "list", + "elements": "dict", + "options": { + "prefix": {"type": "str"}, + "as_set": {"type": "bool"}, + "summary_only": {"type": "bool"}, + }, + }, + "networks": { + "type": "list", + "elements": "dict", + "options": { + "prefix": {"type": "str"}, + "path_limit": {"type": "int"}, + "backdoor": {"type": "bool"}, + "route_map": {"type": "str"}, + }, + }, + "redistribute": { + "type": "list", + "elements": "dict", + "options": { + "protocol": { + "type": "str", + "choices": [ + "connected", + "kernel", + "ospf", + "ospfv3", + "rip", + "ripng", + "static", + ], + }, + "table": {"type": "str"}, + "route_map": {"type": "str"}, + "metric": {"type": "int"}, + }, + }, + }, + }, + "neighbors": { "type": "list", + "elements": "dict", "options": { + "neighbor_address": {"type": "str"}, "address_family": { - "elements": "dict", "type": "list", + "elements": "dict", "options": { - "nexthop_local": {"type": "bool"}, - "soft_reconfiguration": {"type": "bool"}, - "unsupress_map": {"type": "str"}, - "nexthop_self": {"type": "bool"}, - "weight": {"type": "int"}, - "prefix_list": { - "elements": "dict", - "type": "list", + "afi": { + "type": "str", + "choices": ["ipv4", "ipv6"], + }, + "allowas_in": {"type": "int"}, + "as_override": {"type": "bool"}, + "attribute_unchanged": { + "type": "dict", "options": { - "action": { + "as_path": {"type": "bool"}, + "med": {"type": "bool"}, + "next_hop": {"type": "bool"}, + }, + }, + "capability": { + "type": "dict", + "options": { + "dynamic": {"type": "bool"}, + "orf": { "type": "str", - "choices": ["export", "import"], + "choices": ["send", "receive"], }, - "prefix_list": {"type": "str"}, }, }, "default_originate": {"type": "str"}, "distribute_list": { - "elements": "dict", "type": "list", + "elements": "dict", "options": { "action": { "type": "str", @@ -92,10 +128,9 @@ class Bgp_address_familyArgs(object): # pylint: disable=R0903 "acl": {"type": "int"}, }, }, - "allowas_in": {"type": "int"}, "filter_list": { - "elements": "dict", "type": "list", + "elements": "dict", "options": { "action": { "type": "str", @@ -104,98 +139,57 @@ class Bgp_address_familyArgs(object): # pylint: disable=R0903 "path_list": {"type": "str"}, }, }, - "route_server_client": {"type": "bool"}, - "attribute_unchanged": { - "type": "dict", - "options": { - "as_path": {"type": "bool"}, - "med": {"type": "bool"}, - "next_hop": {"type": "bool"}, - }, - }, - "peer_group": {"type": "str"}, "maximum_prefix": {"type": "int"}, - "route_reflector_client": {"type": "bool"}, - "route_map": { - "elements": "dict", + "nexthop_local": {"type": "bool"}, + "nexthop_self": {"type": "bool"}, + "peer_group": {"type": "str"}, + "prefix_list": { "type": "list", + "elements": "dict", "options": { "action": { "type": "str", "choices": ["export", "import"], }, - "route_map": {"type": "str"}, + "prefix_list": {"type": "str"}, }, }, - "capability": { - "type": "dict", + "remove_private_as": {"type": "bool"}, + "route_map": { + "type": "list", + "elements": "dict", "options": { - "orf": { + "action": { "type": "str", - "choices": ["send", "receive"], + "choices": ["export", "import"], }, - "dynamic": {"type": "bool"}, + "route_map": {"type": "str"}, }, }, - "remove_private_as": {"type": "bool"}, - "as_override": {"type": "bool"}, - "afi": { - "type": "str", - "choices": ["ipv4", "ipv6"], - }, - }, - }, - "neighbor_address": {"type": "str"}, - }, - }, - "as_number": {"type": "int"}, - "address_family": { - "elements": "dict", - "type": "list", - "options": { - "afi": {"type": "str", "choices": ["ipv4", "ipv6"]}, - "redistribute": { - "elements": "dict", - "type": "list", - "options": { - "table": {"type": "str"}, - "metric": {"type": "int"}, - "protocol": { - "type": "str", - "choices": [ - "connected", - "kernel", - "ospf", - "ospfv3", - "rip", - "ripng", - "static", - ], - }, - "route_map": {"type": "str"}, - }, - }, - "networks": { - "elements": "dict", - "type": "list", - "options": { - "backdoor": {"type": "bool"}, - "prefix": {"type": "str"}, - "path_limit": {"type": "int"}, - "route_map": {"type": "str"}, - }, - }, - "aggregate_address": { - "elements": "dict", - "type": "list", - "options": { - "summary_only": {"type": "bool"}, - "prefix": {"type": "str"}, - "as_set": {"type": "bool"}, + "route_reflector_client": {"type": "bool"}, + "route_server_client": {"type": "bool"}, + "soft_reconfiguration": {"type": "bool"}, + "unsupress_map": {"type": "str"}, + "weight": {"type": "int"}, }, }, }, }, }, }, + "running_config": {"type": "str"}, + "state": { + "type": "str", + "choices": [ + "merged", + "replaced", + "deleted", + "gathered", + "parsed", + "rendered", + "purged", + "overridden", + ], + "default": "merged", + }, } # pylint: disable=C0301 diff --git a/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py b/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py index 22af639..b647ea9 100644 --- a/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py +++ b/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -12,17 +12,14 @@ __metaclass__ = type # WARNING # ############################################# # -# This file is auto generated by the resource -# module builder playbook. +# This file is auto generated by the +# cli_rm_builder. # -# Do not edit this file manually. +# Manually editing this file is not advised. # -# Changes to this file will be over written -# by the resource module builder. -# -# Changes should be made in the model used to -# generate this file or in the resource module -# builder template. +# To update the argspec make the desired changes +# in the module docstring and re-run +# cli_rm_builder. # ############################################# @@ -34,109 +31,62 @@ The arg spec for the vyos_bgp_global module class Bgp_globalArgs(object): # pylint: disable=R0903 """The arg spec for the vyos_bgp_global module""" - def __init__(self, **kwargs): - pass - argument_spec = { - "running_config": {"type": "str"}, - "state": { - "default": "merged", - "type": "str", - "choices": [ - "merged", - "replaced", - "deleted", - "gathered", - "parsed", - "rendered", - "purged", - ], - }, "config": { "type": "dict", "options": { - "redistribute": { - "elements": "dict", + "as_number": {"type": "int"}, + "aggregate_address": { "type": "list", - "options": { - "route_map": {"type": "str"}, - "metric": {"type": "int"}, - "protocol": { - "type": "str", - "choices": [ - "connected", - "kernel", - "ospf", - "rip", - "static", - ], - }, - }, - }, - "network": { "elements": "dict", - "type": "list", "options": { - "backdoor": {"type": "bool"}, - "route_map": {"type": "str"}, - "address": {"type": "str"}, + "prefix": {"type": "str"}, + "as_set": {"type": "bool"}, + "summary_only": {"type": "bool"}, }, }, "maximum_paths": { "type": "list", "elements": "dict", - "options": { - "path": {"type": "str"}, - "count": {"type": "int"}, - }, - }, - "aggregate_address": { - "elements": "dict", - "type": "list", - "options": { - "summary_only": {"type": "bool"}, - "as_set": {"type": "bool"}, - "prefix": {"type": "str"}, - }, - }, - "timers": { - "type": "dict", - "options": { - "holdtime": {"type": "int"}, - "keepalive": {"type": "int"}, - }, + "options": {"path": {"type": "str"}, "count": {"type": "int"}}, }, "neighbor": { "type": "list", "elements": "dict", "options": { - "shutdown": {"type": "bool"}, - "weight": {"type": "int"}, - "default_originate": {"type": "str"}, - "peer_group_name": {"type": "str"}, - "route_reflector_client": {"type": "bool"}, - "strict_capability_match": {"type": "bool"}, - "remove_private_as": {"type": "bool"}, + "address": {"type": "str"}, + "advertisement_interval": {"type": "int"}, + "allowas_in": {"type": "int"}, "as_override": {"type": "bool"}, - "port": {"type": "int"}, - "soft_reconfiguration": {"type": "bool"}, - "nexthop_self": {"type": "bool"}, - "remote_as": {"type": "int"}, - "ebgp_multihop": {"type": "int"}, - "route_map": { - "elements": "dict", - "type": "list", + "attribute_unchanged": { + "type": "dict", "options": { - "action": { + "as_path": {"type": "bool"}, + "med": {"type": "bool"}, + "next_hop": {"type": "bool"}, + }, + }, + "capability": { + "type": "dict", + "options": { + "dynamic": {"type": "bool"}, + "orf": { "type": "str", - "choices": ["export", "import"], + "choices": ["send", "receive"], }, - "route_map": {"type": "str"}, }, }, + "default_originate": {"type": "str"}, + "description": {"type": "str"}, + "disable_capability_negotiation": {"type": "bool"}, + "disable_connected_check": {"type": "bool"}, + "disable_send_community": { + "type": "str", + "choices": ["extended", "standard"], + }, "distribute_list": { - "elements": "dict", "type": "list", + "elements": "dict", "options": { "action": { "type": "str", @@ -145,124 +95,140 @@ class Bgp_globalArgs(object): # pylint: disable=R0903 "acl": {"type": "int"}, }, }, - "allowas_in": {"type": "int"}, - "passive": {"type": "bool"}, - "ttl_security": {"type": "int"}, - "peer_group": {"type": "bool"}, - "maximum_prefix": {"type": "int"}, - "prefix_list": { - "elements": "dict", + "ebgp_multihop": {"type": "int"}, + "filter_list": { "type": "list", + "elements": "dict", "options": { "action": { "type": "str", "choices": ["export", "import"], }, - "prefix_list": {"type": "str"}, + "path_list": {"type": "str"}, }, }, - "update_source": {"type": "str"}, - "description": {"type": "str"}, "local_as": {"type": "int"}, - "route_server_client": {"type": "bool"}, - "attribute_unchanged": { - "type": "dict", - "options": { - "as_path": {"type": "bool"}, - "med": {"type": "bool"}, - "next_hop": {"type": "bool"}, - }, - }, - "disable_connected_check": {"type": "bool"}, - "address": {"type": "str"}, - "password": {"type": "str", "no_log": True}, - "disable_send_community": { - "type": "str", - "choices": ["extended", "standard"], - }, - "unsuppress_map": {"type": "str"}, + "maximum_prefix": {"type": "int"}, + "nexthop_self": {"type": "bool"}, "override_capability": {"type": "bool"}, - "filter_list": { - "elements": "dict", + "passive": {"type": "bool"}, + "password": {"type": "str", "no_log": True}, + "peer_group_name": {"type": "str"}, + "peer_group": {"type": "bool"}, + "port": {"type": "int"}, + "prefix_list": { "type": "list", + "elements": "dict", "options": { "action": { "type": "str", "choices": ["export", "import"], }, - "path_list": {"type": "str"}, + "prefix_list": {"type": "str"}, }, }, - "capability": { - "type": "dict", + "remote_as": {"type": "int"}, + "remove_private_as": {"type": "bool"}, + "route_map": { + "type": "list", + "elements": "dict", "options": { - "orf": { + "action": { "type": "str", - "choices": ["send", "receive"], + "choices": ["export", "import"], }, - "dynamic": {"type": "bool"}, + "route_map": {"type": "str"}, }, }, + "route_reflector_client": {"type": "bool"}, + "route_server_client": {"type": "bool"}, + "shutdown": {"type": "bool"}, + "soft_reconfiguration": {"type": "bool"}, + "strict_capability_match": {"type": "bool"}, + "unsuppress_map": {"type": "str"}, + "update_source": {"type": "str"}, + "weight": {"type": "int"}, + "ttl_security": {"type": "int"}, "timers": { "type": "dict", "options": { - "holdtime": {"type": "int"}, "connect": {"type": "int"}, + "holdtime": {"type": "int"}, "keepalive": {"type": "int"}, }, }, - "disable_capability_negotiation": {"type": "bool"}, - "advertisement_interval": {"type": "int"}, + }, + }, + "network": { + "type": "list", + "elements": "dict", + "options": { + "address": {"type": "str"}, + "backdoor": {"type": "bool"}, + "route_map": {"type": "str"}, + }, + }, + "redistribute": { + "type": "list", + "elements": "dict", + "options": { + "protocol": { + "type": "str", + "choices": [ + "connected", + "kernel", + "ospf", + "rip", + "static", + ], + }, + "route_map": {"type": "str"}, + "metric": {"type": "int"}, + }, + }, + "timers": { + "type": "dict", + "options": { + "keepalive": {"type": "int"}, + "holdtime": {"type": "int"}, }, }, "bgp_params": { "type": "dict", "options": { - "router_id": {"type": "str"}, - "distance": { - "elements": "dict", - "type": "list", + "always_compare_med": {"type": "bool"}, + "bestpath": { + "type": "dict", "options": { - "prefix": {"type": "int"}, - "type": { + "as_path": { "type": "str", - "choices": [ - "external", - "internal", - "local", - ], + "choices": ["confed", "ignore"], }, - "value": {"type": "int"}, + "compare_routerid": {"type": "bool"}, + "med": { + "type": "str", + "choices": ["confed", "missing-as-worst"], + }, + }, + }, + "cluster_id": {"type": "str"}, + "confederation": { + "type": "list", + "elements": "dict", + "options": { + "identifier": {"type": "int"}, + "peers": {"type": "int"}, }, }, "dampening": { "type": "dict", "options": { "half_life": {"type": "int"}, - "start_suppress_time": {"type": "int"}, "max_suppress_time": {"type": "int"}, "re_use": {"type": "int"}, + "start_suppress_time": {"type": "int"}, }, }, - "graceful_restart": {"type": "int"}, - "scan_time": {"type": "int"}, - "always_compare_med": {"type": "bool"}, - "no_fast_external_failover": {"type": "bool"}, - "bestpath": { - "type": "dict", - "options": { - "med": { - "type": "str", - "choices": ["confed", "missing-as-worst"], - }, - "as_path": { - "type": "str", - "choices": ["confed", "ignore"], - }, - "compare_routerid": {"type": "bool"}, - }, - }, - "enforce_first_as": {"type": "bool"}, "default": { "type": "dict", "options": { @@ -270,22 +236,43 @@ class Bgp_globalArgs(object): # pylint: disable=R0903 "no_ipv4_unicast": {"type": "bool"}, }, }, - "cluster_id": {"type": "str"}, - "no_client_to_client_reflection": {"type": "bool"}, "deterministic_med": {"type": "bool"}, - "log_neighbor_changes": {"type": "bool"}, "disable_network_import_check": {"type": "bool"}, - "confederation": { + "distance": { "type": "list", "elements": "dict", "options": { - "peers": {"type": "int"}, - "identifier": {"type": "int"}, + "type": { + "type": "str", + "choices": ["external", "internal", "local"], + }, + "value": {"type": "int"}, + "prefix": {"type": "int"}, }, }, + "enforce_first_as": {"type": "bool"}, + "graceful_restart": {"type": "int"}, + "log_neighbor_changes": {"type": "bool"}, + "no_client_to_client_reflection": {"type": "bool"}, + "no_fast_external_failover": {"type": "bool"}, + "router_id": {"type": "str"}, + "scan_time": {"type": "int"}, }, }, - "as_number": {"type": "int"}, }, }, + "state": { + "type": "str", + "choices": [ + "deleted", + "merged", + "purged", + "replaced", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + }, + "running_config": {"type": "str"}, } # pylint: disable=C0301 diff --git a/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py index f79454e..8421b6d 100644 --- a/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py +++ b/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py @@ -25,6 +25,7 @@ The arg spec for the vyos_firewall_global module """ + from __future__ import absolute_import, division, print_function @@ -47,7 +48,10 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "afi": { - "choices": ["ipv4", "ipv6"], + "choices": [ + "ipv4", + "ipv6", + ], "default": "ipv4", "type": "str", }, @@ -57,7 +61,10 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "options": {"address": {"type": "str"}}, "type": "list", }, - "name": {"required": True, "type": "str"}, + "name": { + "required": True, + "type": "str", + }, }, "type": "list", }, @@ -65,7 +72,10 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "afi": { - "choices": ["ipv4", "ipv6"], + "choices": [ + "ipv4", + "ipv6", + ], "default": "ipv4", "type": "str", }, @@ -75,7 +85,10 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "options": {"address": {"type": "str"}}, "type": "list", }, - "name": {"required": True, "type": "str"}, + "name": { + "required": True, + "type": "str", + }, }, "type": "list", }, @@ -88,7 +101,10 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "options": {"port": {"type": "str"}}, "type": "list", }, - "name": {"required": True, "type": "str"}, + "name": { + "required": True, + "type": "str", + }, }, "type": "list", }, @@ -107,7 +123,10 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "afi": { - "choices": ["ipv4", "ipv6"], + "choices": [ + "ipv4", + "ipv6", + ], "required": True, "type": "str", }, @@ -126,24 +145,46 @@ class Firewall_globalArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "action": { - "choices": ["accept", "drop", "reject"], + "choices": [ + "accept", + "drop", + "reject", + ], "type": "str", }, "connection_type": { - "choices": ["established", "invalid", "related"], + "choices": [ + "established", + "invalid", + "related", + ], "type": "str", }, "log": {"type": "bool"}, "log_level": { - "choices": ["emerg", "alert", "crit", "err", "warn", "notice", "info", "debug"] - } + "choices": [ + "emerg", + "alert", + "crit", + "err", + "warn", + "notice", + "info", + "debug", + ], + "type": "str", + }, }, "type": "list", }, "syn_cookies": {"type": "bool"}, "twa_hazards_protection": {"type": "bool"}, "validation": { - "choices": ["strict", "loose", "disable"], + "choices": [ + "strict", + "loose", + "disable", + ], "type": "str", }, }, diff --git a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py index 4d0973e..74fa9c1 100644 --- a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py +++ b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py @@ -25,6 +25,7 @@ The arg spec for the vyos_firewall_rules module """ + from __future__ import absolute_import, division, print_function @@ -50,15 +51,24 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "default_action": { - "choices": ["drop", "reject", "accept", "jump"], + "choices": [ + "drop", + "reject", + "accept", + "jump", + ], "type": "str", }, "default_jump_target": {"type": "str"}, "description": {"type": "str"}, "enable_default_log": {"type": "bool"}, "filter": { - "choices": ["input", "output", "forward"], - "type": "str" + "choices": [ + "input", + "output", + "forward", + ], + "type": "str", }, "name": {"type": "str"}, "rules": { @@ -95,8 +105,8 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 "type": "dict", }, "disable": { - "type": "bool", "aliases": ["disabled"], + "type": "bool", }, "fragment": { "choices": [ @@ -159,22 +169,23 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 }, "inbound_interface": { "options": { - "group": { - "type": "str", - }, - "name": { - "type": "str", - }, + "group": {"type": "str"}, + "name": {"type": "str"}, }, "type": "dict", }, "ipsec": { - "choices": ["match-ipsec", "match-none", "match-ipsec-in", "match-ipsec-out", "match-none-in", "match-none-out"], - "type": "str" - }, - "jump_target": { - "type": "str" + "choices": [ + "match-ipsec", + "match-none", + "match-ipsec-in", + "match-ipsec-out", + "match-none-in", + "match-none-out", + ], + "type": "str", }, + "jump_target": {"type": "str"}, "limit": { "options": { "burst": {"type": "int"}, @@ -189,18 +200,20 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 "type": "dict", }, "log": { + "choices": [ + "disable", + "enable", + ], "type": "str", - "choices": ["enable", "disable"], }, - "number": {"required": True, "type": "int"}, + "number": { + "required": True, + "type": "int", + }, "outbound_interface": { "options": { - "group": { - "type": "str", - }, - "name": { - "type": "str", - }, + "group": {"type": "str"}, + "name": {"type": "str"}, }, "type": "dict", }, @@ -220,24 +233,16 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 "type": "str", }, }, - "type": "list" + "type": "list", }, "packet_length": { "elements": "dict", - "options": { - "length": { - "type": "str", - }, - }, - "type": "list" + "options": {"length": {"type": "str"}}, + "type": "list", }, "packet_length_exclude": { "elements": "dict", - "options": { - "length": { - "type": "str", - } - }, + "options": {"length": {"type": "str"}}, "type": "list", }, "packet_type": { @@ -245,15 +250,18 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 "broadcast", "multicast", "host", - "other" + "other", ], - "type": "str" + "type": "str", }, "protocol": {"type": "str"}, "queue": {"type": "str"}, "queue_options": { - "choices": ["bypass", "fanout"], - "type": "str" + "choices": [ + "bypass", + "fanout", + ], + "type": "str", }, "recent": { "options": { @@ -312,12 +320,12 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903 "urg", "all", ], - "type": "str" + "type": "str", }, - "invert": {"type": "bool"} + "invert": {"type": "bool"}, }, - "type": "list" - } + "type": "list", + }, }, "type": "dict", }, diff --git a/plugins/module_utils/network/vyos/argspec/hostname/hostname.py b/plugins/module_utils/network/vyos/argspec/hostname/hostname.py index b69f2f1..12864e6 100644 --- a/plugins/module_utils/network/vyos/argspec/hostname/hostname.py +++ b/plugins/module_utils/network/vyos/argspec/hostname/hostname.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) diff --git a/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py b/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py index fecfb48..14b67c2 100644 --- a/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py @@ -1,3 +1,5 @@ +# +# -*- coding: utf-8 -*- # Copyright 2019 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -23,6 +25,7 @@ The arg spec for the vyos_interfaces module """ + from __future__ import absolute_import, division, print_function @@ -40,21 +43,39 @@ class InterfacesArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "description": {"type": "str"}, - "duplex": {"choices": ["full", "half", "auto"]}, - "enabled": {"default": True, "type": "bool"}, + "duplex": { + "choices": ["full", "half", "auto"], + "type": "str", + }, + "enabled": { + "aliases": ["enable"], + "default": True, + "type": "bool", + }, "mtu": {"type": "int"}, "name": {"required": True, "type": "str"}, "speed": { - "choices": ["auto", "10", "100", "1000", "2500", "10000"], + "choices": [ + "auto", + "10", + "100", + "1000", + "2500", + "10000", + ], "type": "str", }, "vifs": { "elements": "dict", "options": { - "vlan_id": {"type": "int"}, "description": {"type": "str"}, - "enabled": {"default": True, "type": "bool"}, + "enabled": { + "aliases": ["enable"], + "default": True, + "type": "bool", + }, "mtu": {"type": "int"}, + "vlan_id": {"type": "int"}, }, "type": "list", }, @@ -69,8 +90,8 @@ class InterfacesArgs(object): # pylint: disable=R0903 "overridden", "deleted", "rendered", - "parsed", "gathered", + "parsed", ], "default": "merged", "type": "str", diff --git a/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py index db33376..4dee518 100644 --- a/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py @@ -25,6 +25,7 @@ The arg spec for the vyos_l3_interfaces module """ + from __future__ import absolute_import, division, print_function diff --git a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py index dce4fb7..956c438 100644 --- a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py @@ -1,3 +1,5 @@ +# +# -*- coding: utf-8 -*- # Copyright 2019 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -22,6 +24,8 @@ """ The arg spec for the vyos_lag_interfaces module """ + + from __future__ import absolute_import, division, print_function @@ -41,12 +45,19 @@ class Lag_interfacesArgs(object): # pylint: disable=R0903 "arp_monitor": { "options": { "interval": {"type": "int"}, - "target": {"type": "list", "elements": "str"}, + "target": { + "elements": "str", + "type": "list", + }, }, "type": "dict", }, "hash_policy": { - "choices": ["layer2", "layer2+3", "layer3+4"], + "choices": [ + "layer2", + "layer2+3", + "layer3+4", + ], "type": "str", }, "members": { @@ -78,9 +89,9 @@ class Lag_interfacesArgs(object): # pylint: disable=R0903 "replaced", "overridden", "deleted", - "rendered", - "gathered", "parsed", + "gathered", + "rendered", ], "default": "merged", "type": "str", diff --git a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py index 734274a..5c33d67 100644 --- a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py +++ b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py @@ -1,3 +1,5 @@ +# +# -*- coding: utf-8 -*- # Copyright 2019 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -22,6 +24,8 @@ """ The arg spec for the vyos_lldp_global module """ + + from __future__ import absolute_import, division, print_function @@ -40,9 +44,14 @@ class Lldp_globalArgs(object): # pylint: disable=R0903 "address": {"type": "str"}, "enable": {"type": "bool"}, "legacy_protocols": { - "choices": ["cdp", "edp", "fdp", "sonmp"], - "type": "list", + "choices": [ + "cdp", + "edp", + "fdp", + "sonmp", + ], "elements": "str", + "type": "list", }, "snmp": {"type": "str"}, }, @@ -54,9 +63,9 @@ class Lldp_globalArgs(object): # pylint: disable=R0903 "merged", "replaced", "deleted", + "gathered", "rendered", "parsed", - "gathered", ], "default": "merged", "type": "str", diff --git a/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py index 672b7f0..37a6afb 100644 --- a/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py @@ -25,6 +25,7 @@ The arg spec for the vyos_lldp_interfaces module """ + from __future__ import absolute_import, division, print_function @@ -49,8 +50,14 @@ class Lldp_interfacesArgs(object): # pylint: disable=R0903 "ca_info": { "elements": "dict", "options": { - "ca_type": {"type": "int"}, - "ca_value": {"type": "str"}, + "ca_type": { + "required": True, + "type": "int", + }, + "ca_value": { + "required": True, + "type": "str", + }, }, "type": "list", }, @@ -65,11 +72,21 @@ class Lldp_interfacesArgs(object): # pylint: disable=R0903 "options": { "altitude": {"type": "int"}, "datum": { - "choices": ["WGS84", "NAD83", "MLLW"], + "choices": [ + "WGS84", + "NAD83", + "MLLW", + ], + "type": "str", + }, + "latitude": { + "required": True, + "type": "str", + }, + "longitude": { + "required": True, "type": "str", }, - "latitude": {"required": True, "type": "str"}, - "longitude": {"required": True, "type": "str"}, }, "type": "dict", }, @@ -89,8 +106,8 @@ class Lldp_interfacesArgs(object): # pylint: disable=R0903 "overridden", "deleted", "rendered", - "gathered", "parsed", + "gathered", ], "default": "merged", "type": "str", diff --git a/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py b/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py index 93b29f4..0be49e5 100644 --- a/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py +++ b/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) diff --git a/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py b/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py index fca9bf1..cbbfd22 100644 --- a/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py +++ b/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -24,12 +24,12 @@ __metaclass__ = type ############################################# """ -The arg spec for the vyos_ntp module +The arg spec for the vyos_ntp_global module """ class Ntp_globalArgs(object): # pylint: disable=R0903 - """The arg spec for the vyos_ntp module""" + """The arg spec for the vyos_ntp_global module""" argument_spec = { "config": { diff --git a/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py b/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py index 1fd3370..0b5814b 100644 --- a/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -12,17 +12,14 @@ __metaclass__ = type # WARNING # ############################################# # -# This file is auto generated by the resource -# module builder playbook. +# This file is auto generated by the +# cli_rm_builder. # -# Do not edit this file manually. +# Manually editing this file is not advised. # -# Changes to this file will be over written -# by the resource module builder. -# -# Changes should be made in the model used to -# generate this file or in the resource module -# builder template. +# To update the argspec make the desired changes +# in the module docstring and re-run +# cli_rm_builder. # ############################################# @@ -34,40 +31,20 @@ The arg spec for the vyos_ospf_interfaces module class Ospf_interfacesArgs(object): # pylint: disable=R0903 """The arg spec for the vyos_ospf_interfaces module""" - def __init__(self, **kwargs): - pass - argument_spec = { - "running_config": {}, - "state": { - "default": "merged", - "type": "str", - "choices": [ - "merged", - "replaced", - "overridden", - "deleted", - "gathered", - "parsed", - "rendered", - ], - }, "config": { - "elements": "dict", "type": "list", + "elements": "dict", "options": { "name": {"type": "str"}, "address_family": { - "elements": "dict", "type": "list", + "elements": "dict", "options": { - "passive": {"type": "bool"}, - "retransmit_interval": {"type": "int"}, - "cost": {"type": "int"}, "afi": { - "required": True, "type": "str", "choices": ["ipv4", "ipv6"], + "required": True, }, "authentication": { "type": "dict", @@ -80,25 +57,40 @@ class Ospf_interfacesArgs(object): # pylint: disable=R0903 "type": "dict", "no_log": False, "options": { - "key_id": { - "type": "int", - }, + "key_id": {"type": "int"}, "key": {"type": "str", "no_log": True}, }, }, }, }, - "mtu_ignore": {"type": "bool"}, - "priority": {"type": "int"}, - "instance": {"type": "str"}, "bandwidth": {"type": "int"}, + "cost": {"type": "int"}, "dead_interval": {"type": "int"}, - "ifmtu": {"type": "int"}, "hello_interval": {"type": "int"}, - "transmit_delay": {"type": "int"}, + "mtu_ignore": {"type": "bool"}, "network": {"type": "str"}, + "priority": {"type": "int"}, + "retransmit_interval": {"type": "int"}, + "transmit_delay": {"type": "int"}, + "ifmtu": {"type": "int"}, + "instance": {"type": "str"}, + "passive": {"type": "bool"}, }, }, }, }, + "running_config": {"type": "str"}, + "state": { + "type": "str", + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + }, } # pylint: disable=C0301 diff --git a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py index bd7f94d..0a422e8 100644 --- a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py +++ b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py @@ -4,11 +4,6 @@ # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - - -__metaclass__ = type - ############################################# # WARNING # ############################################# @@ -31,6 +26,12 @@ The arg spec for the vyos_ospfv2 module """ +from __future__ import absolute_import, division, print_function + + +__metaclass__ = type + + class Ospfv2Args(object): # pylint: disable=R0903 """The arg spec for the vyos_ospfv2 module""" @@ -40,72 +41,6 @@ class Ospfv2Args(object): # pylint: disable=R0903 argument_spec = { "config": { "options": { - "auto_cost": { - "options": {"reference_bandwidth": {"type": "int"}}, - "type": "dict", - }, - "default_information": { - "options": { - "originate": { - "options": { - "always": {"type": "bool"}, - "metric": {"type": "int"}, - "metric_type": {"type": "int"}, - "route_map": {"type": "str"}, - }, - "type": "dict", - }, - }, - "type": "dict", - }, - "default_metric": {"type": "int"}, - "distance": { - "options": { - "global": {"type": "int"}, - "ospf": { - "options": { - "external": {"type": "int"}, - "inter_area": {"type": "int"}, - "intra_area": {"type": "int"}, - }, - "type": "dict", - }, - }, - "type": "dict", - }, - "log_adjacency_changes": { - "choices": ["detail"], - "type": "str", - }, - "max_metric": { - "options": { - "router_lsa": { - "options": { - "administrative": {"type": "bool"}, - "on_shutdown": {"type": "int"}, - "on_startup": {"type": "int"}, - }, - "type": "dict", - }, - }, - "type": "dict", - }, - "mpls_te": { - "options": { - "enabled": {"type": "bool"}, - "router_address": {"type": "str"}, - }, - "type": "dict", - }, - "neighbor": { - "elements": "dict", - "options": { - "neighbor_id": {"type": "str"}, - "poll_interval": {"type": "int"}, - "priority": {"type": "int"}, - }, - "type": "list", - }, "areas": { "elements": "dict", "options": { @@ -141,12 +76,20 @@ class Ospfv2Args(object): # pylint: disable=R0903 "type": "dict", }, "authentication": { - "choices": ["plaintext-password", "md5"], + "choices": [ + "plaintext-password", + "md5", + ], "type": "str", }, "network": { "elements": "dict", - "options": {"address": {"required": True, "type": "str"}}, + "options": { + "address": { + "required": True, + "type": "str", + }, + }, "type": "list", }, "range": { @@ -160,7 +103,11 @@ class Ospfv2Args(object): # pylint: disable=R0903 "type": "list", }, "shortcut": { - "choices": ["default", "disable", "enable"], + "choices": [ + "default", + "disable", + "enable", + ], "type": "str", }, "virtual_link": { @@ -174,15 +121,15 @@ class Ospfv2Args(object): # pylint: disable=R0903 "options": { "key_id": {"type": "int"}, "md5_key": { - "type": "str", "no_log": True, + "type": "str", }, }, "type": "list", }, "plaintext_password": { - "type": "str", "no_log": True, + "type": "str", }, }, "type": "dict", @@ -197,6 +144,72 @@ class Ospfv2Args(object): # pylint: disable=R0903 }, "type": "list", }, + "auto_cost": { + "options": {"reference_bandwidth": {"type": "int"}}, + "type": "dict", + }, + "default_information": { + "options": { + "originate": { + "options": { + "always": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_map": {"type": "str"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "default_metric": {"type": "int"}, + "distance": { + "options": { + "global": {"type": "int"}, + "ospf": { + "options": { + "external": {"type": "int"}, + "inter_area": {"type": "int"}, + "intra_area": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "log_adjacency_changes": { + "choices": ["detail"], + "type": "str", + }, + "max_metric": { + "options": { + "router_lsa": { + "options": { + "administrative": {"type": "bool"}, + "on_shutdown": {"type": "int"}, + "on_startup": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "mpls_te": { + "options": { + "enabled": {"type": "bool"}, + "router_address": {"type": "str"}, + }, + "type": "dict", + }, + "neighbor": { + "elements": "dict", + "options": { + "neighbor_id": {"type": "str"}, + "poll_interval": {"type": "int"}, + "priority": {"type": "int"}, + }, + "type": "list", + }, "parameters": { "options": { "abr_type": { @@ -214,10 +227,13 @@ class Ospfv2Args(object): # pylint: disable=R0903 }, "type": "dict", }, - "passive_interface": {"type": "list", "elements": "str"}, - "passive_interface_exclude": { + "passive_interface": { + "elements": "str", "type": "list", + }, + "passive_interface_exclude": { "elements": "str", + "type": "list", }, "redistribute": { "elements": "dict", @@ -238,7 +254,7 @@ class Ospfv2Args(object): # pylint: disable=R0903 }, "type": "list", }, - "route_map": {"type": "list", "elements": "str"}, + "route_map": {"elements": "str", "type": "list"}, "timers": { "options": { "refresh": { diff --git a/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py b/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py index 4ea88b6..a59606d 100644 --- a/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py +++ b/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py @@ -4,11 +4,6 @@ # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function - - -__metaclass__ = type - ############################################# # WARNING # ############################################# @@ -31,6 +26,12 @@ The arg spec for the vyos_ospfv3 module """ +from __future__ import absolute_import, division, print_function + + +__metaclass__ = type + + class Ospfv3Args(object): # pylint: disable=R0903 """The arg spec for the vyos_ospfv3 module""" diff --git a/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py b/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py index d274144..b01a3e8 100644 --- a/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py +++ b/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) diff --git a/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py b/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py index b2038a4..196db0c 100644 --- a/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py +++ b/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -31,9 +31,6 @@ The arg spec for the vyos_route_maps module class Route_mapsArgs(object): # pylint: disable=R0903 """The arg spec for the vyos_route_maps module""" - def __init__(self, **kwargs): - pass - argument_spec = { "config": { "type": "list", @@ -48,10 +45,7 @@ class Route_mapsArgs(object): # pylint: disable=R0903 "sequence": {"type": "int"}, "call": {"type": "str"}, "description": {"type": "str"}, - "action": { - "type": "str", - "choices": ["deny", "permit"], - }, + "action": {"type": "str", "choices": ["deny", "permit"]}, "continue_sequence": {"type": "int"}, "set": { "type": "dict", @@ -184,7 +178,9 @@ class Route_mapsArgs(object): # pylint: disable=R0903 "next_hop": {"type": "str"}, }, }, - "large_community_large_community_list": {"type": "str"}, + "large_community_large_community_list": { + "type": "str", + }, "metric": {"type": "int"}, "origin": { "type": "str", @@ -193,11 +189,7 @@ class Route_mapsArgs(object): # pylint: disable=R0903 "peer": {"type": "str"}, "rpki": { "type": "str", - "choices": [ - "notfound", - "invalid", - "valid", - ], + "choices": ["notfound", "invalid", "valid"], }, }, }, diff --git a/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py b/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py index 7cea688..7d0fefe 100644 --- a/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py +++ b/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -78,10 +78,7 @@ class Snmp_serverArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "group": {"type": "str"}, - "mode": { - "type": "str", - "choices": ["ro", "rw"], - }, + "mode": {"type": "str", "choices": ["ro", "rw"]}, "seclevel": { "type": "str", "choices": ["auth", "priv"], @@ -171,10 +168,7 @@ class Snmp_serverArgs(object): # pylint: disable=R0903 }, "engine_id": {"type": "str"}, "group": {"type": "str"}, - "mode": { - "type": "str", - "choices": ["ro", "rw"], - }, + "mode": {"type": "str", "choices": ["ro", "rw"]}, "privacy": { "type": "dict", "options": { diff --git a/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py b/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py index 916ad26..2849b8b 100644 --- a/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py +++ b/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py @@ -25,6 +25,7 @@ The arg spec for the vyos_static_routes module """ + from __future__ import absolute_import, division, print_function @@ -45,7 +46,10 @@ class Static_routesArgs(object): # pylint: disable=R0903 "elements": "dict", "options": { "afi": { - "choices": ["ipv4", "ipv6"], + "choices": [ + "ipv4", + "ipv6", + ], "required": True, "type": "str", }, @@ -59,7 +63,10 @@ class Static_routesArgs(object): # pylint: disable=R0903 }, "type": "dict", }, - "dest": {"required": True, "type": "str"}, + "dest": { + "required": True, + "type": "str", + }, "next_hops": { "elements": "dict", "options": { diff --git a/plugins/modules/vyos_bgp_address_family.py b/plugins/modules/vyos_bgp_address_family.py index d6f8925..b3756e2 100644 --- a/plugins/modules/vyos_bgp_address_family.py +++ b/plugins/modules/vyos_bgp_address_family.py @@ -1,27 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -############################################# -# WARNING # -############################################# -# -# This file is auto generated by the resource -# module builder playbook. -# -# Do not edit this file manually. -# -# Changes to this file will be over written -# by the resource module builder. -# -# Changes should be made in the model used to -# generate this file or in the resource module -# builder template. -# -############################################# - """ The module file for vyos_bgp_address_family """ @@ -33,8 +15,8 @@ __metaclass__ = type DOCUMENTATION = """ module: vyos_bgp_address_family -version_added: 2.1.0 -short_description: BGP Address Family Resource Module. +version_added: 1.0.0 +short_description: BGP Address Family resource module description: - This module manages BGP address family configuration of interfaces on devices running VYOS. author: Gomathi Selvi Srinivasan (@GomathiselviS) @@ -45,7 +27,7 @@ options: suboptions: as_number: description: - - AS number. + - AS number type: int address_family: description: BGP address-family parameters. @@ -259,6 +241,7 @@ options: - overridden default: merged """ + EXAMPLES = """ # Using merged # Before state @@ -1161,6 +1144,53 @@ EXAMPLES = """ # ] """ +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - sample command 1 + - sample command 2 + - sample command 3 +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - sample command 1 + - sample command 2 + - sample command 3 +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. +""" + from ansible.module_utils.basic import AnsibleModule from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.bgp_address_family.bgp_address_family import ( @@ -1179,9 +1209,15 @@ def main(): """ module = AnsibleModule( argument_spec=Bgp_address_familyArgs.argument_spec, - mutually_exclusive=[], - required_if=[], - supports_check_mode=False, + mutually_exclusive=[["config", "running_config"]], + required_if=[ + ["state", "merged", ["config"]], + ["state", "replaced", ["config"]], + ["state", "overridden", ["config"]], + ["state", "rendered", ["config"]], + ["state", "parsed", ["running_config"]], + ], + supports_check_mode=True, ) result = Bgp_address_family(module).execute_module() diff --git a/plugins/modules/vyos_bgp_global.py b/plugins/modules/vyos_bgp_global.py index f9c0eeb..7d47e4a 100644 --- a/plugins/modules/vyos_bgp_global.py +++ b/plugins/modules/vyos_bgp_global.py @@ -1,27 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -############################################# -# WARNING # -############################################# -# -# This file is auto generated by the resource -# module builder playbook. -# -# Do not edit this file manually. -# -# Changes to this file will be over written -# by the resource module builder. -# -# Changes should be made in the model used to -# generate this file or in the resource module -# builder template. -# -############################################# - """ The module file for vyos_bgp_global """ @@ -33,11 +15,12 @@ __metaclass__ = type DOCUMENTATION = """ module: vyos_bgp_global -version_added: 2.0.0 -short_description: BGP Global Resource Module. +version_added: 1.0.0 +short_description: BGP global resource module description: - This module manages BGP global configuration of interfaces on devices running VYOS. -author: Gomathi Selvi Srinivasan (@GomathiselviS) +author: +- Gomathi Selvi Srinivasan (@GomathiselviS) options: config: description: A dict of BGP global configuration for interfaces. @@ -45,22 +28,25 @@ options: suboptions: as_number: description: - - AS number. + - AS number. type: int aggregate_address: description: - - BGP aggregate network. + - BGP aggregate network. type: list elements: dict suboptions: prefix: - description: BGP aggregate network. + description: + - BGP aggregate network. type: str as_set: - description: Generate AS-set path information for this aggregate address. + description: + - Generate AS-set path information for this aggregate address. type: bool summary_only: - description: Announce the aggregate summary network only. + description: + - Announce the aggregate summary network only. type: bool maximum_paths: description: BGP multipaths @@ -79,19 +65,24 @@ options: elements: dict suboptions: address: - description: BGP neighbor address (v4/v6). + description: + - BGP neighbor address (v4/v6). type: str advertisement_interval: - description: Minimum interval for sending routing updates. + description: + - Minimum interval for sending routing updates. type: int allowas_in: - description: Number of occurrences of AS number. + description: + - Number of occurrences of AS number. type: int as_override: - description: AS for routes sent to this neighbor to be the local AS. + description: + - AS for routes sent to this neighbor to be the local AS. type: bool attribute_unchanged: - description: BGP attributes are sent unchanged. + description: + - BGP attributes are sent unchanged. type: dict suboptions: as_path: @@ -104,47 +95,58 @@ options: description: next_hop type: bool capability: - description: Advertise capabilities to this neighbor. + description: + - Advertise capabilities to this neighbor. type: dict suboptions: dynamic: - description: Advertise dynamic capability to this neighbor. + description: + - Advertise dynamic capability to this neighbor. type: bool orf: - description: Advertise ORF capability to this neighbor. + description: + - Advertise ORF capability to this neighbor. type: str - choices: ['send', 'receive'] + choices: + - send + - receive default_originate: - description: Send default route to this neighbor + description: + - Send default route to this neighbor type: str description: - description: description text + description: + - Description of the neighbor type: str disable_capability_negotiation: - description: Disbale capability negotiation with the neighbor + description: + - Disbale capability negotiation with the neighbor type: bool disable_connected_check: - description: Disable check to see if EBGP peer's address is a connected route. + description: + - Disable check to see if EBGP peer's address is a connected route. type: bool disable_send_community: - description: Disable sending community attributes to this neighbor. + description: + - Disable sending community attributes to this neighbor. type: str choices: ['extended', 'standard'] distribute_list: - description: Access-list to filter route updates to/from this neighbor. + description: Access-list to filter route updates to/from this neighbor. type: list elements: dict suboptions: action: - description: Access-list to filter outgoing/incoming route updates to this neighbor + description: Access-list to filter outgoing/incoming route updates to this neighbor type: str choices: ['export', 'import'] acl: description: Access-list number. type: int ebgp_multihop: - description: Allow this EBGP neighbor to not be on a directly connected network. Specify - the number hops. + description: + - Allow this EBGP neighbor to not be on a directly connected network. Specify + the number hops. type: int filter_list: description: As-path-list to filter route updates to/from this neighbor. @@ -162,11 +164,11 @@ options: description: local as number not to be prepended to updates from EBGP peers type: int maximum_prefix: - description: Maximum number of prefixes to accept from this neighbor + description: Maximum number of prefixes to accept from this neighbor nexthop-self Nexthop for routes sent to this neighbor to be the local router. type: int nexthop_self: - description: Nexthop for routes sent to this neighbor to be the local router. + description: Nexthop for routes sent to this neighbor to be the local router. type: bool override_capability: description: Ignore capability negotiation with specified neighbor. @@ -178,7 +180,7 @@ options: description: BGP MD5 password type: str peer_group_name: - description: IPv4 peer group for this peer + description: IPv4 peer group for this peer type: str peer_group: description: True if all the configs under this neighbor key is for peer group template. @@ -232,10 +234,10 @@ options: description: Enable strict capability negotiation type: bool unsuppress_map: - description: Route-map to selectively unsuppress suppressed routes + description: Route-map to selectively unsuppress suppressed routes type: str update_source: - description: Source IP of routing updates + description: Source IP of routing updates type: str weight: description: Default weight for routes from this neighbor @@ -361,7 +363,7 @@ options: description: Compare MEDs between different peers in the same AS type: bool disable_network_import_check: - description: Disable IGP route check for network statements + description: Disable IGP route check for network statements type: bool distance: description: Administrative distances for BGP routes @@ -424,8 +426,8 @@ options: 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. type: str - """ + EXAMPLES = """ # Using merged # Before state @@ -1405,6 +1407,53 @@ EXAMPLES = """ # ] """ +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - set protocols bgp 65536 redistribute static route-map map01 + - set protocols bgp 65536 network 203.0.113.0/24 route-map map01 + - set protocols bgp 65536 parameters always-compare-med +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - set protocols bgp 65536 redistribute static route-map map01 + - set protocols bgp 65536 network 203.0.113.0/24 route-map map01 + - set protocols bgp 65536 parameters always-compare-med +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. +""" + from ansible.module_utils.basic import AnsibleModule from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.bgp_global.bgp_global import ( @@ -1423,9 +1472,15 @@ def main(): """ module = AnsibleModule( argument_spec=Bgp_globalArgs.argument_spec, - mutually_exclusive=[], - required_if=[], - supports_check_mode=False, + mutually_exclusive=[["config", "running_config"]], + required_if=[ + ["state", "merged", ["config"]], + ["state", "replaced", ["config"]], + ["state", "overridden", ["config"]], + ["state", "rendered", ["config"]], + ["state", "parsed", ["running_config"]], + ], + supports_check_mode=True, ) result = Bgp_global(module).execute_module() diff --git a/plugins/modules/vyos_firewall_global.py b/plugins/modules/vyos_firewall_global.py index befe5e7..e952ae5 100644 --- a/plugins/modules/vyos_firewall_global.py +++ b/plugins/modules/vyos_firewall_global.py @@ -31,16 +31,24 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_firewall_global -short_description: FIREWALL global resource module -description: This module manage global policies or configurations for firewall on +short_description: Firewall global resource module +description: +- This module manage global policies or configurations for firewall on VyOS devices. -version_added: 1.0.0 +version_added: '1.0.0' notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +- Tested against VyOS 1.3.8. +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Rohit Thakur (@rohitthakur2590) options: @@ -50,7 +58,8 @@ options: type: dict suboptions: route_redirects: - description: -A dictionary of Firewall icmp redirect and source route global + description: + - A dictionary of Firewall ICMP redirect and source route global configuration options. type: list elements: dict @@ -151,7 +160,8 @@ options: elements: dict suboptions: address: - description: IP address. + description: + - IP address. type: str network_group: description: @@ -185,7 +195,8 @@ options: elements: dict suboptions: address: - description: IP address. + description: + - IP address. type: str port_group: description: @@ -200,7 +211,7 @@ options: required: true description: description: - - Allows you to specify a brief description for the port group. + - A brief description for the port group. type: str members: description: @@ -209,7 +220,8 @@ options: elements: dict suboptions: port: - description: Defines the number. + description: + - Specified port. type: str log_martians: description: @@ -235,7 +247,8 @@ options: elements: dict suboptions: connection_type: - description: Specifies connection type. + description: + - Specifies connection type. type: str choices: - established @@ -255,6 +268,7 @@ options: type: bool log_level: description: + - Specify log level for packets logged. - Only available in 1.4+ type: str choices: @@ -268,7 +282,8 @@ options: - debug running_config: description: - - The module, by default, will connect to the remote device and retrieve the current + - > + The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The I(running_config) argument allows the implementer @@ -288,7 +303,6 @@ options: - rendered - parsed default: merged - """ EXAMPLES = """ # Using merged @@ -314,6 +328,7 @@ EXAMPLES = """ - connection_type: established action: accept log: true + log_level: emerg - connection_type: invalid action: reject route_redirects: @@ -353,19 +368,20 @@ EXAMPLES = """ # "set firewall group network-group MGMT network 192.0.1.0/24", # "set firewall group network-group MGMT description 'This group has the Management network addresses'", # "set firewall group network-group MGMT", -# "set firewall ip-src-route 'enable'", -# "set firewall receive-redirects 'disable'", -# "set firewall send-redirects 'enable'", -# "set firewall config-trap 'enable'", -# "set firewall state-policy established action 'accept'", -# "set firewall state-policy established log 'enable'", -# "set firewall state-policy invalid action 'reject'", -# "set firewall broadcast-ping 'enable'", -# "set firewall all-ping 'enable'", -# "set firewall log-martians 'enable'", -# "set firewall twa-hazards-protection 'enable'", -# "set firewall syn-cookies 'enable'", -# "set firewall source-validation 'strict'" +# "set firewall global-options ip-src-route 'enable'", +# "set firewall global-options receive-redirects 'disable'", +# "set firewall global-options send-redirects 'enable'", +# "set firewall global-options config-trap 'enable'", +# "set firewall global-options state-policy established action 'accept'", +# "set firewall global-options state-policy established log 'enable'", +# "set firewall global-options state-policy established log-level 'emerg'", +# "set firewall global-options state-policy invalid action 'reject'", +# "set firewall global-options broadcast-ping 'enable'", +# "set firewall global-options all-ping 'enable'", +# "set firewall global-options log-martians 'enable'", +# "set firewall global-options twa-hazards-protection 'enable'", +# "set firewall global-options syn-cookies 'enable'", +# "set firewall global-options source-validation 'strict'" # ] # # "after": { @@ -435,36 +451,48 @@ EXAMPLES = """ # ------------- # # vyos@192# run show configuration commands | grep firewall -# set firewall all-ping 'enable' -# set firewall broadcast-ping 'enable' -# set firewall config-trap 'enable' +# set firewall global-options all-ping 'enable' +# set firewall global-options broadcast-ping 'enable' +# set firewall global-options config-trap 'enable' +# set firewall global-options ip-src-route 'enable' +# set firewall global-options log-martians 'enable' +# set firewall global-options receive-redirects 'disable' +# set firewall global-options send-redirects 'enable' +# set firewall global-options source-validation 'strict' +# set firewall global-options state-policy established action 'accept' +# set firewall global-options state-policy established log 'enable' +# set firewall global-options state-policy invalid action 'reject' +# set firewall global-options syn-cookies 'enable' +# set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group MGMT-HOSTS address '192.0.1.1' # set firewall group address-group MGMT-HOSTS address '192.0.1.3' # set firewall group address-group MGMT-HOSTS address '192.0.1.5' # set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' -# set firewall ip-src-route 'enable' -# set firewall log-martians 'enable' -# set firewall receive-redirects 'disable' -# set firewall send-redirects 'enable' -# set firewall source-validation 'strict' -# set firewall state-policy established action 'accept' -# set firewall state-policy established log 'enable' -# set firewall state-policy invalid action 'reject' -# set firewall syn-cookies 'enable' -# set firewall twa-hazards-protection 'enable' # # + + # Using parsed # # - name: Render the commands for provided configuration vyos.vyos.vyos_firewall_global: - running_config: - "set firewall all-ping 'enable' - set firewall broadcast-ping 'enable' - set firewall config-trap 'enable' + running_config: | + set firewall global-options all-ping 'enable' + set firewall global-options broadcast-ping 'enable' + set firewall global-options config-trap 'enable' + set firewall global-options ip-src-route 'enable' + set firewall global-options log-martians 'enable' + set firewall global-options receive-redirects 'disable' + set firewall global-options send-redirects 'enable' + set firewall global-options source-validation 'strict' + set firewall global-options state-policy established action 'accept' + set firewall global-options state-policy established log 'enable' + set firewall global-options state-policy invalid action 'reject' + set firewall global-options syn-cookies 'enable' + set firewall global-options twa-hazards-protection 'enable'" set firewall group address-group ENG-HOSTS address '192.0.3.1' set firewall group address-group ENG-HOSTS address '192.0.3.2' set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -474,16 +502,6 @@ EXAMPLES = """ set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' set firewall group network-group MGMT description 'This group has the Management network addresses' set firewall group network-group MGMT network '192.0.1.0/24' - set firewall ip-src-route 'enable' - set firewall log-martians 'enable' - set firewall receive-redirects 'disable' - set firewall send-redirects 'enable' - set firewall source-validation 'strict' - set firewall state-policy established action 'accept' - set firewall state-policy established log 'enable' - set firewall state-policy invalid action 'reject' - set firewall syn-cookies 'enable' - set firewall twa-hazards-protection 'enable'" state: parsed # # @@ -568,6 +586,8 @@ EXAMPLES = """ # } # } # + + # # Using deleted # @@ -575,25 +595,26 @@ EXAMPLES = """ # ------------- # # vyos@192# run show configuration commands | grep firewall -# set firewall all-ping 'enable' -# set firewall broadcast-ping 'enable' -# set firewall config-trap 'enable' +# set firewall global-options all-ping 'enable' +# set firewall global-options broadcast-ping 'enable' +# set firewall global-options config-trap 'enable' +# set firewall global-options ip-src-route 'enable' +# set firewall global-options log-martians 'enable' +# set firewall global-options receive-redirects 'disable' +# set firewall global-options send-redirects 'enable' +# set firewall global-options source-validation 'strict' +# set firewall global-options state-policy established action 'accept' +# set firewall global-options state-policy established log 'enable' +# set firewall global-options state-policy invalid action 'reject' +# set firewall global-options syn-cookies 'enable' +# set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group MGMT-HOSTS address '192.0.1.1' # set firewall group address-group MGMT-HOSTS address '192.0.1.3' # set firewall group address-group MGMT-HOSTS address '192.0.1.5' # set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' -# set firewall ip-src-route 'enable' -# set firewall log-martians 'enable' -# set firewall receive-redirects 'disable' -# set firewall send-redirects 'enable' -# set firewall source-validation 'strict' -# set firewall state-policy established action 'accept' -# set firewall state-policy established log 'enable' -# set firewall state-policy invalid action 'reject' -# set firewall syn-cookies 'enable' -# set firewall twa-hazards-protection 'enable' + - name: Delete attributes of firewall. vyos.vyos.vyos_firewall_global: config: @@ -606,6 +627,7 @@ EXAMPLES = """ ping: group: state: deleted + # # # ------------------------ @@ -675,18 +697,18 @@ EXAMPLES = """ # "validation": "strict" # } # "commands": [ -# "delete firewall source-validation", -# "delete firewall group", -# "delete firewall log-martians", -# "delete firewall ip-src-route", -# "delete firewall receive-redirects", -# "delete firewall send-redirects", -# "delete firewall config-trap", -# "delete firewall state-policy", -# "delete firewall syn-cookies", -# "delete firewall broadcast-ping", -# "delete firewall all-ping", -# "delete firewall twa-hazards-protection" +# "delete firewall global-options source-validation", +# "delete firewall global-options group", +# "delete firewall global-options log-martians", +# "delete firewall global-options ip-src-route", +# "delete firewall global-options receive-redirects", +# "delete firewall global-options send-redirects", +# "delete firewall global-options config-trap", +# "delete firewall global-options state-policy", +# "delete firewall global-options syn-cookies", +# "delete firewall global-options broadcast-ping", +# "delete firewall global-options all-ping", +# "delete firewall global-options twa-hazards-protection" # ] # # "after": [] @@ -696,6 +718,8 @@ EXAMPLES = """ # vyos@192# run show configuration commands | grep firewall # set 'firewall' # + + # # Using replaced # @@ -703,25 +727,25 @@ EXAMPLES = """ # ------------- # # vyos@vyos:~$ show configuration commands| grep firewall -# set firewall all-ping 'enable' -# set firewall broadcast-ping 'enable' -# set firewall config-trap 'enable' +# set firewall global-options all-ping 'enable' +# set firewall global-options broadcast-ping 'enable' +# set firewall global-options config-trap 'enable' +# set firewall global-options ip-src-route 'enable' +# set firewall global-options log-martians 'enable' +# set firewall global-options receive-redirects 'disable' +# set firewall global-options send-redirects 'enable' +# set firewall global-options source-validation 'strict' +# set firewall global-options state-policy established action 'accept' +# set firewall global-options state-policy established log 'enable' +# set firewall global-options state-policy invalid action 'reject' +# set firewall global-options syn-cookies 'enable' +# set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group MGMT-HOSTS address '192.0.1.1' # set firewall group address-group MGMT-HOSTS address '192.0.1.3' # set firewall group address-group MGMT-HOSTS address '192.0.1.5' # set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' -# set firewall ip-src-route 'enable' -# set firewall log-martians 'enable' -# set firewall receive-redirects 'disable' -# set firewall send-redirects 'enable' -# set firewall source-validation 'strict' -# set firewall state-policy established action 'accept' -# set firewall state-policy established log 'enable' -# set firewall state-policy invalid action 'reject' -# set firewall syn-cookies 'enable' -# set firewall twa-hazards-protection 'enable' - name: Replace firewall global attributes configuration. vyos.vyos.vyos_firewall_global: @@ -926,9 +950,19 @@ EXAMPLES = """ # ------------- # # vyos@192# run show configuration commands | grep firewall -# set firewall all-ping 'enable' -# set firewall broadcast-ping 'enable' -# set firewall config-trap 'enable' +# set firewall global-options all-ping 'enable' +# set firewall global-options broadcast-ping 'enable' +# set firewall global-options config-trap 'enable' +# set firewall global-options ip-src-route 'enable' +# set firewall global-options log-martians 'enable' +# set firewall global-options receive-redirects 'disable' +# set firewall global-options send-redirects 'enable' +# set firewall global-options source-validation 'strict' +# set firewall global-options state-policy established action 'accept' +# set firewall global-options state-policy established log 'enable' +# set firewall global-options state-policy invalid action 'reject' +# set firewall global-options syn-cookies 'enable' +# set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group ENG-HOSTS address '192.0.3.1' # set firewall group address-group ENG-HOSTS address '192.0.3.2' # set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -938,27 +972,29 @@ EXAMPLES = """ # set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' -# set firewall ip-src-route 'enable' -# set firewall log-martians 'enable' -# set firewall receive-redirects 'disable' -# set firewall send-redirects 'enable' -# set firewall source-validation 'strict' -# set firewall state-policy established action 'accept' -# set firewall state-policy established log 'enable' -# set firewall state-policy invalid action 'reject' -# set firewall syn-cookies 'enable' -# set firewall twa-hazards-protection 'enable' # # + + # Using gathered # # Before state: # ------------- # # vyos@192# run show configuration commands | grep firewall -# set firewall all-ping 'enable' -# set firewall broadcast-ping 'enable' -# set firewall config-trap 'enable' +# set firewall global-options all-ping 'enable' +# set firewall global-options broadcast-ping 'enable' +# set firewall global-options config-trap 'enable' +# set firewall global-options ip-src-route 'enable' +# set firewall global-options log-martians 'enable' +# set firewall global-options receive-redirects 'disable' +# set firewall global-options send-redirects 'enable' +# set firewall global-options source-validation 'strict' +# set firewall global-options state-policy established action 'accept' +# set firewall global-options state-policy established log 'enable' +# set firewall global-options state-policy invalid action 'reject' +# set firewall global-options syn-cookies 'enable' +# set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group ENG-HOSTS address '192.0.3.1' # set firewall group address-group ENG-HOSTS address '192.0.3.2' # set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -968,17 +1004,7 @@ EXAMPLES = """ # set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' -# set firewall ip-src-route 'enable' -# set firewall log-martians 'enable' -# set firewall receive-redirects 'disable' -# set firewall send-redirects 'enable' -# set firewall source-validation 'strict' -# set firewall state-policy established action 'accept' -# set firewall state-policy established log 'enable' -# set firewall state-policy invalid action 'reject' -# set firewall syn-cookies 'enable' -# set firewall twa-hazards-protection 'enable' -# + - name: Gather firewall global config with provided configurations vyos.vyos.vyos_firewall_global: state: gathered @@ -1068,9 +1094,19 @@ EXAMPLES = """ # ------------- # # vyos@192# run show configuration commands | grep firewall -# set firewall all-ping 'enable' -# set firewall broadcast-ping 'enable' -# set firewall config-trap 'enable' +# set firewall global-options all-ping 'enable' +# set firewall global-options broadcast-ping 'enable' +# set firewall global-options config-trap 'enable' +# set firewall global-options ip-src-route 'enable' +# set firewall global-options log-martians 'enable' +# set firewall global-options receive-redirects 'disable' +# set firewall global-options send-redirects 'enable' +# set firewall global-options source-validation 'strict' +# set firewall global-options state-policy established action 'accept' +# set firewall global-options state-policy established log 'enable' +# set firewall global-options state-policy invalid action 'reject' +# set firewall global-options syn-cookies 'enable' +# set firewall global-options twa-hazards-protection 'enable' # set firewall group address-group ENG-HOSTS address '192.0.3.1' # set firewall group address-group ENG-HOSTS address '192.0.3.2' # set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' @@ -1080,16 +1116,6 @@ EXAMPLES = """ # set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' # set firewall group network-group MGMT description 'This group has the Management network addresses' # set firewall group network-group MGMT network '192.0.1.0/24' -# set firewall ip-src-route 'enable' -# set firewall log-martians 'enable' -# set firewall receive-redirects 'disable' -# set firewall send-redirects 'enable' -# set firewall source-validation 'strict' -# set firewall state-policy established action 'accept' -# set firewall state-policy established log 'enable' -# set firewall state-policy invalid action 'reject' -# set firewall syn-cookies 'enable' -# set firewall twa-hazards-protection 'enable' # Using rendered @@ -1158,44 +1184,66 @@ EXAMPLES = """ # "set firewall group network-group MGMT network 192.0.1.0/24", # "set firewall group network-group MGMT description 'This group has the Management network addresses'", # "set firewall group network-group MGMT", -# "set firewall ip-src-route 'enable'", -# "set firewall receive-redirects 'disable'", -# "set firewall send-redirects 'enable'", -# "set firewall config-trap 'enable'", -# "set firewall state-policy established action 'accept'", -# "set firewall state-policy established log 'enable'", -# "set firewall state-policy invalid action 'reject'", -# "set firewall broadcast-ping 'enable'", -# "set firewall all-ping 'enable'", -# "set firewall log-martians 'enable'", -# "set firewall twa-hazards-protection 'enable'", -# "set firewall syn-cookies 'enable'", -# "set firewall source-validation 'strict'" +# "set firewall global-options ip-src-route 'enable'", +# "set firewall global-options receive-redirects 'disable'", +# "set firewall global-options send-redirects 'enable'", +# "set firewall global-options config-trap 'enable'", +# "set firewall global-options state-policy established action 'accept'", +# "set firewall global-options state-policy established log 'enable'", +# "set firewall global-options state-policy invalid action 'reject'", +# "set firewall global-options broadcast-ping 'enable'", +# "set firewall global-options all-ping 'enable'", +# "set firewall global-options log-martians 'enable'", +# "set firewall global-options twa-hazards-protection 'enable'", +# "set firewall global-options syn-cookies 'enable'", +# "set firewall global-options source-validation 'strict'" # ] # -# """ RETURN = """ before: - description: The configuration prior to the model invocation. - returned: always - type: list + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. + This output will always be in the same format as the + module argspec. after: - description: The resulting configuration model invocation. + description: The resulting configuration after module execution. returned: when changed - type: list + type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. returned: always type: list - sample: ['set firewall group address-group ENG-HOSTS', - 'set firewall group address-group ENG-HOSTS address 192.0.3.1'] + sample: + - "set firewall group address-group ENG-HOSTS" + - "set firewall group address-group ENG-HOSTS address 192.0.3.1" +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - "set firewall group address-group ENG-HOSTS" + - "set firewall group address-group ENG-HOSTS address 192.0.3.1" +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. + """ @@ -1218,9 +1266,12 @@ def main(): required_if = [ ("state", "merged", ("config",)), ("state", "replaced", ("config",)), + ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), ("state", "parsed", ("running_config",)), ] mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( argument_spec=Firewall_globalArgs.argument_spec, required_if=required_if, diff --git a/plugins/modules/vyos_firewall_interfaces.py b/plugins/modules/vyos_firewall_interfaces.py index 2feabe4..ae17bc1 100644 --- a/plugins/modules/vyos_firewall_interfaces.py +++ b/plugins/modules/vyos_firewall_interfaces.py @@ -40,8 +40,8 @@ ANSIBLE_METADATA = { DOCUMENTATION = """ --- module: vyos_firewall_interfaces -version_added: '2.10.0' -short_description: Manage firewall rules attributes of interfaces on VyOS devices +version_added: '1.0.0' +short_description: Firewall interfaces resource module description: Manage firewall rules of interfaces on VyOS network devices. (1.3-) author: - Rohit Thakur (@rohitthakur2590) diff --git a/plugins/modules/vyos_firewall_rules.py b/plugins/modules/vyos_firewall_rules.py index fd2e7d5..d8c7a1c 100644 --- a/plugins/modules/vyos_firewall_rules.py +++ b/plugins/modules/vyos_firewall_rules.py @@ -32,21 +32,25 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { - 'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'network' + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", } DOCUMENTATION = """ +--- module: vyos_firewall_rules -short_description: FIREWALL rules resource module +version_added: '1.0.0' +short_description: Firewall rules resource module description: This module manages firewall rule-set attributes on VyOS devices -version_added: 1.0.0 -notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Rohit Thakur (@rohitthakur2590) +- Gaige B. Paulsen (@gaige) +notes: +- Tested against VyOS 1.3.8. +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). + options: config: description: A dictionary of Firewall rule-set options. @@ -69,8 +73,8 @@ options: suboptions: filter: description: - - Filter type (exclusive to "name"). - - Supported in 1.4 and later. + - Filter type (exclusive to "name"). + - Supported in 1.4 and later. type: str choices: ['input', 'output', 'forward'] name: @@ -84,14 +88,14 @@ options: - drop (Drop if no prior rules are hit (default)) - reject (Drop and notify source if no prior rules are hit) - accept (Accept if no prior rules are hit) - - jump (Jump to another rule-set, 1.4+) + - jump (Jump to another rule-set, 1.4+) type: str choices: ['drop', 'reject', 'accept', 'jump'] default_jump_target: description: - - Default jump target if the default action is jump. - - Only valid in 1.4 and later. - - Only valid when default_action = jump. + - Default jump target if the default action is jump. + - Only valid in 1.4 and later. + - Only valid when default_action = jump. type: str description: description: @@ -257,6 +261,8 @@ options: ipsec: description: - Inbound ip sec packets. + - VyOS 1.4 and older match-ipsec/match-none + - VyOS 1.5 and later require -in/-out suffixes type: str choices: - match-ipsec @@ -299,7 +305,7 @@ options: type: str log: description: - - Log matching packets. + - Option to log packets matching rule. type: str choices: ['disable', 'enable'] outbound_interface: @@ -503,7 +509,16 @@ options: - syn, ack, fin, rst, urg, psh, all (1.3-) - syn, ack, fin, rst, urg, psh, cwr, ecn (1.4+) type: str - choices: ['ack', 'cwr', 'ecn', 'fin', 'psh', 'rst', 'syn', 'urg', 'all'] + choices: + - ack + - cwr + - ecn + - fin + - psh + - rst + - syn + - urg + - all invert: description: - Invert the match. @@ -564,7 +579,6 @@ options: - rendered - parsed default: merged - """ EXAMPLES = """ # Using deleted to delete firewall rules based on rule-set name @@ -1230,7 +1244,6 @@ EXAMPLES = """ description: Rule 502 is configured by Ansible ipsec: match-ipsec state: overridden - # # # ------------------------- @@ -1366,6 +1379,7 @@ EXAMPLES = """ # - name: Gather listed firewall rules with provided configurations vyos.vyos.vyos_firewall_rules: + config: state: gathered # # @@ -1514,7 +1528,6 @@ EXAMPLES = """ invalid: false related: true state: rendered - # # # ------------------------- @@ -1550,7 +1563,7 @@ EXAMPLES = """ # Using parsed # # -- name: Parsed the provided input commands. +- name: Parse the commands for provided configuration vyos.vyos.vyos_firewall_rules: running_config: "set firewall group address-group 'inbound' @@ -1599,19 +1612,19 @@ EXAMPLES = """ """ RETURN = """ before: - description: The configuration prior to the model invocation. - returned: always + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. + This output will always be in the same format as the + module argspec. after: - description: The resulting configuration model invocation. + description: The resulting configuration after module execution. returned: when changed type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. returned: always @@ -1622,13 +1635,42 @@ commands: - "set firewall name Downlink rule 501 action 'accept'" - "set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'" - "set firewall name Downlink rule 502 ipsec 'match-ipsec'" +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - "set firewall name Downlink default-action 'accept'" + - "set firewall name Downlink description 'IPv4 INBOUND rule set'" + - "set firewall name Downlink rule 501 action 'accept'" + - "set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible'" + - "set firewall name Downlink rule 502 ipsec 'match-ipsec'" +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. + """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.firewall_rules.firewall_rules import Firewall_rulesArgs -from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.firewall_rules.firewall_rules import Firewall_rules +from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.firewall_rules.firewall_rules import ( + Firewall_rulesArgs, +) +from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.firewall_rules.firewall_rules import ( + Firewall_rules, +) def main(): @@ -1652,9 +1694,10 @@ def main(): supports_check_mode=True, mutually_exclusive=mutually_exclusive, ) + result = Firewall_rules(module).execute_module() module.exit_json(**result) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/plugins/modules/vyos_hostname.py b/plugins/modules/vyos_hostname.py index bc039b5..480b011 100644 --- a/plugins/modules/vyos_hostname.py +++ b/plugins/modules/vyos_hostname.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2022 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -209,7 +209,6 @@ EXAMPLES = """ # } """ - RETURN = """ before: description: The configuration prior to the module execution. diff --git a/plugins/modules/vyos_interfaces.py b/plugins/modules/vyos_interfaces.py index c7a2168..b679a22 100644 --- a/plugins/modules/vyos_interfaces.py +++ b/plugins/modules/vyos_interfaces.py @@ -31,25 +31,31 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_interfaces -short_description: Interfaces resource module +version_added: '2.9.0' +short_description: Manages interface attributes of VyOS network devices. description: - This module manages the interface attributes on VyOS network devices. -- This module supports managing base attributes of Ethernet, Bonding, VXLAN, Loopback - and Virtual Tunnel Interfaces. -version_added: 1.0.0 +- This module supports managing base attributes of Ethernet, Bonding, + VXLAN, Loopback and Virtual Tunnel Interfaces. notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). -- The examples use the stdout_callback as yaml to produce task outputs. +- Tested against VyOS 1.3.8 +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Nilashish Chakraborty (@nilashishc) - Rohit Thakur (@rohitthakur2590) options: config: - description: The provided interfaces configuration. + description: The provided interface configuration. type: list elements: dict suboptions: @@ -75,9 +81,9 @@ options: default: true description: - Administrative state of the interface. - - Set the value to C(true) to administratively enable the interface or C(false) - to disable it. + - Set the value to C(true) to administratively enable the interface or C(false) to disable it. type: bool + aliases: ['enable'] mtu: description: - MTU for a specific interface. Refer to vendor documentation for valid values. @@ -117,6 +123,7 @@ options: C(false) to disable it. type: bool default: true + aliases: ['enable'] mtu: description: - MTU for the virtual sub-interface. @@ -145,7 +152,6 @@ options: - parsed default: merged """ - EXAMPLES = """ # Using merged @@ -825,29 +831,50 @@ EXAMPLES = """ # name: eth0 # speed: auto """ - RETURN = """ before: - description: The configuration as structured data prior to module invocation. - returned: always - sample: > - The configuration returned will always be in the same format - of the parameters above. + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list + sample: > + This output will always be in the same format as the + module argspec. after: - description: The configuration as structured data after module completion. + description: The resulting configuration after module execution. returned: when changed - sample: > - The configuration returned will always be in the same format - of the parameters above. type: list + sample: > + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. returned: always type: list sample: - - 'set interfaces ethernet eth1 mtu 1200' - - 'set interfaces ethernet eth2 vif 100 description VIF 100' + - 'set interfaces ethernet eth1 mtu 1200' + - 'set interfaces ethernet eth2 vif 100 description VIF 100' +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - 'set interfaces ethernet eth1 mtu 1200' + - 'set interfaces ethernet eth2 vif 100 description VIF 100' +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. + """ @@ -875,6 +902,7 @@ def main(): ("state", "parsed", ("running_config",)), ] mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( argument_spec=InterfacesArgs.argument_spec, required_if=required_if, diff --git a/plugins/modules/vyos_l3_interfaces.py b/plugins/modules/vyos_l3_interfaces.py index 0849c29..0d2a5da 100644 --- a/plugins/modules/vyos_l3_interfaces.py +++ b/plugins/modules/vyos_l3_interfaces.py @@ -31,21 +31,28 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_l3_interfaces -short_description: L3 interfaces resource module +version_added: '1.0.0' +short_description: Layer 3 interfaces resource module. description: This module manages the L3 interface attributes on VyOS network devices. -version_added: 1.0.0 notes: -- Tested against VyOS 1.1.8 (helium). +- Tested against VyOS 1.3. - This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: -- Nilashish Chakraborty (@NilashishC) - Rohit Thakur (@rohitthakur2590) +- Nilashish Chakraborty (@nilashishc) options: config: - description: The provided L3 interfaces configuration. + description: + - The provided L3 interfaces configuration. type: list elements: dict suboptions: @@ -73,36 +80,38 @@ options: address: description: - IPv6 address of the interface. + - C(auto-config) to use SLAAC to chose an address. type: str vifs: description: - - Virtual sub-interfaces L3 configurations. + - List of virtual sub-interfaces (VIFs) of the interface. elements: dict type: list suboptions: vlan_id: description: - - Identifier for the virtual sub-interface. + - Identifier for the VIF. type: int ipv4: description: - - List of IPv4 addresses of the virtual interface. + - List of IPv4 addresses of the VIF. type: list elements: dict suboptions: address: description: - - IPv4 address of the virtual interface. + - IPv4 address of the VIF. type: str ipv6: description: - - List of IPv6 addresses of the virtual interface. + - List of IPv6 addresses of the VIF. type: list elements: dict suboptions: address: description: - - IPv6 address of the virtual interface. + - IPv6 address of the virtual VIF + - C(auto-config) to use SLAAC to chose an address. type: str running_config: description: @@ -122,9 +131,9 @@ options: - replaced - overridden - deleted - - parsed - - gathered - rendered + - gathered + - parsed default: merged """ EXAMPLES = """ @@ -163,7 +172,6 @@ EXAMPLES = """ - address: '2001:db8:1400::3/38' state: merged - # After state: # ------------- # @@ -216,7 +224,7 @@ EXAMPLES = """ - name: eth3 ipv6: - - address: 2001:db8::11/32 + - address: '2001:db8::11/32' state: replaced # After state: @@ -273,7 +281,6 @@ EXAMPLES = """ - address: dhcpv6 state: overridden - # After state # ------------ # @@ -315,8 +322,7 @@ EXAMPLES = """ # set interfaces ethernet eth3 vif 102 address '2001:db8:4000::3/34' # set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34' -- name: Delete L3 attributes of given interfaces (Note - This won't delete the interface - itself) +- name: Delete L3 attributes of given interfaces (Note - This won't delete the interface itself) vyos.vyos.vyos_l3_interfaces: config: - name: eth1 @@ -515,24 +521,27 @@ EXAMPLES = """ """ RETURN = """ before: - description: The configuration as structured data prior to module invocation. + description: The configuration prior to the module invocation. returned: always type: list sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. after: - description: The configuration as structured data after module completion. + description: The resulting configuration module invocation. returned: when changed type: list sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. commands: description: The set of commands pushed to the remote device. returned: always type: list - sample: ['set interfaces ethernet eth1 192.0.2.14/2', 'set interfaces ethernet eth3 vif 101 address 198.51.100.130/25'] + sample: + - 'set interfaces ethernet eth1 192.0.2.14/2' + - 'set interfaces ethernet eth3 vif 101 address 198.51.100.130/25' + """ diff --git a/plugins/modules/vyos_lag_interfaces.py b/plugins/modules/vyos_lag_interfaces.py index 0605f06..090021a 100644 --- a/plugins/modules/vyos_lag_interfaces.py +++ b/plugins/modules/vyos_lag_interfaces.py @@ -31,17 +31,23 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_lag_interfaces +version_added: '1.0.0' short_description: LAG interfaces resource module -description: This module manages attributes of link aggregation groups on VyOS network - devices. -version_added: 1.0.0 +description: This module manages attributes of link aggregation groups on VyOS network devices. +author: +- Rohit Thakur (@rohitthakur2590) notes: -- Tested against VyOS 1.1.8 (helium). +- Tested against VyOS 1.3.8. - This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). -author: Rohit Thakur (@rohitthakur2590) options: config: description: A list of link aggregation group configurations. @@ -453,8 +459,7 @@ EXAMPLES = """ # set interfaces ethernet eth2 bond-group 'bond2' # set interfaces ethernet eth3 bond-group 'bond3' # -- name: Delete LAG attributes of given interfaces (Note This won't delete the interface - itself) +- name: Delete LAG attributes of given interfaces (Note - This won't delete the interface itself) vyos.vyos.vyos_lag_interfaces: config: - name: bond2 @@ -718,19 +723,19 @@ EXAMPLES = """ """ RETURN = """ before: - description: The configuration as structured data prior to module invocation. + description: The configuration prior to the module invocation. returned: always type: list sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. after: - description: The configuration as structured data after module completion. + description: The resulting configuration module invocation. returned: when changed type: list sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. commands: description: The set of commands pushed to the remote device. returned: always @@ -738,6 +743,7 @@ commands: sample: - 'set interfaces bonding bond2' - 'set interfaces bonding bond2 hash-policy layer2' + """ diff --git a/plugins/modules/vyos_lldp_global.py b/plugins/modules/vyos_lldp_global.py index 5d215f6..e2f7914 100644 --- a/plugins/modules/vyos_lldp_global.py +++ b/plugins/modules/vyos_lldp_global.py @@ -31,15 +31,21 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_lldp_global +version_added: '1.0.0' short_description: LLDP global resource module description: This module manages link layer discovery protocol (LLDP) attributes on VyOS devices. -version_added: 1.0.0 notes: -- Tested against VyOS 1.1.8 (helium). +- Tested against VyOS 1.3.8 - This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Rohit Thakur (@rohitthakur2590) @@ -91,7 +97,6 @@ options: - rendered - parsed default: merged - """ EXAMPLES = """ # Using merged @@ -116,32 +121,24 @@ EXAMPLES = """ # Module Execution Results # ------------------------ # -# "before": [] -# -# "commands": [ -# "set service lldp legacy-protocols fdp", -# "set service lldp legacy-protocols cdp", -# "set service lldp snmp enable", -# "set service lldp management-address '192.0.2.11'" -# ] -# -# "after": [ -# { -# "snmp": "enable" -# }, -# { -# "address": "192.0.2.11" -# }, -# { -# "legacy_protocols": [ -# "cdp", -# "fdp" -# ] -# } -# { -# "enable": true -# } +# before": {} +# +# commands": [ +# "set service lldp legacy-protocols fdp", +# "set service lldp legacy-protocols cdp", +# "set service lldp snmp enable", +# "set service lldp management-address '192.0.2.11'" +# ] +# +# after": { +# "snmp": "enable" +# "address": "192.0.2.11" +# "legacy_protocols": [ +# "cdp", +# "fdp" # ] +# "enable": true +# } # # After state: # ------------- @@ -179,23 +176,16 @@ EXAMPLES = """ # ------------------------ # # -# "before": [ -# { -# "snmp": "enable" -# }, -# { -# "address": "192.0.2.11" -# }, -# { -# "legacy_protocols": [ -# "cdp", -# "fdp" -# ] -# } -# { -# "enable": true -# } +# "before": { +# "snmp": "enable" +# "address": "192.0.2.11" +# "legacy_protocols": [ +# "cdp", +# "fdp" # ] +# "enable": true +# } +# # "commands": [ # "delete service lldp snmp", # "delete service lldp legacy-protocols fdp", @@ -204,21 +194,15 @@ EXAMPLES = """ # "set service lldp legacy-protocols sonmp" # ] # -# "after": [ -# { -# "address": "192.0.2.14" -# }, -# { -# "legacy_protocols": [ -# "cdp", -# "edp", -# "sonmp" -# ] -# } -# { -# "enable": true -# } +# "after": { +# "address": "192.0.2.14" +# "legacy_protocols": [ +# "cdp", +# "edp", +# "sonmp" # ] +# "enable": true +# } # # After state: # ------------- @@ -251,32 +235,24 @@ EXAMPLES = """ # Module Execution Results # ------------------------ # -# "before": [ -# { -# "address": "192.0.2.14" -# }, -# { -# "legacy_protocols": [ -# "cdp", -# "edp", -# "sonmp" -# ] -# } -# { -# "enable": true -# } +# "before": { +# "address": "192.0.2.14" +# "legacy_protocols": [ +# "cdp", +# "edp", +# "sonmp" # ] +# "enable": true +# } # # "commands": [ -# "delete service lldp management-address", -# "delete service lldp legacy-protocols" -# ] +# "delete service lldp management-address", +# "delete service lldp legacy-protocols" +# ] # -# "after": [ -# { -# "enable": true -# } -# ] +# "after": { +# "enable": true +# } # # After state # ------------ @@ -303,8 +279,7 @@ EXAMPLES = """ # Module Execution Result # ------------------------- # -# "gathered": [ -# { +# "gathered": { # "config_trap": true, # "group": { # "address_group": [ @@ -406,10 +381,10 @@ EXAMPLES = """ # # # "rendered": [ -# "set service lldp legacy-protocols 'cdp'", -# "set service lldp", -# "set service lldp management-address '192.0.2.17'" -# ] +# "set service lldp legacy-protocols 'cdp'", +# "set service lldp", +# "set service lldp management-address '192.0.2.17'" +# ] # @@ -431,30 +406,29 @@ EXAMPLES = """ # # # "parsed": { -# "address": "192.0.2.11", -# "enable": true, -# "legacy_protocols": [ -# "cdp", -# "fdp" -# ] -# } -# +# "address": "192.0.2.11", +# "enable": true, +# "legacy_protocols": [ +# "cdp", +# "fdp" +# ] +# } """ RETURN = """ before: - description: The configuration as structured data prior to module invocation. + description: The configuration prior to the module invocation. returned: always - type: list + type: dict sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. after: - description: The configuration as structured data after module completion. + description: The resulting configuration after module invocation. returned: when changed - type: list + type: dict sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. commands: description: The set of commands pushed to the remote device. returned: always @@ -462,6 +436,7 @@ commands: sample: - set service lldp legacy-protocols sonmp - set service lldp management-address '192.0.2.14' + """ @@ -485,15 +460,18 @@ def main(): ("state", "merged", ("config",)), ("state", "replaced", ("config",)), ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), ("state", "parsed", ("running_config",)), ] mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( argument_spec=Lldp_globalArgs.argument_spec, required_if=required_if, supports_check_mode=True, mutually_exclusive=mutually_exclusive, ) + result = Lldp_global(module).execute_module() module.exit_json(**result) diff --git a/plugins/modules/vyos_lldp_interfaces.py b/plugins/modules/vyos_lldp_interfaces.py index 6628f65..14160c7 100644 --- a/plugins/modules/vyos_lldp_interfaces.py +++ b/plugins/modules/vyos_lldp_interfaces.py @@ -31,33 +31,40 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_lldp_interfaces +version_added: '1.0.0' short_description: LLDP interfaces resource module description: This module manages attributes of lldp interfaces on VyOS network devices. -version_added: 1.0.0 notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +- Tested against VyOS 1.3.8 +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: -- Rohit Thakur (@rohitthakur2590) + - Rohit Thakur (@rohitthakur2590) options: config: - description: A list of lldp interfaces configurations. + description: A list of LLDP interfaces configurations. type: list elements: dict suboptions: name: description: - - Name of the lldp interface. + - Name of the LLDP interface. type: str required: true enable: + default: true description: - - to disable lldp on the interface. + - Disable LLDP on the interfaces. type: bool - default: true location: description: - LLDP-MED location data. @@ -76,9 +83,11 @@ options: ca_type: description: LLDP-MED Civic Address type. type: int + required: true ca_value: description: LLDP-MED Civic Address value. type: str + required: true country_code: description: Country Code type: str @@ -120,16 +129,16 @@ options: type: str state: description: - - The state of the configuration after module completion. + - The state of the configuration after module completion. type: str choices: - - merged - - replaced - - overridden - - deleted - - rendered - - parsed - - gathered + - merged + - replaced + - overridden + - deleted + - rendered + - parsed + - gathered default: merged """ EXAMPLES = """ @@ -158,18 +167,19 @@ EXAMPLES = """ longitude: 222.267255W latitude: 33.524449N state: merged - # # # ------------------------- # Module Execution Result # ------------------------- # -# before": [] +# before": {} # # "commands": [ # "set service lldp interface eth1 location civic-based country-code 'US'", # "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'", +# "set service lldp interface eth1 location civic-based country-code 'US'", +# "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'", # "set service lldp interface eth1", # "set service lldp interface eth2 location coordinate-based latitude '33.524449N'", # "set service lldp interface eth2 location coordinate-based altitude '2200'", @@ -180,34 +190,33 @@ EXAMPLES = """ # "set service lldp interface eth2 location coordinate-based datum 'WGS84'", # "set service lldp interface eth2 location coordinate-based longitude '222.267255W'", # "set service lldp interface eth2" +# ] # -# "after": [ -# { -# "location": { -# "coordinate_based": { -# "altitude": 2200, -# "datum": "WGS84", -# "latitude": "33.524449N", -# "longitude": "222.267255W" -# } -# }, -# "name": "eth2" -# }, -# { -# "location": { -# "civic_based": { -# "ca_info": [ -# { -# "ca_type": 0, -# "ca_value": "ENGLISH" -# } -# ], -# "country_code": "US" -# } -# }, -# "name": "eth1" -# } -# ], +# "after": { +# "location": { +# "coordinate_based": { +# "altitude": 2200, +# "datum": "WGS84", +# "latitude": "33.524449N", +# "longitude": "222.267255W" +# } +# }, +# "name": "eth2" +# }, +# { +# "location": { +# "civic_based": { +# "ca_info": [ +# { +# "ca_type": 0, +# "ca_value": "ENGLISH" +# } +# ], +# "country_code": "US" +# } +# }, +# "name": "eth1" +# } # # After state: # ------------- @@ -301,33 +310,31 @@ EXAMPLES = """ # "set service lldp interface eth1 location coordinate-based longitude '222.267255W'" # ] # -# "after": [ -# { -# "location": { -# "civic_based": { -# "ca_info": [ -# { -# "ca_type": 0, -# "ca_value": "ENGLISH" -# } -# ], -# "country_code": "US" -# } -# }, -# "name": "eth2" +# "after": { +# "location": { +# "civic_based": { +# "ca_info": [ +# { +# "ca_type": 0, +# "ca_value": "ENGLISH" +# } +# ], +# "country_code": "US" +# } # }, -# { -# "location": { -# "coordinate_based": { -# "altitude": 2200, -# "datum": "WGS84", -# "latitude": "33.524449N", -# "longitude": "222.267255W" -# } -# }, -# "name": "eth1" -# } -# ] +# "name": "eth2" +# }, +# { +# "location": { +# "coordinate_based": { +# "altitude": 2200, +# "datum": "WGS84", +# "latitude": "33.524449N", +# "longitude": "222.267255W" +# } +# }, +# "name": "eth1" +# } # # After state: # ------------- @@ -373,49 +380,49 @@ EXAMPLES = """ # ------------------------- # # "before": [ -# { -# "enable": false, -# "location": { -# "civic_based": { -# "ca_info": [ -# { -# "ca_type": 0, -# "ca_value": "ENGLISH" -# } -# ], -# "country_code": "US" -# } -# }, -# "name": "eth2" -# }, -# { -# "enable": false, -# "location": { -# "coordinate_based": { -# "altitude": 2200, -# "datum": "WGS84", -# "latitude": "33.524449N", -# "longitude": "222.267255W" -# } -# }, -# "name": "eth1" +# { +# "enable": false, +# "location": { +# "civic_based": { +# "ca_info": [ +# { +# "ca_type": 0, +# "ca_value": "ENGLISH" +# } +# ], +# "country_code": "US" # } -# ] -# -# "commands": [ -# "delete service lldp interface eth2 location", -# "delete service lldp interface eth2 disable", -# "set service lldp interface eth2 location elin 0000000911" +# }, +# "name": "eth2" +# }, +# { +# "enable": false, +# "location": { +# "coordinate_based": { +# "altitude": 2200, +# "datum": "WGS84", +# "latitude": "33.524449N", +# "longitude": "222.267255W" +# } +# }, +# "name": "eth1" +# } +# ] # +# "commands": [ +# "delete service lldp interface eth2 location", +# "delete service lldp interface eth2 disable", +# "set service lldp interface eth2 location elin 0000000911" +# ] # -# "after": [ -# { -# "location": { -# "elin": 0000000911 -# }, -# "name": "eth2" -# } -# ] +# "after": [ +# { +# "location": { +# "elin": 0000000911 +# }, +# "name": "eth2" +# } +# ] # # # After state @@ -433,7 +440,7 @@ EXAMPLES = """ # vyos@vyos# run show configuration commands | grep lldp # set service lldp interface eth2 location elin '0000000911' # -- name: Delete lldp interface attributes of given interfaces. +- name: Delete LLDP interface attributes of given interfaces. vyos.vyos.vyos_lldp_interfaces: config: - name: eth2 @@ -444,11 +451,17 @@ EXAMPLES = """ # Module Execution Results # ------------------------ # - before: [{location: {elin: 0000000911}, name: eth2}] -# "commands": [ -# "commands": [ -# "delete service lldp interface eth2" -# ] +# "before": [ +# { +# "location": { +# "elin": 0000000911 +# }, +# "name": "eth2" +# } +# ] +# "commands": [ +# "delete service lldp interface eth2" +# ] # # "after": [] # After state @@ -617,14 +630,14 @@ before: type: list sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. after: description: The configuration as structured data after module completion. returned: when changed type: list sample: > The configuration returned will always be in the same format - of the parameters above. + of the parameters above. commands: description: The set of commands pushed to the remote device. returned: always @@ -632,6 +645,7 @@ commands: sample: - "set service lldp interface eth2 'disable'" - "delete service lldp interface eth1 location" + """ diff --git a/plugins/modules/vyos_logging_global.py b/plugins/modules/vyos_logging_global.py index 06ebe48..069d508 100644 --- a/plugins/modules/vyos_logging_global.py +++ b/plugins/modules/vyos_logging_global.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -698,7 +698,7 @@ EXAMPLES = """ RETURN = """ before: description: The configuration prior to the module execution. - returned: when state is I(merged), I(replaced), I(overridden), I(deleted) or I(purged) + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: dict sample: > This output will always be in the same format as the @@ -712,7 +712,7 @@ after: module argspec. commands: description: The set of commands pushed to the remote device. - returned: when state is I(merged), I(replaced), I(overridden), I(deleted) or I(purged) + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list sample: - "set system syslog console facility local7 level err" @@ -720,7 +720,7 @@ commands: - "set system syslog global archive size 111" rendered: description: The provided configuration in the task rendered in device-native format (offline). - returned: when state is I(rendered) + returned: when I(state) is C(rendered) type: list sample: - "set system syslog host 172.16.0.1 port 223" @@ -728,14 +728,14 @@ rendered: - "set system syslog global facility cron level debug" gathered: description: Facts about the network resource gathered from the remote device as structured data. - returned: when state is I(gathered) + returned: when I(state) is C(gathered) type: list sample: > This output will always be in the same format as the module argspec. parsed: description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. - returned: when state is I(parsed) + returned: when I(state) is C(parsed) type: list sample: > This output will always be in the same format as the diff --git a/plugins/modules/vyos_ntp_global.py b/plugins/modules/vyos_ntp_global.py index 0fe56ad..4fd9891 100644 --- a/plugins/modules/vyos_ntp_global.py +++ b/plugins/modules/vyos_ntp_global.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -13,75 +13,78 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type - DOCUMENTATION = """ - module: vyos_ntp_global - version_added: 2.4.0 - short_description: Manages ntp modules of Vyos network devices - description: - - This module manages ntp configuration on devices running Vyos - author: Varshitha Yataluru (@YVarshitha) - notes: - - Tested against vyos 1.3 - - This module works with connection C(network_cli). - options: - config: - description: List of configurations for ntp module - type: dict +module: vyos_ntp_global +version_added: 1.0.0 +short_description: NTP global resource module +description: +- This module manages ntp configuration on devices running Vyos +author: +- Varshitha Yataluru (@YVarshitha) +notes: +- Tested against vyos 1.3 +- This module works with connection C(network_cli). +- "VyOS v.1.4+ uses chronyd, and path changes from `system` to `service`" +options: + config: + description: List of configurations for ntp module + type: dict + suboptions: + allow_clients: + description: Network Time Protocol (NTP) server options + type: list + elements: str + listen_addresses: + description: local IP addresses for service to listen on + type: list + elements: str + servers: + description: Network Time Protocol (NTP) server + type: list + elements: dict suboptions: - allow_clients: - description: Network Time Protocol (NTP) server options - type: list - elements: str - listen_addresses: - description: local IP addresses for service to listen on - type: list - elements: str - servers: - description: Network Time Protocol (NTP) server - type: list - elements: dict - suboptions: - server: - description: server name for NTP - type: str - options: - description: server options for NTP - type: list - elements: str - choices: - - noselect - - dynamic - - pool - - preempt - - prefer - running_config: - description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VYOS device by - executing the command B(show configuration commands | grep ntp). - - The states I(replaced) and I(overridden) have identical - behaviour for this module. - - The state I(parsed) reads the configuration from C(show configuration commands | grep ntp) 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. - type: str - state: - description: - - The state the configuration should be left in. - type: str - choices: - - deleted - - merged - - overridden - - replaced - - gathered - - rendered - - parsed - default: merged + server: + description: server name for NTP + type: str + options: + description: + - server options for NTP + - "`dynamic` changed to `pool` after v1.3" + type: list + elements: str + choices: + - noselect + - dynamic + - pool + - preempt + - prefer + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VYOS device by + executing the command B(show configuration commands | grep ntp). + - The states I(replaced) and I(overridden) have identical + behaviour for this module. + - The state I(parsed) reads the configuration from C(show configuration commands | grep ntp) 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. + type: str + state: + description: + - The state the configuration should be left in. + type: str + choices: + - deleted + - merged + - overridden + - replaced + - gathered + - rendered + - parsed + default: merged """ -EXAMPLES = """ +EXAMPLES = """ # # ------------------- # # 1. Using merged # # ------------------- @@ -89,9 +92,9 @@ EXAMPLES = """ # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # # Task @@ -140,20 +143,20 @@ EXAMPLES = """ # }, # "changed": true, # "commands": [ -# "set system ntp allow-clients address 10.6.6.0/24", -# "set system ntp listen-address 10.1.3.1", -# "set system ntp server 203.0.113.0 prefer" +# "set service ntp allow-clients address 10.6.6.0/24", +# "set service ntp listen-address 10.1.3.1", +# "set service ntp server 203.0.113.0 prefer" # ] # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.6.6.0/24' -# set system ntp listen-address '10.1.3.1' -# set system ntp server 203.0.113.0 prefer, -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.6.6.0/24' +# set service ntp listen-address '10.1.3.1' +# set service ntp server 203.0.113.0 prefer, +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ @@ -164,25 +167,25 @@ EXAMPLES = """ # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.4.9.0/24' -# set system ntp allow-clients address '10.4.7.0/24' -# set system ntp allow-clients address '10.1.2.0/24' -# set system ntp allow-clients address '10.2.3.0/24' -# set system ntp listen-address '10.1.9.16' -# set system ntp listen-address '10.5.3.2' -# set system ntp listen-address '10.7.9.21' -# set system ntp listen-address '10.8.9.4' -# set system ntp listen-address '10.4.5.1' -# set system ntp server 10.3.6.5 noselect -# set system ntp server 10.3.6.5 dynamic -# set system ntp server 10.3.6.5 preempt -# set system ntp server 10.3.6.5 prefer -# set system ntp server server4 noselect -# set system ntp server server4 dynamic -# set system ntp server server5 -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.4.9.0/24' +# set service ntp allow-clients address '10.4.7.0/24' +# set service ntp allow-clients address '10.1.2.0/24' +# set service ntp allow-clients address '10.2.3.0/24' +# set service ntp listen-address '10.1.9.16' +# set service ntp listen-address '10.5.3.2' +# set service ntp listen-address '10.7.9.21' +# set service ntp listen-address '10.8.9.4' +# set service ntp listen-address '10.4.5.1' +# set service ntp server 10.3.6.5 noselect +# set service ntp server 10.3.6.5 dynamic +# set service ntp server 10.3.6.5 preempt +# set service ntp server 10.3.6.5 prefer +# set service ntp server server4 noselect +# set service ntp server server4 dynamic +# set service ntp server server5 +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # # Task @@ -275,32 +278,32 @@ EXAMPLES = """ # }, # "changed": true, # "commands": [ -# "delete system ntp allow-clients address 10.4.7.0/24", -# "delete system ntp allow-clients address 10.2.3.0/24", -# "delete system ntp allow-clients address 10.1.2.0/24", -# "delete system ntp allow-clients address 10.4.9.0/24", -# "delete system ntp listen-address 10.7.9.21", -# "delete system ntp listen-address 10.4.5.1", -# "delete system ntp listen-address 10.5.3.2", -# "delete system ntp listen-address 10.8.9.4", -# "delete system ntp listen-address 10.1.9.16", -# "delete system ntp server 10.3.6.5", -# "delete system ntp server server4", -# "delete system ntp server server5", -# "set system ntp allow-clients address 10.6.6.0/24", -# "set system ntp listen-address 10.1.3.1", -# "set system ntp server 203.0.113.0 prefer" +# "delete service ntp allow-clients address 10.4.7.0/24", +# "delete service ntp allow-clients address 10.2.3.0/24", +# "delete service ntp allow-clients address 10.1.2.0/24", +# "delete service ntp allow-clients address 10.4.9.0/24", +# "delete service ntp listen-address 10.7.9.21", +# "delete service ntp listen-address 10.4.5.1", +# "delete service ntp listen-address 10.5.3.2", +# "delete service ntp listen-address 10.8.9.4", +# "delete service ntp listen-address 10.1.9.16", +# "delete service ntp server 10.3.6.5", +# "delete service ntp server server4", +# "delete service ntp server server5", +# "set service ntp allow-clients address 10.6.6.0/24", +# "set service ntp listen-address 10.1.3.1", +# "set service ntp server 203.0.113.0 prefer" # ] # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.6.6.0/24' -# set system ntp listen-address '10.1.3.1' -# set system ntp server 203.0.113.0 prefer, -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.6.6.0/24' +# set service ntp listen-address '10.1.3.1' +# set service ntp server 203.0.113.0 prefer, +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # # ------------------- @@ -310,12 +313,12 @@ EXAMPLES = """ # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.6.6.0/24' -# set system ntp listen-address '10.1.3.1' -# set system ntp server 203.0.113.0 prefer, -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.6.6.0/24' +# set service ntp listen-address '10.1.3.1' +# set service ntp server 203.0.113.0 prefer, +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # Task @@ -406,31 +409,31 @@ EXAMPLES = """ # }, # "changed": true, # "commands": [ -# "delete system ntp allow-clients address 10.6.6.0/24", -# "delete system ntp listen-address 10.1.3.1", -# "delete system ntp server ser", -# "set system ntp allow-clients address 10.3.3.0/24", -# "set system ntp listen-address 10.7.8.1", -# "set system ntp server server1 dynamic", -# "set system ntp server server1 prefer", -# "set system ntp server server2 noselect", -# "set system ntp server server2 preempt", -# "set system ntp server serv" +# "delete service ntp allow-clients address 10.6.6.0/24", +# "delete service ntp listen-address 10.1.3.1", +# "delete service ntp server ser", +# "set service ntp allow-clients address 10.3.3.0/24", +# "set service ntp listen-address 10.7.8.1", +# "set service ntp server server1 dynamic", +# "set service ntp server server1 prefer", +# "set service ntp server server2 noselect", +# "set service ntp server server2 preempt", +# "set service ntp server serv" # ] # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.3.3.0/24' -# set system ntp listen-address '10.7.8.1' -# set system ntp server serv -# set system ntp server server1 dynamic -# set system ntp server server1 prefer -# set system ntp server server2 noselect -# set system ntp server server2 preempt -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.3.3.0/24' +# set service ntp listen-address '10.7.8.1' +# set service ntp server serv +# set service ntp server server1 dynamic +# set service ntp server server1 prefer +# set service ntp server server2 noselect +# set service ntp server server2 preempt +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # 4. Using gathered @@ -439,16 +442,16 @@ EXAMPLES = """ # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.3.3.0/24' -# set system ntp listen-address '10.7.8.1' -# set system ntp server serv -# set system ntp server server1 dynamic -# set system ntp server server1 prefer -# set system ntp server server2 noselect -# set system ntp server server2 preempt -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.3.3.0/24' +# set service ntp listen-address '10.7.8.1' +# set service ntp server serv +# set service ntp server server1 dynamic +# set service ntp server server1 prefer +# set service ntp server server2 noselect +# set service ntp server server2 preempt +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # Task @@ -499,16 +502,16 @@ EXAMPLES = """ # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.3.3.0/24' -# set system ntp listen-address '10.7.8.1' -# set system ntp server serv -# set system ntp server server1 dynamic -# set system ntp server server1 prefer -# set system ntp server server2 noselect -# set system ntp server server2 preempt -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.3.3.0/24' +# set service ntp listen-address '10.7.8.1' +# set service ntp server serv +# set service ntp server server1 dynamic +# set service ntp server server1 prefer +# set service ntp server server2 noselect +# set service ntp server server2 preempt +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ @@ -519,16 +522,16 @@ EXAMPLES = """ # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp allow-clients address '10.3.3.0/24' -# set system ntp listen-address '10.7.8.1' -# set system ntp server serv -# set system ntp server server1 dynamic -# set system ntp server server1 prefer -# set system ntp server server2 noselect -# set system ntp server server2 preempt -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp allow-clients address '10.3.3.0/24' +# set service ntp listen-address '10.7.8.1' +# set service ntp server serv +# set service ntp server server1 dynamic +# set service ntp server server1 prefer +# set service ntp server server2 noselect +# set service ntp server server2 preempt +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # # Task @@ -591,20 +594,20 @@ EXAMPLES = """ # }, # "changed": true, # "commands": [ -# "delete system ntp allow-clients", -# "delete system ntp listen-address", -# "delete system ntp server serv", -# "delete system ntp server server1", -# "delete system ntp server server2" +# "delete service ntp allow-clients", +# "delete service ntp listen-address", +# "delete service ntp server serv", +# "delete service ntp server server1", +# "delete service ntp server server2" # # ] # After state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ @@ -615,9 +618,9 @@ EXAMPLES = """ # # Before state: # # ------------- # vyos@vyos:~$ show configuration commands | grep ntp -# set system ntp server time1.vyos.net -# set system ntp server time2.vyos.net -# set system ntp server time3.vyos.net +# set service ntp server time1.vyos.net +# set service ntp server time2.vyos.net +# set service ntp server time3.vyos.net # vyos@vyos:~$ # Task @@ -645,16 +648,16 @@ EXAMPLES = """ # # Task output: # # ------------- # "rendered": [ -# "set system ntp allow-clients address 10.7.7.0/24", -# "set system ntp allow-clients address 10.8.8.0/24", -# "set system ntp listen-address 10.7.9.1", -# "set system ntp server server7", -# "set system ntp server server45 noselect", -# "set system ntp server server45 prefer", -# "set system ntp server server45 pool", -# "set system ntp server time1.vyos.net", -# "set system ntp server time2.vyos.net", -# "set system ntp server time3.vyos.net" +# "set service ntp allow-clients address 10.7.7.0/24", +# "set service ntp allow-clients address 10.8.8.0/24", +# "set service ntp listen-address 10.7.9.1", +# "set service ntp server server7", +# "set service ntp server server45 noselect", +# "set service ntp server server45 prefer", +# "set service ntp server server45 pool", +# "set service ntp server time1.vyos.net", +# "set service ntp server time2.vyos.net", +# "set service ntp server time3.vyos.net" # ] @@ -664,15 +667,15 @@ EXAMPLES = """ # # sample_config.cfg: # # ------------- -# "set system ntp allow-clients address 10.7.7.0/24", -# "set system ntp listen-address 10.7.9.1", -# "set system ntp server server45 noselect", -# "set system ntp allow-clients addres 10.8.6.0/24", -# "set system ntp listen-address 10.5.4.1", -# "set system ntp server server45 dynamic", -# "set system ntp server time1.vyos.net", -# "set system ntp server time2.vyos.net", -# "set system ntp server time3.vyos.net" +# "set service ntp allow-clients address 10.7.7.0/24", +# "set service ntp listen-address 10.7.9.1", +# "set service ntp server server45 noselect", +# "set service ntp allow-clients addres 10.8.6.0/24", +# "set service ntp listen-address 10.5.4.1", +# "set service ntp server server45 dynamic", +# "set service ntp server time1.vyos.net", +# "set service ntp server time2.vyos.net", +# "set service ntp server time3.vyos.net" # Task: # ------------- @@ -714,6 +717,7 @@ EXAMPLES = """ # ] # } """ + RETURN = """ before: description: The configuration prior to the module execution. @@ -749,7 +753,6 @@ rendered: - set system ntp server server2 noselect - set system ntp server server2 preempt - set system ntp server server_add preempt - gathered: description: Facts about the network resource gathered from the remote device as structured data. returned: when I(state) is C(gathered) @@ -766,7 +769,6 @@ parsed: module argspec. """ - from ansible.module_utils.basic import AnsibleModule from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.ntp_global.ntp_global import ( diff --git a/plugins/modules/vyos_ospf_interfaces.py b/plugins/modules/vyos_ospf_interfaces.py index 3329058..f86acb7 100644 --- a/plugins/modules/vyos_ospf_interfaces.py +++ b/plugins/modules/vyos_ospf_interfaces.py @@ -1,27 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2020 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -############################################# -# WARNING # -############################################# -# -# This file is auto generated by the resource -# module builder playbook. -# -# Do not edit this file manually. -# -# Changes to this file will be over written -# by the resource module builder. -# -# Changes should be made in the model used to -# generate this file or in the resource module -# builder template. -# -############################################# - """ The module file for vyos_ospf_interfaces """ @@ -153,6 +135,7 @@ options: - rendered default: merged """ + EXAMPLES = """ # Using merged # @@ -881,6 +864,53 @@ EXAMPLES = """ # ], """ +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - "set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'" + - "set interfaces bonding bond2 ip ospf bandwidth '70'" + - "set interfaces bonding bond2 ip ospf transmit-delay '45'" +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - "set interfaces bonding bond2 ip ospf authentication md5 key-id 10 md5-key '1111111111232345'" + - "set interfaces bonding bond2 ip ospf bandwidth '70'" + - "set interfaces bonding bond2 ip ospf transmit-delay '45'" +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. +""" + from ansible.module_utils.basic import AnsibleModule from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.ospf_interfaces.ospf_interfaces import ( @@ -899,8 +929,14 @@ def main(): """ module = AnsibleModule( argument_spec=Ospf_interfacesArgs.argument_spec, - mutually_exclusive=[], - required_if=[], + mutually_exclusive=[["config", "running_config"]], + required_if=[ + ["state", "merged", ["config"]], + ["state", "replaced", ["config"]], + ["state", "overridden", ["config"]], + ["state", "rendered", ["config"]], + ["state", "parsed", ["running_config"]], + ], supports_check_mode=True, ) diff --git a/plugins/modules/vyos_ospfv2.py b/plugins/modules/vyos_ospfv2.py index 10e4974..a72b7fd 100644 --- a/plugins/modules/vyos_ospfv2.py +++ b/plugins/modules/vyos_ospfv2.py @@ -31,16 +31,23 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_ospfv2 +version_added: '1.0.0' short_description: OSPFv2 resource module description: This resource module configures and manages attributes of OSPFv2 routes on VyOS network devices. -version_added: 1.0.0 notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +- Tested against VyOS 1.3.8 +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Rohit Thakur (@rohitthakur2590) options: @@ -358,7 +365,6 @@ options: - gathered - rendered default: merged - """ EXAMPLES = """ # Using merged @@ -378,54 +384,54 @@ EXAMPLES = """ administrative: true on_shutdown: 10 on_startup: 10 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: ingress - mpls_te: - enabled: true - router_address: 192.0.11.11 - auto_cost: - reference_bandwidth: 2 - neighbor: - - neighbor_id: 192.0.11.12 - poll_interval: 10 - priority: 2 - redistribute: - - route_type: bgp - metric: 10 - metric_type: 2 - passive_interface: - - eth1 - - eth2 - parameters: - router_id: 192.0.1.1 - opaque_lsa: true - rfc1583_compatibility: true - abr_type: cisco - areas: - - area_id: '2' - area_type: - normal: true - authentication: plaintext-password - shortcut: enable - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: 192.0.2.0/24 - range: - - address: 192.0.3.0/24 - cost: 10 - - address: 192.0.4.0/24 - cost: 12 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: ingress + mpls_te: + enabled: true + router_address: 192.0.11.11 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + passive_interface: + - eth1 + - eth2 + parameters: + router_id: 192.0.1.1 + opaque_lsa: true + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: 2 + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: 3 + area_type: + nssa: + set: true + - area_id: 4 + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + range: + - address: 192.0.3.0/24 + cost: 10 + - address: 192.0.4.0/24 + cost: 12 state: merged # # @@ -909,52 +915,51 @@ EXAMPLES = """ administrative: true on_shutdown: 10 on_startup: 10 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: ingress - mpls_te: - enabled: true - router_address: 192.0.22.22 - auto_cost: - reference_bandwidth: 2 - neighbor: - - neighbor_id: 192.0.11.12 - poll_interval: 10 - priority: 2 - redistribute: - - route_type: bgp - metric: 10 - metric_type: 2 - passive_interface: - - eth1 - parameters: - router_id: 192.0.1.1 - opaque_lsa: true - rfc1583_compatibility: true - abr_type: cisco - areas: - - area_id: '2' - area_type: - normal: true - authentication: plaintext-password - shortcut: enable - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: 192.0.2.0/24 - - address: 192.0.12.0/24 - - address: 192.0.22.0/24 - - address: 192.0.32.0/24 - range: - - address: 192.0.42.0/24 - cost: 10 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: ingress + mpls_te: + enabled: true + router_address: 192.0.22.22 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + passive_interface: + - 'eth1' + parameters: + router_id: 192.0.1.1 + opaque_lsa: true + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: 2 + area_type: + normal: true + authentication: "plaintext-password" + shortcut: 'enable' + - area_id: 4 + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + - address: 192.0.12.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 + range: + - address: 1.1.2.0/24 + cost: 10 state: replaced - # # # ------------------------- @@ -1061,8 +1066,8 @@ EXAMPLES = """ # "delete protocols ospf area 4 range 192.0.4.0/24 cost", # "delete protocols ospf area 4 range 192.0.4.0/24", # "set protocols ospf mpls-te router-address '192.0.22.22'", -# "set protocols ospf area 4 range 192.0.42.0/24 cost 10", -# "set protocols ospf area 4 range 192.0.42.0/24", +# "set protocols ospf area 4 range 1.1.2.0/24 cost 10", +# "set protocols ospf area 4 range 1.1.2.0/24", # "set protocols ospf area 4 network 192.0.12.0/24", # "set protocols ospf area 4 network 192.0.22.0/24", # "set protocols ospf area 4 network 192.0.32.0/24" @@ -1102,7 +1107,7 @@ EXAMPLES = """ # ], # "range": [ # { -# "address": "192.0.42.0/24", +# "address": "1.1.2.0/24", # "cost": 10 # } # ] @@ -1168,7 +1173,7 @@ EXAMPLES = """ # set protocols ospf area 4 network '192.0.12.0/24' # set protocols ospf area 4 network '192.0.22.0/24' # set protocols ospf area 4 network '192.0.32.0/24' -# set protocols ospf area 4 range 192.0.42.0/24 cost '10' +# set protocols ospf area 4 range 1.1.2.0/24 cost '10' # set protocols ospf auto-cost reference-bandwidth '2' # set protocols ospf default-information originate 'always' # set protocols ospf default-information originate metric '10' @@ -1203,54 +1208,54 @@ EXAMPLES = """ administrative: true on_shutdown: 10 on_startup: 10 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: ingress - mpls_te: - enabled: true - router_address: 192.0.11.11 - auto_cost: - reference_bandwidth: 2 - neighbor: - - neighbor_id: 192.0.11.12 - poll_interval: 10 - priority: 2 - redistribute: - - route_type: bgp - metric: 10 - metric_type: 2 - passive_interface: - - eth1 - - eth2 - parameters: - router_id: 192.0.1.1 - opaque_lsa: true - rfc1583_compatibility: true - abr_type: cisco - areas: - - area_id: '2' - area_type: - normal: true - authentication: plaintext-password - shortcut: enable - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: 192.0.2.0/24 - range: - - address: 192.0.3.0/24 - cost: 10 - - address: 192.0.4.0/24 - cost: 12 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: ingress + mpls_te: + enabled: true + router_address: 192.0.11.11 + auto_cost: + reference_bandwidth: 2 + neighbor: + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 + redistribute: + - route_type: bgp + metric: 10 + metric_type: 2 + passive_interface: + - 'eth1' + - 'eth2' + parameters: + router_id: 192.0.1.1 + opaque_lsa: true + rfc1583_compatibility: true + abr_type: cisco + areas: + - area_id: 2 + area_type: + normal: true + authentication: "plaintext-password" + shortcut: enable + - area_id: 3 + area_type: + nssa: + set: true + - area_id: 4 + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + range: + - address: 192.0.3.0/24 + cost: 10 + - address: 192.0.4.0/24 + cost: 12 state: rendered # # @@ -1260,7 +1265,6 @@ EXAMPLES = """ # # # "rendered": [ -# [ # "set protocols ospf mpls-te enable", # "set protocols ospf mpls-te router-address '192.0.11.11'", # "set protocols ospf redistribute bgp", @@ -1303,38 +1307,38 @@ EXAMPLES = """ # Using parsed # # -- name: Parse the commands for provided structured configuration +- name: Parse the commands for provided configuration vyos.vyos.vyos_ospfv2: - running_config: - "set protocols ospf area 2 area-type 'normal' - set protocols ospf area 2 authentication 'plaintext-password' - set protocols ospf area 2 shortcut 'enable' - set protocols ospf area 3 area-type 'nssa' - set protocols ospf area 4 area-type stub default-cost '20' - set protocols ospf area 4 network '192.0.2.0/24' - set protocols ospf area 4 range 192.0.3.0/24 cost '10' - set protocols ospf area 4 range 192.0.4.0/24 cost '12' - set protocols ospf auto-cost reference-bandwidth '2' - set protocols ospf default-information originate 'always' - set protocols ospf default-information originate metric '10' - set protocols ospf default-information originate metric-type '2' - set protocols ospf default-information originate route-map 'ingress' - set protocols ospf log-adjacency-changes 'detail' - set protocols ospf max-metric router-lsa 'administrative' - set protocols ospf max-metric router-lsa on-shutdown '10' - set protocols ospf max-metric router-lsa on-startup '10' - set protocols ospf mpls-te 'enable' - set protocols ospf mpls-te router-address '192.0.11.11' - set protocols ospf neighbor 192.0.11.12 poll-interval '10' - set protocols ospf neighbor 192.0.11.12 priority '2' - set protocols ospf parameters abr-type 'cisco' - set protocols ospf parameters 'opaque-lsa' - set protocols ospf parameters 'rfc1583-compatibility' - set protocols ospf parameters router-id '192.0.1.1' - set protocols ospf passive-interface 'eth1' - set protocols ospf passive-interface 'eth2' - set protocols ospf redistribute bgp metric '10' - set protocols ospf redistribute bgp metric-type '2'" + running_config: | + set protocols ospf area 2 area-type 'normal' + set protocols ospf area 2 authentication 'plaintext-password' + set protocols ospf area 2 shortcut 'enable' + set protocols ospf area 3 area-type 'nssa' + set protocols ospf area 4 area-type stub default-cost '20' + set protocols ospf area 4 network '192.0.2.0/24' + set protocols ospf area 4 range 192.0.3.0/24 cost '10' + set protocols ospf area 4 range 192.0.4.0/24 cost '12' + set protocols ospf auto-cost reference-bandwidth '2' + set protocols ospf default-information originate 'always' + set protocols ospf default-information originate metric '10' + set protocols ospf default-information originate metric-type '2' + set protocols ospf default-information originate route-map 'ingress' + set protocols ospf log-adjacency-changes 'detail' + set protocols ospf max-metric router-lsa 'administrative' + set protocols ospf max-metric router-lsa on-shutdown '10' + set protocols ospf max-metric router-lsa on-startup '10' + set protocols ospf mpls-te 'enable' + set protocols ospf mpls-te router-address '192.0.11.11' + set protocols ospf neighbor 192.0.11.12 poll-interval '10' + set protocols ospf neighbor 192.0.11.12 priority '2' + set protocols ospf parameters abr-type 'cisco' + set protocols ospf parameters 'opaque-lsa' + set protocols ospf parameters 'rfc1583-compatibility' + set protocols ospf parameters router-id '192.0.1.1' + set protocols ospf passive-interface 'eth1' + set protocols ospf passive-interface 'eth2' + set protocols ospf redistribute bgp metric '10' + set protocols ospf redistribute bgp metric-type '2' state: parsed # # @@ -1755,7 +1759,6 @@ EXAMPLES = """ # After state # ------------ # vyos@192# run show configuration commands | grep ospf -# """ RETURN = """ before: @@ -1779,6 +1782,7 @@ commands: sample: - "set protocols ospf parameters router-id 192.0.1.1" - "set protocols ospf passive-interface 'eth1'" + """ @@ -1802,9 +1806,11 @@ def main(): ("state", "merged", ("config",)), ("state", "replaced", ("config",)), ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), ("state", "parsed", ("running_config",)), ] mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( argument_spec=Ospfv2Args.argument_spec, required_if=required_if, diff --git a/plugins/modules/vyos_ospfv3.py b/plugins/modules/vyos_ospfv3.py index 8dbaaee..81b2632 100644 --- a/plugins/modules/vyos_ospfv3.py +++ b/plugins/modules/vyos_ospfv3.py @@ -31,18 +31,24 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_ospfv3 -short_description: OSPFV3 resource module -description: This resource module configures and manages attributes of OSPFv3 routes - on VyOS network devices. -version_added: 1.0.0 -notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +version_added: '1.0.0' +short_description: OSPFv3 resource module +description: This resource module configures and manages attributes of OSPFv3 routes on VyOS network devices. author: - Rohit Thakur (@rohitthakur2590) +notes: +- Tested against VyOS 1.3.8 +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). options: config: description: A provided OSPFv3 route configuration. @@ -91,7 +97,12 @@ options: route_type: description: Route type to redistribute. type: str - choices: [bgp, connected, kernel, ripng, static] + choices: + - bgp + - connected + - kernel + - ripng + - static route_map: description: Route map references. type: str @@ -116,7 +127,6 @@ options: - gathered - rendered default: merged - """ EXAMPLES = """ # Using merged @@ -135,18 +145,18 @@ EXAMPLES = """ parameters: router_id: 192.0.2.10 areas: - - area_id: '2' + - area_id: 2 export_list: export1 import_list: import1 + range: - address: '2001:db10::/32' - address: '2001:db20::/32' - address: '2001:db30::/32' - - area_id: '3' + - area_id: 3 range: - address: '2001:db40::/32' state: merged - # # # ------------------------- @@ -242,18 +252,18 @@ EXAMPLES = """ parameters: router_id: 192.0.2.10 areas: - - area_id: '2' + - area_id: 2 export_list: export1 import_list: import1 + range: - address: '2001:db10::/32' - address: '2001:db30::/32' - address: '2001:db50::/32' - - area_id: '4' + - area_id: 4 range: - address: '2001:db60::/32' state: replaced - # # # ------------------------- @@ -367,18 +377,18 @@ EXAMPLES = """ parameters: router_id: 192.0.2.10 areas: - - area_id: '2' + - area_id: 2 export_list: export1 import_list: import1 + range: - address: '2001:db10::/32' - address: '2001:db20::/32' - address: '2001:db30::/32' - - area_id: '3' + - area_id: 3 range: - address: '2001:db40::/32' state: rendered - # # # ------------------------- @@ -404,17 +414,17 @@ EXAMPLES = """ # Using parsed # # -- name: Parse the commands to provide structured configuration. +- name: Parse the commands from the provided configuration vyos.vyos.vyos_ospfv3: - running_config: - "set protocols ospfv3 area 2 export-list 'export1' - set protocols ospfv3 area 2 import-list 'import1' - set protocols ospfv3 area 2 range '2001:db10::/32' - set protocols ospfv3 area 2 range '2001:db20::/32' - set protocols ospfv3 area 2 range '2001:db30::/32' - set protocols ospfv3 area 3 range '2001:db40::/32' - set protocols ospfv3 parameters router-id '192.0.2.10' - set protocols ospfv3 redistribute 'bgp'" + running_config: | + set protocols ospfv3 area 2 export-list 'export1' + set protocols ospfv3 area 2 import-list 'import1' + set protocols ospfv3 area 2 range '2001:db10::/32' + set protocols ospfv3 area 2 range '2001:db20::/32' + set protocols ospfv3 area 2 range '2001:db30::/32' + set protocols ospfv3 area 3 range '2001:db40::/32' + set protocols ospfv3 parameters router-id '192.0.2.10' + set protocols ospfv3 redistribute 'bgp' state: parsed # # @@ -627,8 +637,9 @@ commands: returned: always type: list sample: - - "set protocols ospf parameters router-id 192.0.1.1" - - "set protocols ospfv3 area 2 range '2001:db10::/32'" + - "set protocols ospfv3 parameters router-id '192.0.2.10'" + - "set protocols ospfv3 redistribute 'bgp'" + """ @@ -652,9 +663,11 @@ def main(): ("state", "merged", ("config",)), ("state", "replaced", ("config",)), ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), ("state", "parsed", ("running_config",)), ] mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( argument_spec=Ospfv3Args.argument_spec, required_if=required_if, diff --git a/plugins/modules/vyos_prefix_lists.py b/plugins/modules/vyos_prefix_lists.py index c0d50d3..71d52b3 100644 --- a/plugins/modules/vyos_prefix_lists.py +++ b/plugins/modules/vyos_prefix_lists.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -1244,24 +1244,23 @@ EXAMPLES = """ """ RETURN = """ - before: - description: The configuration prior to the module invocation. - returned: when state is I(merged), I(replaced), I(overridden) or I(deleted) - type: list + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict sample: > This output will always be in the same format as the module argspec. after: - description: The resulting configuration after the module invocation. + description: The resulting configuration after module execution. returned: when changed - type: list + type: dict sample: > This output will always be in the same format as the module argspec. commands: - description: The set of commands pushed to the remote device for the required configurations to take place. - returned: when state is I(merged), I(replaced), I(overridden) or I(deleted) + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list sample: - set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible' @@ -1269,7 +1268,7 @@ commands: - set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks' rendered: description: The provided configuration in the task rendered in device-native format (offline). - returned: when state is I(rendered) + returned: when I(state) is C(rendered) type: list sample: - set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible' @@ -1277,22 +1276,20 @@ rendered: - set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks' gathered: description: Facts about the network resource gathered from the remote device as structured data. - returned: when state is I(gathered) + returned: when I(state) is C(gathered) type: list sample: > This output will always be in the same format as the module argspec. parsed: description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. - returned: when state is I(parsed) + returned: when I(state) is C(parsed) type: list sample: > This output will always be in the same format as the module argspec. - """ - from ansible.module_utils.basic import AnsibleModule from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.prefix_lists.prefix_lists import ( diff --git a/plugins/modules/vyos_route_maps.py b/plugins/modules/vyos_route_maps.py index bff6859..67d327a 100644 --- a/plugins/modules/vyos_route_maps.py +++ b/plugins/modules/vyos_route_maps.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2021 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -15,13 +15,13 @@ __metaclass__ = type DOCUMENTATION = """ module: vyos_route_maps -version_added: 2.3.0 -short_description: Route Map Resource Module. +version_added: "1.0.0" +short_description: Route Map resource module description: - This module manages route map configurations on devices running VYOS. author: Ashwini Mhatre (@amhatre) notes: -- Tested against vyos 1.2. +- Tested against vyos 1.3.8 - This module works with connection C(network_cli). options: config: @@ -259,6 +259,7 @@ options: - parsed default: merged """ + EXAMPLES = """ # Using merged # Before state @@ -916,6 +917,53 @@ EXAMPLES = """ # ], """ +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - "set policy route-map test3 rule 1 set local-preference 6" + - "set policy route-map test3 rule 1 set metric 4" + - "set policy route-map test3 rule 1 set tag 4" +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - "set policy route-map test3 rule 1 set local-preference 6" + - "set policy route-map test3 rule 1 set metric 4" + - "set policy route-map test3 rule 1 set tag 4" +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. +""" + from ansible.module_utils.basic import AnsibleModule from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.route_maps.route_maps import ( diff --git a/plugins/modules/vyos_snmp_server.py b/plugins/modules/vyos_snmp_server.py index 5eb69b8..87ddb79 100644 --- a/plugins/modules/vyos_snmp_server.py +++ b/plugins/modules/vyos_snmp_server.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# Copyright 2022 Red Hat +# Copyright 2024 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -15,12 +15,12 @@ __metaclass__ = type DOCUMENTATION = """ module: vyos_snmp_server -version_added: 2.7.0 +version_added: "1.0.0" short_description: Manages snmp_server resource module description: This module manages the snmp server attributes of Vyos network devices author: Gomathi Selvi Srinivasan (@GomathiselviS) notes: - - Tested against vyos 1.1.8 + - Tested against vyos 1.3.8 - This module works with connection C(network_cli). - The Configuration defaults of the Vyos network devices are supposed to hinder idempotent behavior of plays @@ -261,8 +261,8 @@ options: - The state the configuration should be left in type: str """ -EXAMPLES = """ +EXAMPLES = """ # Using merged # Before State: @@ -1058,19 +1058,17 @@ commands: returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list sample: - set service snmp community routers authorization 'ro' - set service snmp community routers client '203.0.113.10' - set service snmp community routers client '203.0.113.20' - set service snmp community routers network '192.0.2.0/24' + - "set service snmp community routers authorization 'ro'" + - "set service snmp community routers client '203.0.113.10'" + - "set service snmp community routers network '192.0.2.0/24'" rendered: description: The provided configuration in the task rendered in device-native format (offline). returned: when I(state) is C(rendered) type: list sample: - set service snmp community routers authorization 'ro' - set service snmp community routers client '203.0.113.10' - set service snmp community routers client '203.0.113.20' - set service snmp community routers network '192.0.2.0/24' + - "set service snmp community routers authorization 'ro'" + - "set service snmp community routers client '203.0.113.10'" + - "set service snmp community routers network '192.0.2.0/24'" gathered: description: Facts about the network resource gathered from the remote device as structured data. returned: when I(state) is C(gathered) diff --git a/plugins/modules/vyos_static_routes.py b/plugins/modules/vyos_static_routes.py index df9c501..76fccaf 100644 --- a/plugins/modules/vyos_static_routes.py +++ b/plugins/modules/vyos_static_routes.py @@ -31,15 +31,22 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} DOCUMENTATION = """ +--- module: vyos_static_routes +version_added: '1.0.0' short_description: Static routes resource module description: This module manages attributes of static routes on VyOS network devices. -version_added: 1.0.0 notes: -- Tested against VyOS 1.1.8 (helium). -- This module works with connection C(ansible.netcommon.network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +- Tested against VyOS 1.3.8. +- This module works with connection C(ansible.netcommon.network_cli). + See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Rohit Thakur (@rohitthakur2590) options: @@ -163,7 +170,6 @@ EXAMPLES = """ - forward_router_address: '2001:db8:2000:2::1' - forward_router_address: '2001:db8:2000:2::2' state: merged - # # # ------------------------- @@ -708,12 +714,12 @@ EXAMPLES = """ - address_families: - afi: ipv6 routes: - - dest: 2001:db8:1000::/36 + - dest: '2001:db8:1000::/36' blackhole_config: distance: 2 next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 + - forward_router_address: '2001:db8:2000:2::1' + - forward_router_address: '2001:db8:2000:2::2' state: rendered # # @@ -739,13 +745,13 @@ EXAMPLES = """ # - name: Parse the provided running configuration vyos.vyos.vyos_static_routes: - running_config: - "set protocols static route 192.0.2.32/28 'blackhole' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.6' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.7' - set protocols static route6 2001:db8:1000::/36 blackhole distance '2' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'" + running_config: | + set protocols static route 192.0.2.32/28 'blackhole' + set protocols static route 192.0.2.32/28 next-hop '192.0.2.6' + set protocols static route 192.0.2.32/28 next-hop '192.0.2.7' + set protocols static route6 2001:db8:1000::/36 blackhole distance '2' + set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' + set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2' state: parsed # # @@ -878,14 +884,14 @@ RETURN = """ before: description: The configuration prior to the model invocation. returned: always - type: list + type: dict sample: > The configuration returned will always be in the same format of the parameters above. after: description: The resulting configuration model invocation. returned: when changed - type: list + type: dict sample: > The configuration returned will always be in the same format of the parameters above. @@ -896,6 +902,7 @@ commands: sample: - "set protocols static route 192.0.2.32/28 next-hop '192.0.2.6'" - "set protocols static route 192.0.2.32/28 'blackhole'" + """ @@ -930,6 +937,7 @@ def main(): supports_check_mode=True, mutually_exclusive=mutually_exclusive, ) + result = Static_routes(module).execute_module() module.exit_json(**result) |