diff options
Diffstat (limited to 'plugins')
39 files changed, 1967 insertions, 1549 deletions
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 9868fc6b..13f9fab0 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 22af6394..b647ea91 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 f79454ed..8421b6de 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 4d0973e3..74fa9c12 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 b69f2f10..12864e66 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 fecfb48f..14b67c28 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 db333767..4dee518e 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 dce4fb7b..956c4385 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 734274a1..5c33d674 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 672b7f0d..37a6afb0 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 93b29f4a..0be49e51 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 fca9bf1e..cbbfd22e 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 1fd33700..0b5814be 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 bd7f94d9..0a422e89 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 4ea88b6e..a59606dd 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 d2741446..b01a3e82 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 b2038a48..196db0c7 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 7cea6887..7d0fefec 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 916ad260..2849b8b7 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 d6f89259..b3756e2e 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 f9c0eeb3..7d47e4ad 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 befe5e73..e952ae50 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 2feabe49..ae17bc13 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 fd2e7d55..d8c7a1c9 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 bc039b55..480b011f 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 c7a2168f..b679a226 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 0849c296..0d2a5dae 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 0605f068..090021ad 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 5d215f68..e2f7914e 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 6628f65b..14160c76 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 06ebe48d..069d5080 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 0fe56ad0..4fd9891b 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 33290581..f86acb7a 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 10e49740..a72b7fd2 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 8dbaaeee..81b26327 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 c0d50d31..71d52b32 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 bff6859d..67d327a6 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 5eb69b88..87ddb794 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 df9c501e..76fccaf9 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) |