summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/nxos/plugins/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/nxos/plugins/modules')
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_aaa_server_host.py5
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_acl_interfaces.py147
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_acls.py76
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_bfd_interfaces.py48
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_address_family.py72
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_global.py56
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_neighbor_address_family.py44
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_command.py25
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_config.py58
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_devicealias.py58
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_evpn_vni.py8
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_facts.py10
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_fc_interfaces.py98
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_gir_profile_management.py4
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_hostname.py1
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_hsrp_interfaces.py37
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_igmp_interface.py18
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_install_os.py7
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_interfaces.py62
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_l2_interfaces.py54
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_l3_interfaces.py70
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_lacp_interfaces.py40
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_lag_interfaces.py40
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_lldp_interfaces.py30
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_logging.py940
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_logging_global.py4
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ntp.py446
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_auth.py336
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_global.py44
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_options.py173
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ospf_interfaces.py197
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv2.py278
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv3.py278
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_route_maps.py128
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_snmp_server.py90
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_static_routes.py126
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_system.py8
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_telemetry.py84
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_user.py4
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py42
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_vrf.py46
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_vrf_af.py74
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_vsan.py62
-rw-r--r--ansible_collections/cisco/nxos/plugins/modules/nxos_zone_zoneset.py226
44 files changed, 1430 insertions, 3224 deletions
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_aaa_server_host.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_aaa_server_host.py
index d2f84f76d..192b21ab5 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_aaa_server_host.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_aaa_server_host.py
@@ -114,7 +114,6 @@ EXAMPLES = """
tacacs_port: 89
host_timeout: 10
address: 5.6.7.8
-
"""
RETURN = """
@@ -315,7 +314,9 @@ def main():
module.fail_json(msg="tacacs_port can only be used with server_type=tacacs")
if (auth_port or acct_port) and server_type != "radius":
- module.fail_json(msg="auth_port and acct_port can only be used" "when server_type=radius")
+ module.fail_json(
+ msg="auth_port and acct_port can only be used" "when server_type=radius",
+ )
existing = get_aaa_host_info(module, server_type, address)
end_state = existing
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_acl_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_acl_interfaces.py
index e61746ff3..654fc71e6 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_acl_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_acl_interfaces.py
@@ -116,28 +116,28 @@ EXAMPLES = """
- name: Merge ACL interfaces configuration
cisco.nxos.nxos_acl_interfaces:
config:
- - name: Ethernet1/2
- access_groups:
- - afi: ipv6
- acls:
- - name: ACL1v6
- direction: in
-
- - name: Eth1/5
- access_groups:
- - afi: ipv4
- acls:
- - name: PortACL
- direction: in
- port: true
-
- - name: ACL1v4
- direction: out
-
- - afi: ipv6
- acls:
- - name: ACL1v6
- direction: in
+ - name: Ethernet1/2
+ access_groups:
+ - afi: ipv6
+ acls:
+ - name: ACL1v6
+ direction: in
+
+ - name: Eth1/5
+ access_groups:
+ - afi: ipv4
+ acls:
+ - name: PortACL
+ direction: in
+ port: true
+
+ - name: ACL1v4
+ direction: out
+
+ - afi: ipv6
+ acls:
+ - name: ACL1v6
+ direction: in
state: merged
# After state:
@@ -163,20 +163,20 @@ EXAMPLES = """
- name: Replace interface configuration with given configuration
cisco.nxos.nxos_acl_interfaces:
config:
- - name: Eth1/5
- access_groups:
- - afi: ipv4
- acls:
- - name: NewACLv4
- direction: out
-
- - name: Ethernet1/3
- access_groups:
- - afi: ipv6
- acls:
- - name: NewACLv6
- direction: in
- port: true
+ - name: Eth1/5
+ access_groups:
+ - afi: ipv4
+ acls:
+ - name: NewACLv4
+ direction: out
+
+ - name: Ethernet1/3
+ access_groups:
+ - afi: ipv6
+ acls:
+ - name: NewACLv6
+ direction: in
+ port: true
state: replaced
# After state:
@@ -202,21 +202,21 @@ EXAMPLES = """
- name: Override interface configuration with given configuration
cisco.nxos.nxos_acl_interfaces:
config:
- - name: Ethernet1/3
- access_groups:
- - afi: ipv4
- acls:
- - name: ACL1v4
- direction: out
-
- - name: PortACL
- port: true
- direction: in
- - afi: ipv6
- acls:
- - name: NewACLv6
- direction: in
- port: true
+ - name: Ethernet1/3
+ access_groups:
+ - afi: ipv4
+ acls:
+ - name: ACL1v4
+ direction: out
+
+ - name: PortACL
+ port: true
+ direction: in
+ - afi: ipv6
+ acls:
+ - name: NewACLv6
+ direction: in
+ port: true
state: overridden
# After state:
@@ -242,8 +242,8 @@ EXAMPLES = """
- name: Delete ACL configuration on interfaces
cisco.nxos.nxos_acl_interfaces:
config:
- - name: Ethernet1/5
- - name: Ethernet1/2
+ - name: Ethernet1/5
+ - name: Ethernet1/2
state: deleted
# After state:
@@ -356,28 +356,28 @@ EXAMPLES = """
- name: Render required configuration to be pushed to the device
cisco.nxos.nxos_acl_interfaces:
config:
- - name: Ethernet1/2
- access_groups:
- - afi: ipv6
- acls:
- - name: ACL1v6
- direction: in
-
- - name: Ethernet1/5
- access_groups:
- - afi: ipv4
- acls:
- - name: PortACL
- direction: in
- port: true
- - name: ACL1v4
- direction: out
- - afi: ipv6
- acls:
- - name: ACL1v6
- direction: in
+ - name: Ethernet1/2
+ access_groups:
+ - afi: ipv6
+ acls:
+ - name: ACL1v6
+ direction: in
+ - name: Ethernet1/5
+ access_groups:
+ - afi: ipv4
+ acls:
+ - name: PortACL
+ direction: in
+ port: true
+ - name: ACL1v4
+ direction: out
+ - afi: ipv6
+ acls:
+ - name: ACL1v6
+ direction: in
state: rendered
+
# returns
# rendered:
# interface Ethernet1/2
@@ -386,7 +386,6 @@ EXAMPLES = """
# ipv6 traffic-filter ACL1v6 in
# ip access-group ACL1v4 out
# ip port access-group PortACL in
-
"""
RETURN = """
before:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_acls.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_acls.py
index 133bd3a44..29d610400 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_acls.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_acls.py
@@ -536,13 +536,13 @@ EXAMPLES = """
acls:
- name: ACL1v6
aces:
- - grant: permit
- sequence: 10
- source:
- any: true
- destination:
- prefix: 2001:db8:12::/32
- protocol: sctp
+ - grant: permit
+ sequence: 10
+ source:
+ any: true
+ destination:
+ prefix: 2001:db8:12::/32
+ protocol: sctp
# Task Output
# -----------
@@ -974,7 +974,7 @@ EXAMPLES = """
- name: Delete all ACLs in given AFI
cisco.nxos.nxos_acls:
config:
- - afi: ipv4
+ - afi: ipv4
state: deleted
# Task Output
@@ -1309,38 +1309,38 @@ EXAMPLES = """
- name: Render required configuration to be pushed to the device
cisco.nxos.nxos_acls:
config:
- - afi: ipv4
- acls:
- - name: ACL1v4
- aces:
- - grant: deny
- destination:
- address: 192.0.2.64
- wildcard_bits: 0.0.0.255
- source:
- any: true
- port_protocol:
- lt: 55
- protocol: tcp
- protocol_options:
- tcp:
- ack: true
- fin: true
- sequence: 50
-
- - afi: ipv6
- acls:
- - name: ACL1v6
- aces:
- - grant: permit
- sequence: 10
- source:
- any: true
- destination:
- prefix: 2001:db8:12::/32
- protocol: sctp
+ - afi: ipv4
+ acls:
+ - name: ACL1v4
+ aces:
+ - grant: deny
+ destination:
+ address: 192.0.2.64
+ wildcard_bits: 0.0.0.255
+ source:
+ any: true
+ port_protocol:
+ lt: 55
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ fin: true
+ sequence: 50
+ - afi: ipv6
+ acls:
+ - name: ACL1v6
+ aces:
+ - grant: permit
+ sequence: 10
+ source:
+ any: true
+ destination:
+ prefix: '2001:db8:12::/32'
+ protocol: sctp
state: rendered
+
# Task Output
# -----------
#
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_bfd_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_bfd_interfaces.py
index 1790f8e01..3465d95bb 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_bfd_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_bfd_interfaces.py
@@ -104,12 +104,12 @@ EXAMPLES = """
- name: Configure interfaces
cisco.nxos.nxos_bfd_interfaces:
config:
- - name: Ethernet1/1
- bfd: enable
- echo: enable
- - name: Ethernet1/2
- bfd: disable
- echo: disable
+ - name: Ethernet1/1
+ bfd: enable
+ echo: enable
+ - name: Ethernet1/2
+ bfd: disable
+ echo: disable
state: merged
@@ -118,12 +118,12 @@ EXAMPLES = """
- name: Configure interfaces
cisco.nxos.nxos_bfd_interfaces:
config:
- - name: Ethernet1/1
- bfd: enable
- echo: enable
- - name: Ethernet1/2
- bfd: disable
- echo: disable
+ - name: Ethernet1/1
+ bfd: enable
+ echo: enable
+ - name: Ethernet1/2
+ bfd: disable
+ echo: disable
state: overridden
@@ -132,12 +132,12 @@ EXAMPLES = """
- name: Configure interfaces
cisco.nxos.nxos_bfd_interfaces:
config:
- - name: Ethernet1/1
- bfd: enable
- echo: enable
- - name: Ethernet1/2
- bfd: disable
- echo: disable
+ - name: Ethernet1/1
+ bfd: enable
+ echo: enable
+ - name: Ethernet1/2
+ bfd: disable
+ echo: disable
state: replaced
# Using rendered
@@ -145,12 +145,12 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_bfd_interfaces:
config:
- - name: Ethernet1/800
- bfd: enable
- echo: enable
- - name: Ethernet1/801
- bfd: disable
- echo: disable
+ - name: Ethernet1/800
+ bfd: enable
+ echo: enable
+ - name: Ethernet1/801
+ bfd: disable
+ echo: disable
state: rendered
# Task Output (redacted)
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_address_family.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_address_family.py
index ef6e9012c..489b6fa30 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_address_family.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_address_family.py
@@ -52,7 +52,7 @@ options:
description: Address Family indicator.
type: str
choices: ["ipv4", "ipv6", "link-state", "vpnv4", "vpnv6", "l2vpn"]
- required: True
+ required: true
safi:
description: Sub Address Family indicator.
type: str
@@ -367,11 +367,11 @@ EXAMPLES = """
safi: unicast
vrf: site-1
default_information:
- originate: True
+ originate: true
aggregate_address:
- prefix: 203.0.113.0/24
- as_set: True
- summary_only: True
+ as_set: true
+ summary_only: true
- afi: ipv6
safi: multicast
vrf: site-1
@@ -420,11 +420,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv6
# safi: multicast
# vrf: site-1
@@ -490,8 +490,8 @@ EXAMPLES = """
non_critical_delay: 180
aggregate_address:
- prefix: 203.0.113.0/24
- as_set: True
- summary_only: True
+ as_set: true
+ summary_only: true
- afi: ipv4
safi: unicast
vrf: site-1
@@ -517,11 +517,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv6
# safi: multicast
# vrf: site-1
@@ -558,8 +558,8 @@ EXAMPLES = """
# non_critical_delay: 180
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
#
# - afi: ipv4
# safi: unicast
@@ -622,8 +622,8 @@ EXAMPLES = """
route_map: rmap1
aggregate_address:
- prefix: 203.0.113.0/24
- as_set: True
- summary_only: True
+ as_set: true
+ summary_only: true
- afi: ipv4
safi: unicast
vrf: site-1
@@ -649,11 +649,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv6
# safi: multicast
# vrf: site-1
@@ -690,8 +690,8 @@ EXAMPLES = """
# route_map: rmap1
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv4
# safi: unicast
# vrf: site-1
@@ -759,11 +759,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv6
# safi: multicast
# vrf: site-1
@@ -788,11 +788,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# After state:
# ------------
@@ -846,11 +846,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv6
# safi: multicast
# vrf: site-1
@@ -900,11 +900,11 @@ EXAMPLES = """
safi: unicast
vrf: site-1
default_information:
- originate: True
+ originate: true
aggregate_address:
- prefix: 203.0.113.0/24
- as_set: True
- summary_only: True
+ as_set: true
+ summary_only: true
- afi: ipv6
safi: multicast
vrf: site-1
@@ -977,11 +977,11 @@ EXAMPLES = """
# safi: unicast
# vrf: site-1
# default_information:
-# originate: True
+# originate: true
# aggregate_address:
# - prefix: 203.0.113.0/24
-# as_set: True
-# summary_only: True
+# as_set: true
+# summary_only: true
# - afi: ipv6
# safi: multicast
# vrf: site-1
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_global.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_global.py
index 29e016181..59e7eefd7 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_global.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_global.py
@@ -203,7 +203,7 @@ options:
neighbor_address:
description: IP address/Prefix of the neighbor or interface.
type: str
- required: True
+ required: true
bfd:
description: Bidirectional Fast Detection for the neighbor.
type: dict
@@ -543,16 +543,16 @@ EXAMPLES = """
router_id: 192.168.1.1
bestpath:
as_path:
- multipath_relax: True
- compare_neighborid: True
- cost_community_ignore: True
+ multipath_relax: true
+ compare_neighborid: true
+ cost_community_ignore: true
confederation:
identifier: 42
peers:
- 65020
- 65030
- 65040
- log_neighbor_changes: True
+ log_neighbor_changes: true
maxas_limit: 20
neighbors:
- neighbor_address: 192.168.1.100
@@ -562,19 +562,19 @@ EXAMPLES = """
remote_as: 65563
description: NBR-1
low_memory:
- exempt: True
+ exempt: true
- neighbor_address: 192.168.1.101
remote_as: 65563
password:
encryption: 7
key: 12090404011C03162E
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
vrfs:
- vrf: site-1
allocate_index: 5000
local_as: 200
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 198.51.100.1
description: site-1-nbr-1
@@ -587,7 +587,7 @@ EXAMPLES = """
description: site-1-nbr-2
- vrf: site-2
local_as: 300
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 203.0.113.2
description: site-2-nbr-1
@@ -596,7 +596,7 @@ EXAMPLES = """
key: AF92F4C16A0A0EC5BDF56CF58BC030F6
remote_as: 65568
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
# Task output:
# ------------
@@ -795,8 +795,8 @@ EXAMPLES = """
as_number: 65563
router_id: 192.168.1.1
bestpath:
- compare_neighborid: True
- cost_community_ignore: True
+ compare_neighborid: true
+ cost_community_ignore: true
confederation:
identifier: 42
peers:
@@ -812,20 +812,20 @@ EXAMPLES = """
remote_as: 65563
description: NBR-1
low_memory:
- exempt: True
+ exempt: true
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
vrfs:
- vrf: site-2
local_as: 300
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 203.0.113.2
password:
encryption: 7
key: 12090404011C03162E
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
state: replaced
# Task output:
@@ -1258,16 +1258,16 @@ EXAMPLES = """
router_id: 192.168.1.1
bestpath:
as_path:
- multipath_relax: True
- compare_neighborid: True
- cost_community_ignore: True
+ multipath_relax: true
+ compare_neighborid: true
+ cost_community_ignore: true
confederation:
identifier: 42
peers:
- 65020
- 65030
- 65040
- log_neighbor_changes: True
+ log_neighbor_changes: true
maxas_limit: 20
neighbors:
- neighbor_address: 192.168.1.100
@@ -1277,19 +1277,19 @@ EXAMPLES = """
remote_as: 65563
description: NBR-1
low_memory:
- exempt: True
+ exempt: true
- neighbor_address: 192.168.1.101
remote_as: 65563
password:
encryption: 7
key: 12090404011C03162E
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
vrfs:
- vrf: site-1
allocate_index: 5000
local_as: 200
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 198.51.100.1
description: site-1-nbr-1
@@ -1302,7 +1302,7 @@ EXAMPLES = """
description: site-1-nbr-2
- vrf: site-2
local_as: 300
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 203.0.113.2
description: site-1-nbr-1
@@ -1311,7 +1311,7 @@ EXAMPLES = """
key: AF92F4C16A0A0EC5BDF56CF58BC030F6
remote_as: 65568
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
# Task output:
# ------------
@@ -1561,7 +1561,7 @@ EXAMPLES = """
as_number: 65536
router_id: 198.51.100.2
maxas_limit: 20
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 192.0.2.1
remote_as: 65537
@@ -1605,7 +1605,7 @@ EXAMPLES = """
as_number: 65536
router_id: 198.51.100.2
maxas_limit: 20
- log_neighbor_changes: True
+ log_neighbor_changes: true
neighbors:
- neighbor_address: 192.0.2.1
remote_as: 65537
@@ -1615,7 +1615,7 @@ EXAMPLES = """
vrfs:
- vrf: site-2
neighbor_down:
- fib_accelerate: True
+ fib_accelerate: true
state: replaced
# Task output:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_neighbor_address_family.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_neighbor_address_family.py
index e2b72ace3..de41a9bf1 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_neighbor_address_family.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_bgp_neighbor_address_family.py
@@ -51,7 +51,7 @@ options:
neighbor_address:
description: IP/IPv6 address of the neighbor.
type: str
- required: True
+ required: true
address_family:
description: BGP Neighbor Address Family related configurations.
type: list
@@ -61,7 +61,7 @@ options:
description: Address Family indicator.
type: str
choices: ["ipv4", "ipv6", "link-state", "vpnv4", "vpnv6", "l2vpn"]
- required: True
+ required: true
safi:
description: Sub Address Family indicator.
type: str
@@ -73,7 +73,7 @@ options:
route_map:
description: Route-map name.
type: str
- required: True
+ required: true
exist_map:
description: Condition route-map to advertise only when prefix in condition exists.
type: str
@@ -307,9 +307,9 @@ EXAMPLES = """
address_family:
- afi: ipv4
safi: unicast
- suppress_inactive: True
+ suppress_inactive: true
next_hop_self:
- set: True
+ set: true
- neighbor_address: 203.0.113.2
address_family:
- afi: ipv6
@@ -317,7 +317,7 @@ EXAMPLES = """
- afi: ipv4
safi: multicast
send_community:
- set: True
+ set: true
# Task output:
# ------------
@@ -383,7 +383,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
@@ -472,7 +472,7 @@ EXAMPLES = """
- afi: ipv4
safi: multicast
send_community:
- set: True
+ set: true
state: replaced
# Task output:
@@ -515,7 +515,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
#
@@ -562,7 +562,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
@@ -629,9 +629,9 @@ EXAMPLES = """
address_family:
- afi: ipv4
safi: unicast
- suppress_inactive: True
+ suppress_inactive: true
next_hop_self:
- set: True
+ set: true
state: overridden
# Task output:
@@ -674,7 +674,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
#
@@ -708,9 +708,9 @@ EXAMPLES = """
# address_family:
# - afi: ipv4
# safi: unicast
-# suppress_inactive: True
+# suppress_inactive: true
# next_hop_self:
-# set: True
+# set: true
# After state:
# ------------
@@ -809,7 +809,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
#
@@ -850,7 +850,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
#
# After state:
# ------------
@@ -942,7 +942,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
#
@@ -1008,9 +1008,9 @@ EXAMPLES = """
address_family:
- afi: ipv4
safi: unicast
- suppress_inactive: True
+ suppress_inactive: true
next_hop_self:
- set: True
+ set: true
- neighbor_address: 203.0.113.2
address_family:
- afi: ipv6
@@ -1018,7 +1018,7 @@ EXAMPLES = """
- afi: ipv4
safi: multicast
send_community:
- set: True
+ set: true
state: rendered
# Task output:
@@ -1116,7 +1116,7 @@ EXAMPLES = """
# - afi: ipv4
# safi: multicast
# send_community:
-# set: True
+# set: true
# - afi: ipv6
# safi: unicast
"""
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_command.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_command.py
index 7febbf8a7..6c3c2c384 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_command.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_command.py
@@ -87,32 +87,31 @@ EXAMPLES = """
- name: run multiple commands on remote nodes
cisco.nxos.nxos_command:
commands:
- - show version
- - show interfaces
+ - show version
+ - show interfaces
- name: run multiple commands and evaluate the output
cisco.nxos.nxos_command:
commands:
- - show version
- - show interfaces
+ - show version
+ - show interfaces
wait_for:
- - result[0] contains Cisco
- - result[1] contains loopback0
+ - result[0] contains Cisco
+ - result[1] contains loopback0
- name: run commands and specify the output format
cisco.nxos.nxos_command:
commands:
- - command: show version
- output: json
+ - command: show version
+ output: json
- name: run commands that require answering a prompt
cisco.nxos.nxos_command:
commands:
- - configure terminal
- - command: no feature npv
- prompt: Do you want to continue
- answer: y
-
+ - configure terminal
+ - command: no feature npv
+ prompt: Do you want to continue
+ answer: y
"""
RETURN = """
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_config.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_config.py
index 132a62d28..84be30a02 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_config.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_config.py
@@ -246,21 +246,21 @@ EXAMPLES = """
- cisco.nxos.nxos_config:
lines:
- - 10 permit ip 192.0.2.1/32 any log
- - 20 permit ip 192.0.2.2/32 any log
- - 30 permit ip 192.0.2.3/32 any log
- - 40 permit ip 192.0.2.4/32 any log
- - 50 permit ip 192.0.2.5/32 any log
+ - 10 permit ip 192.0.2.1/32 any log
+ - 20 permit ip 192.0.2.2/32 any log
+ - 30 permit ip 192.0.2.3/32 any log
+ - 40 permit ip 192.0.2.4/32 any log
+ - 50 permit ip 192.0.2.5/32 any log
parents: ip access-list test
before: no ip access-list test
match: exact
- cisco.nxos.nxos_config:
lines:
- - 10 permit ip 192.0.2.1/32 any log
- - 20 permit ip 192.0.2.2/32 any log
- - 30 permit ip 192.0.2.3/32 any log
- - 40 permit ip 192.0.2.4/32 any log
+ - 10 permit ip 192.0.2.1/32 any log
+ - 20 permit ip 192.0.2.2/32 any log
+ - 30 permit ip 192.0.2.3/32 any log
+ - 40 permit ip 192.0.2.4/32 any log
parents: ip access-list test
before: no ip access-list test
replace: block
@@ -274,7 +274,7 @@ EXAMPLES = """
cisco.nxos.nxos_config:
lines:
# - shut
- - shutdown
+ - shutdown
# parents: int eth1/1
parents: interface Ethernet1/1
@@ -407,7 +407,10 @@ def main():
defaults=dict(type="bool", default=False),
backup=dict(type="bool", default=False),
backup_options=dict(type="dict", options=backup_spec),
- save_when=dict(choices=["always", "never", "modified", "changed"], default="never"),
+ save_when=dict(
+ choices=["always", "never", "modified", "changed"],
+ default="never",
+ ),
diff_against=dict(choices=["running", "startup", "intended"]),
diff_ignore_lines=dict(type="list", elements="str"),
)
@@ -502,10 +505,21 @@ def main():
if module.params["save_when"] == "always":
save_config(module, result)
elif module.params["save_when"] == "modified":
- output = execute_show_commands(module, ["show running-config", "show startup-config"])
+ output = execute_show_commands(
+ module,
+ ["show running-config", "show startup-config"],
+ )
- running_config = NetworkConfig(indent=2, contents=output[0], ignore_lines=diff_ignore_lines)
- startup_config = NetworkConfig(indent=2, contents=output[1], ignore_lines=diff_ignore_lines)
+ running_config = NetworkConfig(
+ indent=2,
+ contents=output[0],
+ ignore_lines=diff_ignore_lines,
+ )
+ startup_config = NetworkConfig(
+ indent=2,
+ contents=output[1],
+ ignore_lines=diff_ignore_lines,
+ )
if running_config.sha1 != startup_config.sha1:
save_config(module, result)
@@ -520,11 +534,17 @@ def main():
contents = running_config
# recreate the object in order to process diff_ignore_lines
- running_config = NetworkConfig(indent=2, contents=contents, ignore_lines=diff_ignore_lines)
+ running_config = NetworkConfig(
+ indent=2,
+ contents=contents,
+ ignore_lines=diff_ignore_lines,
+ )
if module.params["diff_against"] == "running":
if module.check_mode:
- module.warn("unable to perform diff against running-config due to check mode")
+ module.warn(
+ "unable to perform diff against running-config due to check mode",
+ )
contents = None
else:
contents = config.config_text
@@ -540,7 +560,11 @@ def main():
contents = module.params["intended_config"]
if contents is not None:
- base_config = NetworkConfig(indent=2, contents=contents, ignore_lines=diff_ignore_lines)
+ base_config = NetworkConfig(
+ indent=2,
+ contents=contents,
+ ignore_lines=diff_ignore_lines,
+ )
if running_config.sha1 != base_config.sha1:
before = ""
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_devicealias.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_devicealias.py
index 71d4ebb67..1aa4c9d75 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_devicealias.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_devicealias.py
@@ -70,23 +70,21 @@ EXAMPLES = """
- name: Test that device alias module works
cisco.nxos.nxos_devicealias:
da:
- - name: test1_add
- pwwn: 56:2:22:11:22:88:11:67
- - name: test2_add
- pwwn: 65:22:22:11:22:22:11:d
- - name: dev1
- remove: true
- - name: dev2
- remove: true
+ - name: test1_add
+ pwwn: 56:2:22:11:22:88:11:67
+ - name: test2_add
+ pwwn: 65:22:22:11:22:22:11:d
+ - name: dev1
+ remove: true
+ - name: dev2
+ remove: true
distribute: true
mode: enhanced
rename:
- - new_name: bcd
- old_name: abc
- - new_name: bcd1
- old_name: abc1
-
-
+ - new_name: bcd
+ old_name: abc
+ - new_name: bcd1
+ old_name: abc1
"""
RETURN = """
@@ -179,11 +177,15 @@ class showDeviceAliasDatabase(object):
return name in self.da_dict.keys()
def isPwwnInDaDatabase(self, pwwn):
- newpwwn = ":".join(["0" + str(ep) if len(ep) == 1 else ep for ep in pwwn.split(":")])
+ newpwwn = ":".join(
+ ["0" + str(ep) if len(ep) == 1 else ep for ep in pwwn.split(":")],
+ )
return newpwwn in self.da_dict.values()
def isNamePwwnPresentInDatabase(self, name, pwwn):
- newpwwn = ":".join(["0" + str(ep) if len(ep) == 1 else ep for ep in pwwn.split(":")])
+ newpwwn = ":".join(
+ ["0" + str(ep) if len(ep) == 1 else ep for ep in pwwn.split(":")],
+ )
if name in self.da_dict.keys():
if newpwwn == self.da_dict[name]:
return True
@@ -196,7 +198,9 @@ class showDeviceAliasDatabase(object):
return None
def getNameByPwwn(self, pwwn):
- newpwwn = ":".join(["0" + str(ep) if len(ep) == 1 else ep for ep in pwwn.split(":")])
+ newpwwn = ":".join(
+ ["0" + str(ep) if len(ep) == 1 else ep for ep in pwwn.split(":")],
+ )
for n, p in self.da_dict.items():
if p == newpwwn:
return n
@@ -331,7 +335,9 @@ def main():
d = shDAStausObj.getDistribute()
m = shDAStausObj.getMode()
if shDAStausObj.isLocked():
- module.fail_json(msg="device-alias has acquired lock on the switch. Hence cannot procced.")
+ module.fail_json(
+ msg="device-alias has acquired lock on the switch. Hence cannot procced.",
+ )
# Step 1: Process distribute
commands = []
@@ -342,7 +348,9 @@ def main():
# but switch distribute is disabled(false), so set it to
# true(enabled)
commands.append("device-alias distribute")
- messages.append("device-alias distribute changed from disabled to enabled")
+ messages.append(
+ "device-alias distribute changed from disabled to enabled",
+ )
else:
messages.append(
"device-alias distribute remains unchanged. current distribution mode is enabled",
@@ -353,7 +361,9 @@ def main():
# but switch distribute is enabled(true), so set it to
# false(disabled)
commands.append("no device-alias distribute")
- messages.append("device-alias distribute changed from enabled to disabled")
+ messages.append(
+ "device-alias distribute changed from enabled to disabled",
+ )
else:
messages.append(
"device-alias distribute remains unchanged. current distribution mode is disabled",
@@ -379,7 +389,9 @@ def main():
commands.append("no device-alias mode enhanced")
messages.append("device-alias mode changed from enhanced to basic")
else:
- messages.append("device-alias mode remains unchanged. current mode is basic")
+ messages.append(
+ "device-alias mode remains unchanged. current mode is basic",
+ )
else:
# playbook has mode as enhanced
@@ -388,7 +400,9 @@ def main():
commands.append("device-alias mode enhanced")
messages.append("device-alias mode changed from basic to enhanced")
else:
- messages.append("device-alias mode remains unchanged. current mode is enhanced")
+ messages.append(
+ "device-alias mode remains unchanged. current mode is enhanced",
+ )
if commands:
if distribute:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_evpn_vni.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_evpn_vni.py
index d4490bb7b..89771f374 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_evpn_vni.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_evpn_vni.py
@@ -89,8 +89,8 @@ EXAMPLES = """
vni: 6000
route_distinguisher: 60:10
route_target_import:
- - 5000:10
- - 4100:100
+ - "5000:10"
+ - "4100:100"
route_target_export: auto
route_target_both: default
"""
@@ -215,7 +215,9 @@ def state_present(module, existing, proposed):
if target == "default":
continue
if existing:
- if target not in existing.get(key.replace("-", "_").replace(" ", "_")):
+ if target not in existing.get(
+ key.replace("-", "_").replace(" ", "_"),
+ ):
commands.append("{0} {1}".format(key, target))
else:
commands.append("{0} {1}".format(key, target))
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_facts.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_facts.py
index 24e0dad22..77ca123d5 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_facts.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_facts.py
@@ -77,11 +77,11 @@ EXAMPLES = """
- name: Gather only the config and default facts
cisco.nxos.nxos_facts:
gather_subset:
- - config
+ - config
- name: Do not gather hardware facts
cisco.nxos.nxos_facts:
gather_subset:
- - '!hardware'
+ - '!hardware'
- name: Gather legacy and resource facts
cisco.nxos.nxos_facts:
gather_subset: all
@@ -89,10 +89,10 @@ EXAMPLES = """
- name: Gather only the interfaces resource facts and no legacy facts
cisco.nxos.nxos_facts:
gather_subset:
- - '!all'
- - '!min'
+ - '!all'
+ - '!min'
gather_network_resources:
- - interfaces
+ - interfaces
- name: Gather interfaces resource and minimal legacy facts
cisco.nxos.nxos_facts:
gather_subset: min
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_fc_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_fc_interfaces.py
index b0c58a5e3..a77deffdb 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_fc_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_fc_interfaces.py
@@ -50,7 +50,7 @@ options:
enabled:
description:
- Administrative state of the interface. Set the value to C(true) to
- administratively enable the interface or C(false) to disable it
+ administratively enable the interface or C(true) to disable it
type: bool
speed:
description:
@@ -131,8 +131,8 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration
cisco.nxos.nxos_fc_interfaces:
config:
- - name: fc18/10
- analytics: fc-scsi
+ - name: fc18/10
+ analytics: fc-scsi
state: merged
# Task Output
@@ -143,7 +143,7 @@ EXAMPLES = """
# speed: auto max 16000
# mode: auto
# trunk_mode: on
-# enabled: False
+# enabled: true
# description: $
# analytics: fc-nvme
# commands:
@@ -154,7 +154,7 @@ EXAMPLES = """
# speed: auto max 16000
# mode: auto
# trunk_mode: on
-# enabled: False
+# enabled: true
# description: $
# analytics: fc-all
@@ -189,13 +189,13 @@ EXAMPLES = """
- name: Replaces device configuration of listed interfaces with provided configuration
cisco.nxos.nxos_fc_interfaces:
config:
- - name: fc18/12
- speed: auto max 64000
- mode: auto
- trunk_mode: on
- enabled: True
- description: 1
- analytics: fc-scsi
+ - name: fc18/12
+ speed: auto max 64000
+ mode: auto
+ trunk_mode: "on"
+ enabled: true
+ description: 1
+ analytics: fc-scsi
state: replaced
# Task Output
@@ -206,7 +206,7 @@ EXAMPLES = """
# speed: auto max 64000
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: 1
# analytics: fc-all
# commands:
@@ -218,7 +218,7 @@ EXAMPLES = """
# speed: auto max 64000
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: 1
# analytics: fc-scsi
@@ -251,7 +251,7 @@ EXAMPLES = """
- name: Delete or return interface parameters to default settings
cisco.nxos.nxos_fc_interfaces:
config:
- - name: fc1/2
+ - name: fc1/2
state: deleted
# Task Output
@@ -262,7 +262,7 @@ EXAMPLES = """
# speed: 1000
# mode: E
# trunk_mode: off
-# enabled: True
+# enabled: true
# commands:
# - interface fc1/2
# - no switchport speed 1000
@@ -274,7 +274,7 @@ EXAMPLES = """
# speed: auto
# mode: auto
# trunk_mode: on
-# enabled: False
+# enabled: true
# After state:
# ------------
@@ -313,13 +313,13 @@ EXAMPLES = """
- name: Replaces device configuration of listed interfaces with provided configuration
cisco.nxos.nxos_fc_interfaces:
config:
- - name: fc18/12
- speed: auto max 64000
- mode: auto
- trunk_mode: on
- enabled: True
- description: 1
- analytics: fc-scsi
+ - name: fc18/12
+ speed: auto max 64000
+ mode: auto
+ trunk_mode: "on"
+ enabled: true
+ description: 1
+ analytics: fc-scsi
state: overridden
# Task Output
@@ -330,14 +330,14 @@ EXAMPLES = """
# speed: auto max 64000
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: 1
# analytics: fc-all
# - name: fc18/13
# speed: auto max 64000
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: 1
# analytics: fc-all
# commands:
@@ -355,14 +355,14 @@ EXAMPLES = """
# speed: auto max 64000
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: 1
# analytics: fc-scsi
# - name: fc18/13
# speed: auto max 64000
# mode: auto
# trunk_mode: on
-# enabled: False
+# enabled: true
# After state:
# ------------
@@ -380,29 +380,23 @@ EXAMPLES = """
# switchport trunk mode on
# shutdown
-
-
-
-
-
-
# Using rendered
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_fc_interfaces:
config:
- - name: fc1/1
- speed: auto
- mode: auto
- trunk_mode: on
- enabled: True
- description: This is a sample line
- - name: fc1/2
- speed: 1000
- mode: E
- trunk_mode: off
- enabled: True
- state: rendered
+ - name: fc1/1
+ speed: auto
+ mode: auto
+ trunk_mode: "on"
+ enabled: true
+ description: This is a sample line
+ - name: fc1/2
+ speed: 1000
+ mode: E
+ trunk_mode: "off"
+ enabled: true
+ state: rendered
# Task Output
# -----------
@@ -454,13 +448,13 @@ EXAMPLES = """
# speed: auto
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: This is a sample line
# - name: fc1/2
# speed: 1000
# mode: E
# trunk_mode: off
-# enabled: True
+# enabled: true
# Using gathered
@@ -493,17 +487,13 @@ EXAMPLES = """
# speed: auto
# mode: auto
# trunk_mode: on
-# enabled: True
+# enabled: true
# description: This is a sample line
# - name: fc1/2
# speed: 1000
# mode: E
# trunk_mode: off
-# enabled: True
-
-
-
-
+# enabled: true
"""
RETURN = """
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_gir_profile_management.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_gir_profile_management.py
index 84cfc1456..2ddf2ce60 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_gir_profile_management.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_gir_profile_management.py
@@ -65,8 +65,8 @@ EXAMPLES = """
- cisco.nxos.nxos_gir_profile_management:
mode: maintenance
commands:
- - router eigrp 11
- - isolate
+ - router eigrp 11
+ - isolate
# Remove the maintenance-mode profile
- cisco.nxos.nxos_gir_profile_management:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_hostname.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_hostname.py
index 42e45677a..3f141562c 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_hostname.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_hostname.py
@@ -146,7 +146,6 @@ EXAMPLES = """
# -----------------------
# parsed:
# hostname: NXOSv-9k
-
"""
RETURN = """
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_hsrp_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_hsrp_interfaces.py
index e5ac67376..3e11949dc 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_hsrp_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_hsrp_interfaces.py
@@ -88,8 +88,8 @@ EXAMPLES = """
- name: Configure hsrp attributes on interfaces
cisco.nxos.nxos_hsrp_interfaces:
config:
- - name: Ethernet1/1
- - name: Ethernet1/2
+ - name: Ethernet1/1
+ - name: Ethernet1/2
operation: deleted
@@ -98,10 +98,10 @@ EXAMPLES = """
- name: Configure hsrp attributes on interfaces
cisco.nxos.nxos_hsrp_interfaces:
config:
- - name: Ethernet1/1
- bfd: enable
- - name: Ethernet1/2
- bfd: disable
+ - name: Ethernet1/1
+ bfd: enable
+ - name: Ethernet1/2
+ bfd: disable
operation: merged
@@ -110,10 +110,10 @@ EXAMPLES = """
- name: Configure hsrp attributes on interfaces
cisco.nxos.nxos_hsrp_interfaces:
config:
- - name: Ethernet1/1
- bfd: enable
- - name: Ethernet1/2
- bfd: disable
+ - name: Ethernet1/1
+ bfd: enable
+ - name: Ethernet1/2
+ bfd: disable
operation: overridden
@@ -122,10 +122,10 @@ EXAMPLES = """
- name: Configure hsrp attributes on interfaces
cisco.nxos.nxos_hsrp_interfaces:
config:
- - name: Ethernet1/1
- bfd: enable
- - name: Ethernet1/2
- bfd: disable
+ - name: Ethernet1/1
+ bfd: enable
+ - name: Ethernet1/2
+ bfd: disable
operation: replaced
# Using rendered
@@ -133,10 +133,10 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_hsrp_interfaces:
config:
- - name: Ethernet1/800
- bfd: enable
- - name: Ethernet1/801
- bfd: enable
+ - name: Ethernet1/800
+ bfd: enable
+ - name: Ethernet1/801
+ bfd: enable
state: rendered
# Task Output (redacted)
@@ -199,7 +199,6 @@ EXAMPLES = """
# bfd: enable
# - name: Ethernet1/2
# bfd: enable
-
"""
RETURN = """
before:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_igmp_interface.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_igmp_interface.py
index 105dac5e6..66a2a495e 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_igmp_interface.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_igmp_interface.py
@@ -154,8 +154,8 @@ EXAMPLES = """
interface: ethernet1/32
startup_query_interval: 30
oif_ps:
- - {prefix: 238.2.2.6}
- - {source: 192.168.0.1, prefix: 238.2.2.5}
+ - {prefix: 238.2.2.6}
+ - {source: 192.168.0.1, prefix: 238.2.2.5}
state: present
"""
RETURN = """
@@ -385,7 +385,9 @@ def config_igmp_interface(delta, existing, existing_oif_prefix_source):
if "source" in each.keys():
src = each["source"]
if src:
- commands.append("no " + CMDS.get("oif_prefix_source").format(pf, src))
+ commands.append(
+ "no " + CMDS.get("oif_prefix_source").format(pf, src),
+ )
else:
commands.append("no " + CMDS.get("oif_prefix").format(pf))
elif key == "oif_routemap":
@@ -450,7 +452,11 @@ def config_default_igmp_interface(existing, delta):
proposed = get_igmp_interface_defaults()
delta = dict(set(proposed.items()).difference(existing.items()))
if delta:
- command = config_igmp_interface(delta, existing, existing_oif_prefix_source=None)
+ command = config_igmp_interface(
+ delta,
+ existing,
+ existing_oif_prefix_source=None,
+ )
if command:
for each in command:
@@ -463,7 +469,9 @@ def config_remove_oif(existing, existing_oif_prefix_source):
commands = []
command = None
if existing.get("oif_routemap"):
- commands.append("no ip igmp static-oif route-map {0}".format(existing.get("oif_routemap")))
+ commands.append(
+ "no ip igmp static-oif route-map {0}".format(existing.get("oif_routemap")),
+ )
elif existing_oif_prefix_source:
for each in existing_oif_prefix_source:
if each.get("prefix") and each.get("source"):
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_install_os.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_install_os.py
index 53fe00aac..9b64a8989 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_install_os.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_install_os.py
@@ -95,9 +95,10 @@ EXAMPLES = """
nxos_command:
commands: [show version | json]
register: output
+
- assert:
that:
- - output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I6(1)'
+ - output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I6(1)'
"""
RETURN = """
@@ -390,7 +391,9 @@ def build_install_cmd_set(issu, image, kick, type, force=True):
if kick is None:
commands.append("%s nxos %s %s" % (rootcmd, image, issu_cmd))
else:
- commands.append("%s %s system %s kickstart %s" % (rootcmd, issu_cmd, image, kick))
+ commands.append(
+ "%s %s system %s kickstart %s" % (rootcmd, issu_cmd, image, kick),
+ )
return commands
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_interfaces.py
index 7884098a7..30045188d 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_interfaces.py
@@ -142,12 +142,12 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration
cisco.nxos.nxos_interfaces:
config:
- - name: Ethernet1/1
- description: Configured by Ansible
- enabled: true
- - name: Ethernet1/2
- description: Configured by Ansible Network
- enabled: false
+ - name: Ethernet1/1
+ description: Configured by Ansible
+ enabled: true
+ - name: Ethernet1/2
+ description: Configured by Ansible Network
+ enabled: false
state: merged
# Task Output
@@ -206,14 +206,14 @@ EXAMPLES = """
- name: Replaces device configuration of listed interfaces with provided configuration
cisco.nxos.nxos_interfaces:
config:
- - name: Ethernet1/1
- description: Configured by Ansible
- enabled: true
- mtu: 9000
- - name: Ethernet1/2
- description: Configured by Ansible Network
- enabled: false
- mode: layer2
+ - name: Ethernet1/1
+ description: Configured by Ansible
+ enabled: true
+ mtu: 9000
+ - name: Ethernet1/2
+ description: Configured by Ansible Network
+ enabled: false
+ mode: layer2
state: replaced
# Task Output
@@ -274,13 +274,13 @@ EXAMPLES = """
- name: Override device configuration of all interfaces with provided configuration
cisco.nxos.nxos_interfaces:
config:
- - name: Ethernet1/1
- enabled: true
- - name: Ethernet1/2
- description: Configured by Ansible Network
- enabled: false
- - description: mgmt interface
- name: mgmt0
+ - name: Ethernet1/1
+ enabled: true
+ - name: Ethernet1/2
+ description: Configured by Ansible Network
+ enabled: false
+ - description: mgmt interface
+ name: mgmt0
state: overridden
# Task Output
@@ -338,7 +338,7 @@ EXAMPLES = """
- name: Delete or return interface parameters to default settings
cisco.nxos.nxos_interfaces:
config:
- - name: Ethernet1/2
+ - name: Ethernet1/2
state: deleted
# Task Output
@@ -377,14 +377,14 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_interfaces:
config:
- - name: Ethernet1/1
- description: outbound-intf
- mode: layer3
- speed: 100
- - name: Ethernet1/2
- mode: layer2
- enabled: true
- duplex: full
+ - name: Ethernet1/1
+ description: outbound-intf
+ mode: layer3
+ speed: 100
+ - name: Ethernet1/2
+ mode: layer2
+ enabled: true
+ duplex: full
state: rendered
# Task Output
@@ -524,8 +524,6 @@ EXAMPLES = """
# interface port-channel11
# interface Ethernet1/1
# interface Ethernet1/2
-
-
"""
RETURN = """
before:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_l2_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_l2_interfaces.py
index 55149b7bf..c490d65ed 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_l2_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_l2_interfaces.py
@@ -130,13 +130,13 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration
cisco.nxos.nxos_l2_interfaces:
config:
- - name: Ethernet1/1
- trunk:
- native_vlan: 10
- allowed_vlans: 2,4,15
- - name: Ethernet1/2
- access:
- vlan: 30
+ - name: Ethernet1/1
+ trunk:
+ native_vlan: 10
+ allowed_vlans: 2,4,15
+ - name: Ethernet1/2
+ access:
+ vlan: 30
state: merged
# Task Output
@@ -195,10 +195,10 @@ EXAMPLES = """
- name: Replace device configuration of specified L2 interfaces with provided configuration.
cisco.nxos.nxos_l2_interfaces:
config:
- - name: Ethernet1/1
- trunk:
- native_vlan: 20
- allowed_vlans: 5-10, 15
+ - name: Ethernet1/1
+ trunk:
+ native_vlan: 20
+ allowed_vlans: 5-10, 15
state: replaced
# Task Output
@@ -261,9 +261,9 @@ EXAMPLES = """
- name: Override device configuration with provided configuration.
cisco.nxos.nxos_l2_interfaces:
config:
- - name: Ethernet1/2
- access:
- vlan: 30
+ - name: Ethernet1/2
+ access:
+ vlan: 30
state: overridden
# Task Output
@@ -320,8 +320,8 @@ EXAMPLES = """
itself).
cisco.nxos.nxos_l2_interfaces:
config:
- - name: Ethernet1/1
- - name: Ethernet1/2
+ - name: Ethernet1/1
+ - name: Ethernet1/2
state: deleted
# Task Output
@@ -362,17 +362,17 @@ EXAMPLES = """
- name: Render platform specific configuration lines (without connecting to the device)
cisco.nxos.nxos_l2_interfaces:
config:
- - name: Ethernet1/1
- trunk:
- native_vlan: 10
- allowed_vlans: 2,4,15
- - name: Ethernet1/2
- access:
- vlan: 30
- - name: Ethernet1/3
- trunk:
- native_vlan: 20
- allowed_vlans: 5-10, 15
+ - name: Ethernet1/1
+ trunk:
+ native_vlan: 10
+ allowed_vlans: 2,4,15
+ - name: Ethernet1/2
+ access:
+ vlan: 30
+ - name: Ethernet1/3
+ trunk:
+ native_vlan: 20
+ allowed_vlans: 5-10, 15
state: rendered
# Task Output
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_l3_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_l3_interfaces.py
index 1b4d821b2..5dc3d05a9 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_l3_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_l3_interfaces.py
@@ -159,19 +159,19 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration.
cisco.nxos.nxos_l3_interfaces:
config:
- - name: Ethernet1/6
- ipv4:
- - address: 192.168.1.1/24
- tag: 5
- - address: 10.1.1.1/24
- secondary: true
- tag: 10
- ipv6:
- - address: fd5d:12c9:2201:2::1/64
- tag: 6
- - name: Ethernet1/7.42
- redirects: false
- unreachables: false
+ - name: Ethernet1/6
+ ipv4:
+ - address: 192.168.1.1/24
+ tag: 5
+ - address: 10.1.1.1/24
+ secondary: true
+ tag: 10
+ ipv6:
+ - address: fd5d:12c9:2201:2::1/64
+ tag: 6
+ - name: Ethernet1/7.42
+ redirects: false
+ unreachables: false
state: merged
# Task Output
@@ -258,9 +258,9 @@ EXAMPLES = """
- name: Replace device configuration of specified L3 interfaces with provided configuration.
cisco.nxos.nxos_l3_interfaces:
config:
- - name: Ethernet1/6
- ipv4:
- - address: 192.168.22.3/24
+ - name: Ethernet1/6
+ ipv4:
+ - address: 192.168.22.3/24
state: replaced
# Task Output
@@ -352,12 +352,12 @@ EXAMPLES = """
- name: Override device configuration with provided configuration.
cisco.nxos.nxos_l3_interfaces:
config:
- - ipv4:
- - address: dhcp
- name: mgmt0
- - name: Ethernet1/6
- ipv4:
- - address: 192.168.22.3/24
+ - ipv4:
+ - address: dhcp
+ name: mgmt0
+ - name: Ethernet1/6
+ ipv4:
+ - address: 192.168.22.3/24
state: overridden
# Task Output
@@ -446,8 +446,8 @@ EXAMPLES = """
itself).
cisco.nxos.nxos_l3_interfaces:
config:
- - name: Ethernet1/6
- - name: Ethernet1/2
+ - name: Ethernet1/6
+ - name: Ethernet1/2
state: deleted
# Task Output
@@ -497,17 +497,17 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_l3_interfaces:
config:
- - name: Ethernet1/800
- ipv4:
- - address: 192.168.1.100/24
- tag: 5
- - address: 10.1.1.1/24
- secondary: true
- tag: 10
- - name: Ethernet1/800
- ipv6:
- - address: fd5d:12c9:2201:2::1/64
- tag: 6
+ - name: Ethernet1/800
+ ipv4:
+ - address: 192.168.1.100/24
+ tag: 5
+ - address: 10.1.1.1/24
+ secondary: true
+ tag: 10
+ - name: Ethernet1/800
+ ipv6:
+ - address: fd5d:12c9:2201:2::1/64
+ tag: 6
state: rendered
# Task Output
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_lacp_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_lacp_interfaces.py
index 98e5a6339..d51ea0a71 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_lacp_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_lacp_interfaces.py
@@ -143,9 +143,9 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration.
cisco.nxos.nxos_lacp_interfaces:
config:
- - name: Ethernet1/3
- port_priority: 5
- rate: fast
+ - name: Ethernet1/3
+ port_priority: 5
+ rate: fast
state: merged
# After state:
@@ -169,9 +169,9 @@ EXAMPLES = """
- name: Replace device lacp interfaces configuration with the given configuration.
cisco.nxos.nxos_lacp_interfaces:
config:
- - name: port-channel11
- links:
- min: 4
+ - name: port-channel11
+ links:
+ min: 4
state: replaced
# After state:
@@ -197,9 +197,9 @@ EXAMPLES = """
on device with provided configuration.
cisco.nxos.nxos_lacp_interfaces:
config:
- - name: port-channel11
- links:
- min: 4
+ - name: port-channel11
+ links:
+ min: 4
state: overridden
# After state:
@@ -232,17 +232,17 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_lacp_interfaces:
config:
- - name: Ethernet1/800
- rate: fast
- - name: Ethernet1/801
- rate: fast
- port_priority: 32
- - name: port-channel10
- links:
- max: 15
- min: 2
- convergence:
- graceful: true
+ - name: Ethernet1/800
+ rate: fast
+ - name: Ethernet1/801
+ rate: fast
+ port_priority: 32
+ - name: port-channel10
+ links:
+ max: 15
+ min: 2
+ convergence:
+ graceful: true
state: rendered
# Task Output (redacted)
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_lag_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_lag_interfaces.py
index ce06462ed..8d0fabf7a 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_lag_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_lag_interfaces.py
@@ -113,9 +113,9 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration.
cisco.nxos.nxos_lag_interfaces:
config:
- - name: port-channel99
- members:
- - member: Ethernet1/4
+ - name: port-channel99
+ members:
+ - member: Ethernet1/4
state: merged
# After state:
@@ -137,9 +137,9 @@ EXAMPLES = """
with provided configuration.
cisco.nxos.nxos_lag_interfaces:
config:
- - name: port-channel10
- members:
- - member: Ethernet1/4
+ - name: port-channel10
+ members:
+ - member: Ethernet1/4
state: replaced
# After state:
@@ -163,10 +163,10 @@ EXAMPLES = """
device with provided configuration.
cisco.nxos.nxos_lag_interfaces:
config:
- - name: port-channel20
- members:
- - member: Ethernet1/6
- force: true
+ - name: port-channel20
+ members:
+ - member: Ethernet1/6
+ force: true
state: overridden
# After state:
@@ -189,7 +189,7 @@ EXAMPLES = """
itself).
cisco.nxos.nxos_lag_interfaces:
config:
- - port-channel: port-channel99
+ - port-channel: port-channel99
state: deleted
- name: Delete LAG attributes of all the interfaces
@@ -207,15 +207,15 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_lag_interfaces:
config:
- - name: port-channel10
- members:
- - member: Ethernet1/800
- mode: active
- - member: Ethernet1/801
- - name: port-channel11
- members:
- - member: Ethernet1/802
- mode: passive
+ - name: port-channel10
+ members:
+ - member: Ethernet1/800
+ mode: active
+ - member: Ethernet1/801
+ - name: port-channel11
+ members:
+ - member: Ethernet1/802
+ mode: passive
state: rendered
# Task Output (redacted)
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_lldp_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_lldp_interfaces.py
index 2006001de..44ac5b09e 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_lldp_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_lldp_interfaces.py
@@ -111,12 +111,12 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration
cisco.nxos.nxos_lldp_interfaces:
config:
- - name: Ethernet1/4
- receive: false
- transmit: true
- tlv_set:
- management_address: 192.168.122.64
- vlan: 12
+ - name: Ethernet1/4
+ receive: false
+ transmit: true
+ tlv_set:
+ management_address: 192.168.122.64
+ vlan: 12
state: merged
# After state:
@@ -143,10 +143,10 @@ EXAMPLES = """
- name: Replace LLDP configuration on interfaces with given configuration
cisco.nxos.nxos_lldp_interfaces:
config:
- - name: Ethernet1/4
- transmit: false
- tlv_set:
- vlan: 2
+ - name: Ethernet1/4
+ transmit: false
+ tlv_set:
+ vlan: 2
state: replaced
@@ -176,10 +176,10 @@ EXAMPLES = """
- name: Override LLDP configuration on all interfaces with given configuration
cisco.nxos.nxos_lldp_interfaces:
config:
- - name: Ethernet1/7
- receive: false
- tlv_set:
- vlan: 12
+ - name: Ethernet1/7
+ receive: false
+ tlv_set:
+ vlan: 12
state: overridden
@@ -209,8 +209,6 @@ EXAMPLES = """
# After state:
# ------------
#
-
-
"""
RETURN = """
before:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_logging.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_logging.py
deleted file mode 100644
index 7782eb32c..000000000
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_logging.py
+++ /dev/null
@@ -1,940 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-# Copyright: (c) 2017, Ansible by Red Hat, inc
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-
-DOCUMENTATION = """
-module: nxos_logging
-author: Trishna Guha (@trishnaguha)
-short_description: Manage logging on network devices
-notes:
-- Limited Support for Cisco MDS
-description:
-- This module provides declarative management of logging on Cisco NX-OS devices.
-version_added: 1.0.0
-deprecated:
- alternative: nxos_logging_global
- why: Updated module released with more functionality.
- removed_at_date: '2023-08-01'
-options:
- dest:
- description:
- - Destination of the logs.
- choices:
- - console
- - logfile
- - module
- - monitor
- - server
- type: str
- remote_server:
- description:
- - Hostname or IP Address for remote logging (when dest is 'server').
- type: str
- use_vrf:
- description:
- - VRF to be used while configuring remote logging (when dest is 'server').
- type: str
- interface:
- description:
- - Interface to be used while configuring source-interface for logging (e.g., 'Ethernet1/2',
- 'mgmt0')
- type: str
- name:
- description:
- - If value of C(dest) is I(logfile) it indicates file-name.
- type: str
- facility:
- description:
- - Facility name for logging.
- type: str
- dest_level:
- description:
- - Set logging severity levels.
- aliases:
- - level
- type: int
- facility_level:
- description:
- - Set logging severity levels for facility based log messages.
- type: int
- aggregate:
- description: List of logging definitions.
- type: list
- elements: dict
- state:
- description:
- - State of the logging configuration.
- default: present
- choices:
- - present
- - absent
- type: str
- event:
- description:
- - Link/trunk enable/default interface configuration logging
- choices:
- - link-enable
- - link-default
- - trunk-enable
- - trunk-default
- type: str
- interface_message:
- description:
- - Add interface description to interface syslogs. Does not work with version 6.0
- images using nxapi as a transport.
- choices:
- - add-interface-description
- type: str
- file_size:
- description:
- - Set logfile size
- type: int
- facility_link_status:
- description:
- - Set logging facility ethpm link status. Not idempotent with version 6.0 images.
- choices:
- - link-down-notif
- - link-down-error
- - link-up-notif
- - link-up-error
- type: str
- timestamp:
- description:
- - Set logging timestamp format
- choices:
- - microseconds
- - milliseconds
- - seconds
- type: str
- purge:
- description:
- - Remove any switch logging configuration that does not match what has been configured
- Not supported for ansible_connection local. All nxos_logging tasks must use
- the same ansible_connection type.
- type: bool
- default: false
-extends_documentation_fragment:
-- cisco.nxos.nxos
-"""
-
-EXAMPLES = """
-- name: configure console logging with level
- cisco.nxos.nxos_logging:
- dest: console
- level: 2
- state: present
-- name: remove console logging configuration
- cisco.nxos.nxos_logging:
- dest: console
- level: 2
- state: absent
-- name: configure file logging with level
- cisco.nxos.nxos_logging:
- dest: logfile
- name: testfile
- dest_level: 3
- state: present
-- name: Configure logging logfile with size
- cisco.nxos.nxos_logging:
- dest: logfile
- name: testfile
- dest_level: 3
- file_size: 16384
-- name: configure facility level logging
- cisco.nxos.nxos_logging:
- facility: daemon
- facility_level: 0
- state: present
-- name: remove facility level logging
- cisco.nxos.nxos_logging:
- facility: daemon
- facility_level: 0
- state: absent
-- name: Configure Remote Logging
- cisco.nxos.nxos_logging:
- dest: server
- remote_server: test-syslogserver.com
- facility: auth
- facility_level: 1
- use_vrf: management
- state: present
-- name: Configure Source Interface for Logging
- cisco.nxos.nxos_logging:
- interface: mgmt0
- state: present
-- name: Purge nxos_logging configuration not managed by this playbook
- cisco.nxos.nxos_logging:
- purge: true
-- name: Configure logging timestamp
- cisco.nxos.nxos_logging:
- timestamp: milliseconds
- state: present
-- name: Configure logging facility ethpm link status
- cisco.nxos.nxos_logging:
- facility: ethpm
- facility_link_status: link-up-notif
- state: present
-- name: Configure logging message ethernet description
- cisco.nxos.nxos_logging:
- interface_message: add-interface-description
- state: present
-- name: Configure logging event link enable
- cisco.nxos.nxos_logging:
- event: link-enable
- state: present
-- name: Configure logging using aggregate
- cisco.nxos.nxos_logging:
- aggregate:
- - {dest: console, dest_level: 2}
- - {dest: logfile, dest_level: 2, name: testfile}
- - {facility: daemon, facility_level: 0}
- state: present
-"""
-
-RETURN = """
-commands:
- description: The list of configuration mode commands to send to the device
- returned: always
- type: list
- sample:
- - logging console 2
- - logging logfile testfile 3
- - logging level daemon 0
-"""
-
-import copy
-import re
-
-from ansible.module_utils.basic import AnsibleModule
-
-from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos import (
- get_config,
- load_config,
- normalize_interface,
- read_module_context,
- run_commands,
- save_module_context,
-)
-
-
-STATIC_CLI = {
- "link-enable": "logging event link-status enable",
- "link-default": "logging event link-status default",
- "trunk-enable": "logging event trunk-status enable",
- "trunk-default": "logging event trunk-status default",
- "microseconds": "logging timestamp microseconds",
- "milliseconds": "logging timestamp milliseconds",
- "seconds": "logging timestamp seconds",
- "link-up-error": "link-up error",
- "link-up-notif": "link-up notif",
- "link-down-error": "link-down error",
- "link-down-notif": "link-down notif",
- "add-interface-description": "logging message interface type ethernet description",
-}
-
-DEFAULT_LOGGING_LEVEL = {
- 0: [],
- 1: [],
- 2: ["pktmgr"],
- 3: ["adjmgr", "arp", "icmpv6", "l2rib", "netstack"],
- 4: [],
- 5: ["mrib", "m6rib"],
- 6: [],
- 7: [],
-}
-
-DEST_GROUP = ["console", "logfile", "module", "monitor", "server"]
-
-
-def map_obj_to_commands(module, updates):
- commands = list()
- want, have = updates
-
- for w in want:
- state = w["state"]
- del w["state"]
-
- if state == "absent" and w in have:
- if w["facility"] is not None:
- if (
- not w["dest"]
- and not w["facility_link_status"]
- and w["facility"] not in DEFAULT_LOGGING_LEVEL[int(w["facility_level"])]
- ):
- commands.append(
- "no logging level {0} {1}".format(w["facility"], w["facility_level"]),
- )
-
- if w["facility_link_status"] and w["facility"] in ("ethpm"):
- commands.append(
- "no logging level {0} {1}".format(
- w["facility"],
- STATIC_CLI[w["facility_link_status"]],
- ),
- )
-
- if w["name"] is not None:
- commands.append("no logging logfile")
-
- if w["dest"] in ("console", "module", "monitor"):
- commands.append("no logging {0}".format(w["dest"]))
-
- if w["dest"] == "server":
- commands.append("no logging server {0}".format(w["remote_server"]))
-
- if w["interface"]:
- commands.append("no logging source-interface")
-
- if w["event"] and w["event"] in STATIC_CLI:
- commands.append("no " + STATIC_CLI[w["event"]])
-
- if w["message"] and w["message"] in STATIC_CLI:
- commands.append("no " + STATIC_CLI[w["message"]])
-
- if w["timestamp"] and w["timestamp"] in STATIC_CLI:
- commands.append("no " + STATIC_CLI[w["timestamp"]])
-
- if state == "present" and w not in have:
- if w["facility"] is None:
- if w["dest"]:
- if w["dest"] not in ("logfile", "server"):
- commands.append("logging {0} {1}".format(w["dest"], w["dest_level"]))
-
- elif w["dest"] == "logfile":
- if w["file_size"]:
- commands.append(
- "logging logfile {0} {1} size {2}".format(
- w["name"],
- w["dest_level"],
- w["file_size"],
- ),
- )
- else:
- commands.append(
- "logging logfile {0} {1}".format(w["name"], w["dest_level"]),
- )
-
- elif w["dest"] == "server":
- if w["facility_level"]:
- if w["use_vrf"]:
- commands.append(
- "logging server {0} {1} use-vrf {2}".format(
- w["remote_server"],
- w["facility_level"],
- w["use_vrf"],
- ),
- )
- else:
- commands.append(
- "logging server {0} {1}".format(
- w["remote_server"],
- w["facility_level"],
- ),
- )
-
- else:
- if w["use_vrf"]:
- commands.append(
- "logging server {0} use-vrf {1}".format(
- w["remote_server"],
- w["use_vrf"],
- ),
- )
- else:
- commands.append("logging server {0}".format(w["remote_server"]))
-
- if w["facility"]:
- if w["dest"] == "server":
- if w["facility_level"]:
- if w["use_vrf"]:
- commands.append(
- "logging server {0} {1} facility {2} use-vrf {3}".format(
- w["remote_server"],
- w["facility_level"],
- w["facility"],
- w["use_vrf"],
- ),
- )
- else:
- commands.append(
- "logging server {0} {1} facility {2}".format(
- w["remote_server"],
- w["facility_level"],
- w["facility"],
- ),
- )
- else:
- if w["use_vrf"]:
- commands.append(
- "logging server {0} facility {1} use-vrf {2}".format(
- w["remote_server"],
- w["facility"],
- w["use_vrf"],
- ),
- )
- else:
- commands.append(
- "logging server {0} facility {1}".format(
- w["remote_server"],
- w["facility"],
- ),
- )
- else:
- if w["facility_link_status"]:
- commands.append(
- "logging level {0} {1}".format(
- w["facility"],
- STATIC_CLI[w["facility_link_status"]],
- ),
- )
- else:
- if not match_facility_default(module, w["facility"], w["facility_level"]):
- commands.append(
- "logging level {0} {1}".format(w["facility"], w["facility_level"]),
- )
-
- if w["interface"]:
- commands.append(
- "logging source-interface {0} {1}".format(*split_interface(w["interface"])),
- )
-
- if w["event"] and w["event"] in STATIC_CLI:
- commands.append(STATIC_CLI[w["event"]])
-
- if w["message"] and w["message"] in STATIC_CLI:
- commands.append(STATIC_CLI[w["message"]])
-
- if w["timestamp"] and w["timestamp"] in STATIC_CLI:
- commands.append(STATIC_CLI[w["timestamp"]])
-
- return commands
-
-
-def match_facility_default(module, facility, want_level):
- """Check wanted facility to see if it matches current device default"""
-
- matches_default = False
- # Sample output from show logging level command
- # Facility Default Severity Current Session Severity
- # -------- ---------------- ------------------------
- # bfd 5 5
- #
- # 0(emergencies) 1(alerts) 2(critical)
- # 3(errors) 4(warnings) 5(notifications)
- # 6(information) 7(debugging)
-
- regexl = r"\S+\s+(\d+)\s+(\d+)"
- cmd = {
- "command": "show logging level {0}".format(facility),
- "output": "text",
- }
- facility_data = run_commands(module, cmd)
- for line in facility_data[0].split("\n"):
- mo = re.search(regexl, line)
- if mo and int(mo.group(1)) == int(want_level) and int(mo.group(2)) == int(want_level):
- matches_default = True
-
- return matches_default
-
-
-def split_interface(interface):
- match = re.search(r"(\D+)(\S*)", interface, re.M)
- if match:
- return match.group(1), match.group(2)
-
-
-def parse_facility_link_status(line, facility, status):
- facility_link_status = None
-
- if facility is not None:
- match = re.search(r"logging level {0} {1} (\S+)".format(facility, status), line, re.M)
- if match:
- facility_link_status = status + "-" + match.group(1)
-
- return facility_link_status
-
-
-def parse_event_status(line, event):
- status = None
-
- match = re.search(r"logging event {0} (\S+)".format(event + "-status"), line, re.M)
- if match:
- state = match.group(1)
- if state:
- status = state
-
- return status
-
-
-def parse_event(line):
- event = None
-
- match = re.search(r"logging event (\S+)", line, re.M)
- if match:
- state = match.group(1)
- if state == "link-status":
- event = "link"
- elif state == "trunk-status":
- event = "trunk"
-
- return event
-
-
-def parse_message(line):
- message = None
-
- match = re.search(r"logging message interface type ethernet description", line, re.M)
- if match:
- message = "add-interface-description"
-
- return message
-
-
-def parse_file_size(line, name, level):
- file_size = None
-
- match = re.search(r"logging logfile {0} {1} size (\S+)".format(name, level), line, re.M)
- if match:
- file_size = match.group(1)
- if file_size == "8192" or file_size == "4194304":
- file_size = None
-
- return file_size
-
-
-def parse_timestamp(line):
- timestamp = None
-
- match = re.search(r"logging timestamp (\S+)", line, re.M)
- if match:
- timestamp = match.group(1)
-
- return timestamp
-
-
-def parse_name(line, dest):
- name = None
-
- if dest is not None:
- if dest == "logfile":
- match = re.search(r"logging logfile (\S+)", line, re.M)
- if match:
- name = match.group(1)
- else:
- pass
-
- return name
-
-
-def parse_remote_server(line, dest):
- remote_server = None
-
- if dest and dest == "server":
- match = re.search(r"logging server (\S+)", line, re.M)
- if match:
- remote_server = match.group(1)
-
- return remote_server
-
-
-def parse_dest_level(line, dest, name):
- dest_level = None
-
- def parse_match(match):
- level = None
- if match:
- if int(match.group(1)) in range(0, 8):
- level = match.group(1)
- else:
- pass
- return level
-
- if dest and dest != "server":
- if dest == "logfile":
- match = re.search(r"logging logfile {0} (\S+)".format(name), line, re.M)
- if match:
- dest_level = parse_match(match)
-
- elif dest == "server":
- match = re.search(r"logging server (?:\S+) (\d+)", line, re.M)
- if match:
- dest_level = parse_match(match)
- else:
- match = re.search(r"logging {0} (\S+)".format(dest), line, re.M)
- if match:
- dest_level = parse_match(match)
-
- return dest_level
-
-
-def parse_facility_level(line, facility, dest):
- facility_level = None
-
- if dest == "server":
- match = re.search(r"logging server (?:\S+) (\d+)", line, re.M)
- if match:
- facility_level = match.group(1)
-
- elif facility is not None:
- match = re.search(r"logging level {0} (\S+)".format(facility), line, re.M)
- if match:
- facility_level = match.group(1)
-
- return facility_level
-
-
-def parse_facility(line):
- facility = None
-
- match = re.search(
- r"logging server (?:\S+) (?:\d+) (?:\S+) (?:\S+) (?:\S+) (\S+)",
- line,
- re.M,
- )
- if match:
- facility = match.group(1)
-
- return facility
-
-
-def parse_use_vrf(line, dest):
- use_vrf = None
-
- if dest and dest == "server":
- match = re.search(r"logging server (?:\S+) (?:\d+) use-vrf (\S+)", line, re.M)
- if match:
- use_vrf = match.group(1)
-
- return use_vrf
-
-
-def parse_interface(line):
- interface = None
-
- match = re.search(r"logging source-interface (\S*)", line, re.M)
- if match:
- interface = match.group(1)
-
- return interface
-
-
-def map_config_to_obj(module):
- obj = []
-
- data = get_config(module, flags=[" all | section logging"])
-
- for line in data.split("\n"):
- if re.search(r"no (\S+)", line, re.M):
- state = "absent"
- else:
- state = "present"
-
- match = re.search(r"logging (\S+)", line, re.M)
- if state == "present" and match:
- event_status = None
- name = None
- dest_level = None
- dest = None
- facility = None
- remote_server = None
- facility_link_status = None
- file_size = None
- facility_level = None
-
- if match.group(1) in DEST_GROUP:
- dest = match.group(1)
-
- name = parse_name(line, dest)
- remote_server = parse_remote_server(line, dest)
- dest_level = parse_dest_level(line, dest, name)
-
- if dest == "server":
- facility = parse_facility(line)
-
- facility_level = parse_facility_level(line, facility, dest)
-
- if dest == "logfile":
- file_size = parse_file_size(line, name, dest_level)
-
- elif match.group(1) == "level":
- match_facility = re.search(r"logging level (\S+)", line, re.M)
- facility = match_facility.group(1)
-
- level = parse_facility_level(line, facility, dest)
- if level.isdigit():
- facility_level = level
- else:
- facility_link_status = parse_facility_link_status(line, facility, level)
-
- elif match.group(1) == "event" and state == "present":
- event = parse_event(line)
- if event:
- status = parse_event_status(line, event)
- if status:
- event_status = event + "-" + status
- else:
- continue
-
- else:
- pass
-
- obj.append(
- {
- "dest": dest,
- "remote_server": remote_server,
- "use_vrf": parse_use_vrf(line, dest),
- "name": name,
- "facility": facility,
- "dest_level": dest_level,
- "facility_level": facility_level,
- "interface": parse_interface(line),
- "facility_link_status": facility_link_status,
- "event": event_status,
- "file_size": file_size,
- "message": parse_message(line),
- "timestamp": parse_timestamp(line),
- },
- )
-
- cmd = [
- {
- "command": "show logging | section enabled | section console",
- "output": "text",
- },
- {
- "command": "show logging | section enabled | section monitor",
- "output": "text",
- },
- ]
-
- default_data = run_commands(module, cmd)
-
- for line in default_data:
- flag = False
- match = re.search(
- r"Logging (\w+):(?:\s+) (?:\w+) (?:\W)Severity: (\w+)",
- str(line),
- re.M,
- )
- if match:
- if match.group(1) == "console" and match.group(2) == "critical":
- dest_level = "2"
- flag = True
- elif match.group(1) == "monitor" and match.group(2) == "notifications":
- dest_level = "5"
- flag = True
- if flag:
- obj.append(
- {
- "dest": match.group(1),
- "remote_server": None,
- "name": None,
- "facility": None,
- "dest_level": dest_level,
- "facility_level": None,
- "use_vrf": None,
- "interface": None,
- "facility_link_status": None,
- "event": None,
- "file_size": None,
- "message": None,
- "timestamp": None,
- },
- )
-
- return obj
-
-
-def map_params_to_obj(module):
- obj = []
-
- if "aggregate" in module.params and module.params["aggregate"]:
- args = {
- "dest": "",
- "remote_server": "",
- "use_vrf": "",
- "name": "",
- "facility": "",
- "dest_level": "",
- "facility_level": "",
- "interface": "",
- "facility_link_status": None,
- "event": None,
- "file_size": None,
- "message": None,
- "timestamp": None,
- }
-
- for c in module.params["aggregate"]:
- d = c.copy()
-
- for key in args:
- if key not in d:
- d[key] = None
-
- if d["dest_level"] is not None:
- d["dest_level"] = str(d["dest_level"])
-
- if d["facility_level"] is not None:
- d["facility_level"] = str(d["facility_level"])
-
- if d["interface"]:
- d["interface"] = normalize_interface(d["interface"])
-
- if "state" not in d:
- d["state"] = module.params["state"]
-
- if d["file_size"]:
- d["file_size"] = str(d["file_size"])
-
- obj.append(d)
-
- else:
- dest_level = None
- facility_level = None
- file_size = None
-
- if module.params["dest_level"] is not None:
- dest_level = str(module.params["dest_level"])
-
- if module.params["facility_level"] is not None:
- facility_level = str(module.params["facility_level"])
-
- if module.params["file_size"] is not None:
- file_size = str(module.params["file_size"])
-
- obj.append(
- {
- "dest": module.params["dest"],
- "remote_server": module.params["remote_server"],
- "use_vrf": module.params["use_vrf"],
- "name": module.params["name"],
- "facility": module.params["facility"],
- "dest_level": dest_level,
- "facility_level": facility_level,
- "interface": normalize_interface(module.params["interface"]),
- "state": module.params["state"],
- "facility_link_status": module.params["facility_link_status"],
- "event": module.params["event"],
- "message": module.params["interface_message"],
- "file_size": file_size,
- "timestamp": module.params["timestamp"],
- },
- )
- return obj
-
-
-def merge_wants(wants, want):
- if not wants:
- wants = list()
-
- for w in want:
- w = copy.copy(w)
- state = w["state"]
- del w["state"]
-
- if state == "absent":
- if w in wants:
- wants.remove(w)
- elif w not in wants:
- wants.append(w)
-
- return wants
-
-
-def absent(h):
- h["state"] = "absent"
- return h
-
-
-def outliers(haves, wants):
- wants = list(wants)
- return [absent(h) for h in haves if not (h in wants or wants.append(h))]
-
-
-def main():
- """main entry point for module execution"""
- argument_spec = dict(
- dest=dict(choices=DEST_GROUP),
- name=dict(),
- facility=dict(),
- remote_server=dict(),
- use_vrf=dict(),
- dest_level=dict(type="int", aliases=["level"]),
- facility_level=dict(type="int"),
- interface=dict(),
- facility_link_status=dict(
- choices=[
- "link-down-notif",
- "link-down-error",
- "link-up-notif",
- "link-up-error",
- ],
- ),
- event=dict(
- choices=[
- "link-enable",
- "link-default",
- "trunk-enable",
- "trunk-default",
- ],
- ),
- interface_message=dict(choices=["add-interface-description"]),
- file_size=dict(type="int"),
- timestamp=dict(choices=["microseconds", "milliseconds", "seconds"]),
- state=dict(default="present", choices=["present", "absent"]),
- aggregate=dict(type="list", elements="dict"),
- purge=dict(default=False, type="bool"),
- )
-
- required_if = [
- ("dest", "logfile", ["name"]),
- ("dest", "server", ["remote_server"]),
- ]
-
- module = AnsibleModule(
- argument_spec=argument_spec,
- required_if=required_if,
- supports_check_mode=True,
- )
-
- warnings = list()
-
- result = {"changed": False}
- if warnings:
- result["warnings"] = warnings
-
- want = map_params_to_obj(module)
- merged_wants = merge_wants(read_module_context(module), want)
- have = map_config_to_obj(module)
-
- commands = map_obj_to_commands(module, (want, have))
- result["commands"] = commands
-
- if commands:
- if not module.check_mode:
- load_config(module, commands)
- result["changed"] = True
-
- save_module_context(module, merged_wants)
-
- if module.params.get("purge"):
- pcommands = map_obj_to_commands(module, (outliers(have, merged_wants), have))
- if pcommands:
- if not module.check_mode:
- load_config(module, pcommands)
- result["changed"] = True
- result["commands"] += pcommands
-
- module.exit_json(**result)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_logging_global.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_logging_global.py
index 1c060b01b..759dee67c 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_logging_global.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_logging_global.py
@@ -290,7 +290,7 @@ EXAMPLES = """
facility: local6
use_vrf: default
origin_id:
- hostname: True
+ hostname: true
# Task output
# -------------
@@ -576,7 +576,7 @@ EXAMPLES = """
facility: local6
use_vrf: default
origin_id:
- hostname: True
+ hostname: true
# Task Output (redacted)
# -----------------------
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp.py
deleted file mode 100644
index 046436d47..000000000
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp.py
+++ /dev/null
@@ -1,446 +0,0 @@
-#!/usr/bin/python
-# Copyright: Ansible Project
-# 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
-
-
-DOCUMENTATION = """
-module: nxos_ntp
-extends_documentation_fragment:
-- cisco.nxos.nxos
-short_description: Manages core NTP configuration.
-notes:
-- Limited Support for Cisco MDS
-description:
-- Manages core NTP configuration.
-version_added: 1.0.0
-deprecated:
- alternative: nxos_ntp_global
- why: Updated module released with more functionality.
- removed_at_date: '2024-01-01'
-author:
-- Jason Edelman (@jedelman8)
-options:
- server:
- description:
- - Network address of NTP server.
- type: str
- peer:
- description:
- - Network address of NTP peer.
- type: str
- key_id:
- description:
- - Authentication key identifier to use with given NTP server or peer or keyword
- 'default'.
- type: str
- prefer:
- description:
- - Makes given NTP server or peer the preferred NTP server or peer for the device.
- choices:
- - enabled
- - disabled
- type: str
- vrf_name:
- description:
- - Makes the device communicate with the given NTP server or peer over a specific
- VRF or keyword 'default'.
- type: str
- source_addr:
- description:
- - Local source address from which NTP messages are sent or keyword 'default'.
- type: str
- source_int:
- description:
- - Local source interface from which NTP messages are sent. Must be fully qualified
- interface name or keyword 'default'
- type: str
- state:
- description:
- - Manage the state of the resource.
- default: present
- choices:
- - present
- - absent
- type: str
-"""
-
-EXAMPLES = """
-# Set NTP Server with parameters
-- cisco.nxos.nxos_ntp:
- server: 1.2.3.4
- key_id: 32
- prefer: enabled
- host: '{{ inventory_hostname }}'
- username: '{{ un }}'
- password: '{{ pwd }}'
-"""
-
-RETURN = """
-proposed:
- description: k/v pairs of parameters passed into module
- returned: always
- type: dict
- sample: {"address": "192.0.2.2", "key_id": "48",
- "peer_type": "server", "prefer": "enabled",
- "source": "192.0.2.3", "source_type": "source"}
-existing:
- description:
- - k/v pairs of existing ntp server/peer
- returned: always
- type: dict
- sample: {"address": "192.0.2.2", "key_id": "32",
- "peer_type": "server", "prefer": "enabled",
- "source": "ethernet2/1", "source_type": "source-interface"}
-end_state:
- description: k/v pairs of ntp info after module execution
- returned: always
- type: dict
- sample: {"address": "192.0.2.2", "key_id": "48",
- "peer_type": "server", "prefer": "enabled",
- "source": "192.0.2.3", "source_type": "source"}
-updates:
- description: command sent to the device
- returned: always
- type: list
- sample: ["ntp server 192.0.2.2 prefer key 48",
- "no ntp source-interface ethernet2/1", "ntp source 192.0.2.3"]
-changed:
- description: check to see if a change was made on the device
- returned: always
- type: bool
- sample: true
-"""
-
-import re
-
-from ansible.module_utils.basic import AnsibleModule
-
-from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos import (
- load_config,
- run_commands,
-)
-
-
-def execute_show_command(command, module, command_type="cli_show"):
- if "show run" not in command:
- output = "json"
- else:
- output = "text"
-
- commands = [{"command": command, "output": output}]
- return run_commands(module, commands)
-
-
-def flatten_list(command_lists):
- flat_command_list = []
- for command in command_lists:
- if isinstance(command, list):
- flat_command_list.extend(command)
- else:
- flat_command_list.append(command)
- return flat_command_list
-
-
-def get_ntp_source(module):
- source_type = None
- source = None
- command = "show run | inc ntp.source"
- output = execute_show_command(command, module, command_type="cli_show_ascii")
-
- if output:
- try:
- if "interface" in output[0]:
- source_type = "source-interface"
- else:
- source_type = "source"
- source = output[0].split()[2].lower()
- except (AttributeError, IndexError):
- source_type = None
- source = None
-
- return source_type, source
-
-
-def get_ntp_peer(module):
- command = "show run | inc ntp.(server|peer)"
- ntp_peer_list = []
- response = execute_show_command(command, module, command_type="cli_show_ascii")
-
- if response:
- if isinstance(response, list):
- ntp = response[0]
- else:
- ntp = response
- if ntp:
- ntp_regex = (
- r".*ntp\s(server\s(?P<address>\S+)|peer\s(?P<peer_address>\S+))"
- r"\s*((?P<prefer>prefer)\s*)?(use-vrf\s(?P<vrf_name>\S+)\s*)?"
- r"(key\s(?P<key_id>\d+))?.*"
- )
-
- split_ntp = ntp.splitlines()
- for peer_line in split_ntp:
- if "access-group" in peer_line:
- continue
- ntp_peer = {}
- try:
- peer_address = None
- vrf_name = "default"
- prefer = None
- key_id = None
- match_ntp = re.match(ntp_regex, peer_line, re.DOTALL)
- group_ntp = match_ntp.groupdict()
-
- address = group_ntp["address"]
- peer_address = group_ntp["peer_address"]
- prefer = group_ntp["prefer"]
- vrf_name = group_ntp["vrf_name"]
- key_id = group_ntp["key_id"]
-
- if prefer is not None:
- prefer = "enabled"
- else:
- prefer = "disabled"
-
- if address is not None:
- peer_type = "server"
- elif peer_address is not None:
- peer_type = "peer"
- address = peer_address
-
- args = dict(
- peer_type=peer_type,
- address=address,
- prefer=prefer,
- vrf_name=vrf_name,
- key_id=key_id,
- )
-
- ntp_peer = dict((k, v) for k, v in args.items())
- ntp_peer_list.append(ntp_peer)
- except AttributeError:
- ntp_peer_list = []
-
- return ntp_peer_list
-
-
-def get_ntp_existing(address, peer_type, module):
- peer_dict = {}
- peer_server_list = []
-
- peer_list = get_ntp_peer(module)
- for peer in peer_list:
- if peer["address"] == address:
- peer_dict.update(peer)
- else:
- peer_server_list.append(peer)
-
- source_type, source = get_ntp_source(module)
-
- if source_type is not None and source is not None:
- peer_dict["source_type"] = source_type
- peer_dict["source"] = source
-
- return (peer_dict, peer_server_list)
-
-
-def set_ntp_server_peer(peer_type, address, prefer, key_id, vrf_name):
- command_strings = []
-
- if prefer:
- command_strings.append(" prefer")
- if key_id:
- command_strings.append(" key {0}".format(key_id))
- if vrf_name:
- command_strings.append(" use-vrf {0}".format(vrf_name))
-
- command_strings.insert(0, "ntp {0} {1}".format(peer_type, address))
-
- command = "".join(command_strings)
-
- return command
-
-
-def config_ntp(delta, existing):
- if (
- delta.get("address")
- or delta.get("peer_type")
- or delta.get("vrf_name")
- or delta.get("key_id")
- or delta.get("prefer")
- ):
- address = delta.get("address", existing.get("address"))
- peer_type = delta.get("peer_type", existing.get("peer_type"))
- key_id = delta.get("key_id", existing.get("key_id"))
- prefer = delta.get("prefer", existing.get("prefer"))
- vrf_name = delta.get("vrf_name", existing.get("vrf_name"))
- if delta.get("key_id") == "default":
- key_id = None
- else:
- peer_type = None
- prefer = None
-
- source_type = delta.get("source_type")
- source = delta.get("source")
-
- if prefer:
- if prefer == "enabled":
- prefer = True
- elif prefer == "disabled":
- prefer = False
-
- if source:
- source_type = delta.get("source_type", existing.get("source_type"))
-
- ntp_cmds = []
- if peer_type:
- if existing.get("peer_type") and existing.get("address"):
- ntp_cmds.append(
- "no ntp {0} {1}".format(existing.get("peer_type"), existing.get("address")),
- )
- ntp_cmds.append(set_ntp_server_peer(peer_type, address, prefer, key_id, vrf_name))
- if source:
- existing_source_type = existing.get("source_type")
- existing_source = existing.get("source")
- if existing_source_type and source_type != existing_source_type:
- ntp_cmds.append("no ntp {0} {1}".format(existing_source_type, existing_source))
- if source == "default":
- if existing_source_type and existing_source:
- ntp_cmds.append("no ntp {0} {1}".format(existing_source_type, existing_source))
- else:
- ntp_cmds.append("ntp {0} {1}".format(source_type, source))
-
- return ntp_cmds
-
-
-def main():
- argument_spec = dict(
- server=dict(type="str"),
- peer=dict(type="str"),
- key_id=dict(type="str"),
- prefer=dict(type="str", choices=["enabled", "disabled"]),
- vrf_name=dict(type="str"),
- source_addr=dict(type="str"),
- source_int=dict(type="str"),
- state=dict(choices=["absent", "present"], default="present"),
- )
-
- module = AnsibleModule(
- argument_spec=argument_spec,
- mutually_exclusive=[["server", "peer"], ["source_addr", "source_int"]],
- supports_check_mode=True,
- )
-
- warnings = list()
-
- server = module.params["server"] or None
- peer = module.params["peer"] or None
- key_id = module.params["key_id"]
- prefer = module.params["prefer"]
- vrf_name = module.params["vrf_name"]
- source_addr = module.params["source_addr"]
- source_int = module.params["source_int"]
- state = module.params["state"]
-
- if source_int is not None:
- source_int = source_int.lower()
-
- if server:
- peer_type = "server"
- address = server
- elif peer:
- peer_type = "peer"
- address = peer
- else:
- peer_type = None
- address = None
-
- source_type = None
- source = None
- if source_addr:
- source_type = "source"
- source = source_addr
- elif source_int:
- source_type = "source-interface"
- source = source_int
-
- if key_id or vrf_name or prefer:
- if not server and not peer:
- module.fail_json(msg="Please supply the server or peer parameter")
-
- args = dict(
- peer_type=peer_type,
- address=address,
- key_id=key_id,
- prefer=prefer,
- vrf_name=vrf_name,
- source_type=source_type,
- source=source,
- )
-
- proposed = dict((k, v) for k, v in args.items() if v is not None)
-
- existing, peer_server_list = get_ntp_existing(address, peer_type, module)
-
- end_state = existing
- changed = False
- commands = []
-
- if state == "present":
- delta = dict(set(proposed.items()).difference(existing.items()))
- if delta.get("key_id") and delta.get("key_id") == "default":
- if not existing.get("key_id"):
- delta.pop("key_id")
- if delta:
- command = config_ntp(delta, existing)
- if command:
- commands.append(command)
-
- elif state == "absent":
- if existing.get("peer_type") and existing.get("address"):
- command = "no ntp {0} {1}".format(existing["peer_type"], existing["address"])
- if command:
- commands.append([command])
-
- existing_source_type = existing.get("source_type")
- existing_source = existing.get("source")
- proposed_source_type = proposed.get("source_type")
- proposed_source = proposed.get("source")
-
- if proposed_source_type:
- if proposed_source_type == existing_source_type:
- if proposed_source == existing_source:
- command = "no ntp {0} {1}".format(existing_source_type, existing_source)
- if command:
- commands.append([command])
-
- cmds = flatten_list(commands)
- if cmds:
- if module.check_mode:
- module.exit_json(changed=True, commands=cmds)
- else:
- changed = True
- load_config(module, cmds)
- end_state = get_ntp_existing(address, peer_type, module)[0]
- if "configure" in cmds:
- cmds.pop(0)
-
- results = {}
- results["proposed"] = proposed
- results["existing"] = existing
- results["updates"] = cmds
- results["changed"] = changed
- results["warnings"] = warnings
- results["end_state"] = end_state
- results["peer_server_list"] = peer_server_list
-
- module.exit_json(**results)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_auth.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_auth.py
deleted file mode 100644
index 3e5643812..000000000
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_auth.py
+++ /dev/null
@@ -1,336 +0,0 @@
-#!/usr/bin/python
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-#
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-
-DOCUMENTATION = """
-module: nxos_ntp_auth
-extends_documentation_fragment:
-- cisco.nxos.nxos
-short_description: Manages NTP authentication.
-description:
-- Manages NTP authentication.
-version_added: 1.0.0
-deprecated:
- alternative: nxos_ntp_global
- why: Updated module released with more functionality.
- removed_at_date: '2024-01-01'
-author:
-- Jason Edelman (@jedelman8)
-notes:
-- Tested against NXOSv 7.3.(0)D1(1) on VIRL
-- Limited Support for Cisco MDS
-- If C(state=absent), the module will remove the given key configuration if it exists.
-- If C(state=absent) and C(authentication=on), authentication will be turned off.
-options:
- key_id:
- description:
- - Authentication key identifier (numeric).
- type: str
- md5string:
- description:
- - MD5 String.
- type: str
- auth_type:
- description:
- - Whether the given md5string is in cleartext or has been encrypted. If in cleartext,
- the device will encrypt it before storing it.
- default: text
- choices:
- - text
- - encrypt
- type: str
- trusted_key:
- description:
- - Whether the given key is required to be supplied by a time source for the device
- to synchronize to the time source.
- choices:
- - 'false'
- - 'true'
- default: 'false'
- type: str
- authentication:
- description:
- - Turns NTP authentication on or off.
- choices:
- - "on"
- - "off"
- type: str
- state:
- description:
- - Manage the state of the resource.
- default: present
- choices:
- - present
- - absent
- type: str
-"""
-
-EXAMPLES = """
-# Basic NTP authentication configuration
-- cisco.nxos.nxos_ntp_auth:
- key_id: 32
- md5string: hello
- auth_type: text
-"""
-
-RETURN = """
-commands:
- description: command sent to the device
- returned: always
- type: list
- sample: ["ntp authentication-key 32 md5 helloWorld 0", "ntp trusted-key 32"]
-"""
-
-
-import re
-
-from ansible.module_utils.basic import AnsibleModule
-
-from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos import (
- load_config,
- run_commands,
-)
-
-
-def execute_show_command(command, module):
- if "show run" not in command:
- command = {"command": command, "output": "json"}
- else:
- command = {"command": command, "output": "text"}
-
- return run_commands(module, [command])
-
-
-def flatten_list(command_lists):
- flat_command_list = []
- for command in command_lists:
- if isinstance(command, list):
- flat_command_list.extend(command)
- else:
- flat_command_list.append(command)
- return flat_command_list
-
-
-def get_ntp_auth(module):
- command = "show ntp authentication-status"
-
- body = execute_show_command(command, module)[0]
- ntp_auth_str = body["authentication"]
-
- if "enabled" in ntp_auth_str:
- ntp_auth = True
- else:
- ntp_auth = False
-
- return ntp_auth
-
-
-def get_ntp_trusted_key(module):
- trusted_key_list = []
- command = "show run | inc ntp.trusted-key"
-
- trusted_key_str = execute_show_command(command, module)[0]
- if trusted_key_str:
- trusted_keys = trusted_key_str.splitlines()
-
- else:
- trusted_keys = []
-
- for line in trusted_keys:
- if line:
- trusted_key_list.append(str(line.split()[2]))
-
- return trusted_key_list
-
-
-def get_ntp_auth_key(key_id, module):
- authentication_key = {}
- command = "show run | inc ntp.authentication-key.{0}".format(key_id)
- auth_regex = (
- r".*ntp\sauthentication-key\s(?P<key_id>\d+)\smd5\s(?P<md5string>\S+)\s(?P<atype>\S+).*"
- )
-
- body = execute_show_command(command, module)[0]
-
- try:
- match_authentication = re.match(auth_regex, body, re.DOTALL)
- group_authentication = match_authentication.groupdict()
- authentication_key["key_id"] = group_authentication["key_id"]
- authentication_key["md5string"] = group_authentication["md5string"]
- if group_authentication["atype"] == "7":
- authentication_key["auth_type"] = "encrypt"
- else:
- authentication_key["auth_type"] = "text"
- except (AttributeError, TypeError):
- authentication_key = {}
-
- return authentication_key
-
-
-def get_ntp_auth_info(key_id, module):
- auth_info = get_ntp_auth_key(key_id, module)
- trusted_key_list = get_ntp_trusted_key(module)
- auth_power = get_ntp_auth(module)
-
- if key_id in trusted_key_list:
- auth_info["trusted_key"] = "true"
- else:
- auth_info["trusted_key"] = "false"
-
- if auth_power:
- auth_info["authentication"] = "on"
- else:
- auth_info["authentication"] = "off"
-
- return auth_info
-
-
-def auth_type_to_num(auth_type):
- if auth_type == "encrypt":
- return "7"
- else:
- return "0"
-
-
-def set_ntp_auth_key(key_id, md5string, auth_type, trusted_key, authentication):
- ntp_auth_cmds = []
- if key_id and md5string:
- auth_type_num = auth_type_to_num(auth_type)
- ntp_auth_cmds.append(
- "ntp authentication-key {0} md5 {1} {2}".format(key_id, md5string, auth_type_num),
- )
-
- if trusted_key == "true":
- ntp_auth_cmds.append("ntp trusted-key {0}".format(key_id))
- elif trusted_key == "false":
- ntp_auth_cmds.append("no ntp trusted-key {0}".format(key_id))
-
- if authentication == "on":
- ntp_auth_cmds.append("ntp authenticate")
- elif authentication == "off":
- ntp_auth_cmds.append("no ntp authenticate")
-
- return ntp_auth_cmds
-
-
-def remove_ntp_auth_key(key_id, md5string, auth_type, trusted_key, authentication):
- auth_remove_cmds = []
- if key_id:
- auth_type_num = auth_type_to_num(auth_type)
- auth_remove_cmds.append(
- "no ntp authentication-key {0} md5 {1} {2}".format(key_id, md5string, auth_type_num),
- )
-
- if authentication:
- auth_remove_cmds.append("no ntp authenticate")
- return auth_remove_cmds
-
-
-def main():
- argument_spec = dict(
- key_id=dict(type="str"),
- md5string=dict(type="str"),
- auth_type=dict(choices=["text", "encrypt"], default="text"),
- trusted_key=dict(choices=["true", "false"], default="false"),
- authentication=dict(choices=["on", "off"]),
- state=dict(choices=["absent", "present"], default="present"),
- )
-
- module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
-
- warnings = list()
-
- key_id = module.params["key_id"]
- md5string = module.params["md5string"]
- auth_type = module.params["auth_type"]
- trusted_key = module.params["trusted_key"]
- authentication = module.params["authentication"]
- state = module.params["state"]
-
- if key_id:
- if not trusted_key and not md5string:
- module.fail_json(msg="trusted_key or md5string MUST be specified")
-
- args = dict(
- key_id=key_id,
- md5string=md5string,
- auth_type=auth_type,
- trusted_key=trusted_key,
- authentication=authentication,
- )
-
- changed = False
- proposed = dict((k, v) for k, v in args.items() if v is not None)
-
- existing = get_ntp_auth_info(key_id, module)
- end_state = existing
-
- delta = dict(set(proposed.items()).difference(existing.items()))
-
- commands = []
- if state == "present":
- if delta:
- command = set_ntp_auth_key(
- key_id,
- md5string,
- delta.get("auth_type"),
- delta.get("trusted_key"),
- delta.get("authentication"),
- )
- if command:
- commands.append(command)
- elif state == "absent":
- auth_toggle = None
- if existing.get("authentication") == "on":
- auth_toggle = True
- if not existing.get("key_id"):
- key_id = None
- command = remove_ntp_auth_key(key_id, md5string, auth_type, trusted_key, auth_toggle)
- if command:
- commands.append(command)
-
- cmds = flatten_list(commands)
- if cmds:
- if module.check_mode:
- module.exit_json(changed=True, commands=cmds)
- else:
- load_config(module, cmds)
- end_state = get_ntp_auth_info(key_id, module)
- delta = dict(set(end_state.items()).difference(existing.items()))
- if delta or (len(existing) != len(end_state)):
- changed = True
- if "configure" in cmds:
- cmds.pop(0)
-
- results = {}
- results["proposed"] = proposed
- results["existing"] = existing
- results["updates"] = cmds
- results["changed"] = changed
- results["warnings"] = warnings
- results["end_state"] = end_state
-
- module.exit_json(**results)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_global.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_global.py
index e99fbef83..18cd851c9 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_global.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_global.py
@@ -241,7 +241,7 @@ EXAMPLES = """
- access_list: PeerAcl1
serve:
- access_list: ServeAcl1
- authenticate: True
+ authenticate: true
authentication_keys:
- id: 1001
key: vagwwtKfkv
@@ -249,7 +249,7 @@ EXAMPLES = """
- id: 1002
key: vagwwtKfkvgthz
encryption: 7
- logging: True
+ logging: true
master:
stratum: 2
peers:
@@ -260,7 +260,7 @@ EXAMPLES = """
vrf: default
- peer: 192.0.2.2
key_id: 2
- prefer: True
+ prefer: true
vrf: siteA
servers:
- server: 198.51.100.1
@@ -293,7 +293,7 @@ EXAMPLES = """
# - access_list: PeerAcl1
# serve:
# - access_list: ServeAcl1
-# authenticate: True
+# authenticate: true
# authentication_keys:
# - id: 1001
# key: vagwwtKfkv
@@ -301,7 +301,7 @@ EXAMPLES = """
# - id: 1002
# key: vagwwtKfkvgthz
# encryption: 7
-# logging: True
+# logging: true
# master:
# stratum: 2
# peers:
@@ -312,7 +312,7 @@ EXAMPLES = """
# vrf: default
# - peer: 192.0.2.2
# key_id: 2
-# prefer: True
+# prefer: true
# vrf: siteA
# servers:
# - server: 198.51.100.1
@@ -362,7 +362,7 @@ EXAMPLES = """
- access_list: PeerAcl2
serve:
- access_list: ServeAcl2
- logging: True
+ logging: true
master:
stratum: 2
peers:
@@ -373,7 +373,7 @@ EXAMPLES = """
vrf: default
- peer: 192.0.2.5
key_id: 2
- prefer: True
+ prefer: true
vrf: siteA
servers:
- server: 198.51.100.1
@@ -389,7 +389,7 @@ EXAMPLES = """
# - access_list: PeerAcl1
# serve:
# - access_list: ServeAcl1
-# authenticate: True
+# authenticate: true
# authentication_keys:
# - id: 1001
# key: vagwwtKfkv
@@ -397,7 +397,7 @@ EXAMPLES = """
# - id: 1002
# key: vagwwtKfkvgthz
# encryption: 7
-# logging: True
+# logging: true
# master:
# stratum: 2
# peers:
@@ -408,7 +408,7 @@ EXAMPLES = """
# vrf: default
# - peer: 192.0.2.2
# key_id: 2
-# prefer: True
+# prefer: true
# vrf: siteA
# servers:
# - server: 198.51.100.1
@@ -436,7 +436,7 @@ EXAMPLES = """
# - access_list: PeerAcl2
# serve:
# - access_list: ServeAcl2
-# logging: True
+# logging: true
# master:
# stratum: 2
# peers:
@@ -447,7 +447,7 @@ EXAMPLES = """
# vrf: default
# - peer: 192.0.2.5
# key_id: 2
-# prefer: True
+# prefer: true
# vrf: siteA
# servers:
# - server: 198.51.100.1
@@ -483,7 +483,7 @@ EXAMPLES = """
# - access_list: PeerAcl1
# serve:
# - access_list: ServeAcl1
-# authenticate: True
+# authenticate: true
# authentication_keys:
# - id: 1001
# key: vagwwtKfkv
@@ -491,7 +491,7 @@ EXAMPLES = """
# - id: 1002
# key: vagwwtKfkvgthz
# encryption: 7
-# logging: True
+# logging: true
# master:
# stratum: 2
# peers:
@@ -502,7 +502,7 @@ EXAMPLES = """
# vrf: default
# - peer: 192.0.2.2
# key_id: 2
-# prefer: True
+# prefer: true
# vrf: siteA
# servers:
# - server: 198.51.100.1
@@ -542,7 +542,7 @@ EXAMPLES = """
- access_list: PeerAcl1
serve:
- access_list: ServeAcl1
- authenticate: True
+ authenticate: true
authentication_keys:
- id: 1001
key: vagwwtKfkv
@@ -550,7 +550,7 @@ EXAMPLES = """
- id: 1002
key: vagwwtKfkvgthz
encryption: 7
- logging: True
+ logging: true
master:
stratum: 2
peers:
@@ -561,7 +561,7 @@ EXAMPLES = """
vrf: default
- peer: 192.0.2.2
key_id: 2
- prefer: True
+ prefer: true
vrf: siteA
servers:
- server: 198.51.100.1
@@ -616,7 +616,7 @@ EXAMPLES = """
# - access_list: PeerAcl1
# serve:
# - access_list: ServeAcl1
-# authenticate: True
+# authenticate: true
# authentication_keys:
# - id: 1001
# key: vagwwtKfkv
@@ -624,7 +624,7 @@ EXAMPLES = """
# - id: 1002
# key: vagwwtKfkvgthz
# encryption: 7
-# logging: True
+# logging: true
# master:
# stratum: 2
# peers:
@@ -635,7 +635,7 @@ EXAMPLES = """
# vrf: default
# - peer: 192.0.2.2
# key_id: 2
-# prefer: True
+# prefer: true
# vrf: siteA
# servers:
# - server: 198.51.100.1
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_options.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_options.py
deleted file mode 100644
index 28fd1aac6..000000000
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ntp_options.py
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/python
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-#
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-
-DOCUMENTATION = """
-module: nxos_ntp_options
-extends_documentation_fragment:
-- cisco.nxos.nxos
-short_description: Manages NTP options.
-description:
-- Manages NTP options, e.g. authoritative server and logging.
-version_added: 1.0.0
-deprecated:
- alternative: nxos_ntp_global
- why: Updated module released with more functionality.
- removed_at_date: '2024-01-01'
-author:
-- Jason Edelman (@jedelman8)
-notes:
-- Tested against NXOSv 7.3.(0)D1(1) on VIRL
-- Limited Support for Cisco MDS
-- When C(state=absent), master and logging will be set to False and stratum will be
- removed as well
-options:
- master:
- description:
- - Sets whether the device is an authoritative NTP server.
- type: bool
- stratum:
- description:
- - If C(master=true), an optional stratum can be supplied (1-15). The device default
- is 8.
- type: str
- logging:
- description:
- - Sets whether NTP logging is enabled on the device.
- type: bool
- state:
- description:
- - Manage the state of the resource.
- default: present
- choices:
- - present
- - absent
- type: str
-"""
-EXAMPLES = """
-# Basic NTP options configuration
-- cisco.nxos.nxos_ntp_options:
- master: true
- stratum: 12
- logging: false
- host: '{{ inventory_hostname }}'
- username: '{{ un }}'
- password: '{{ pwd }}'
-"""
-
-RETURN = """
-updates:
- description: command sent to the device
- returned: always
- type: list
- sample: ["no ntp logging", "ntp master 12"]
-"""
-import re
-
-from ansible.module_utils.basic import AnsibleModule
-
-from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos import (
- load_config,
- run_commands,
-)
-
-
-def get_current(module):
- cmd = "show running-config | inc ntp"
-
- master = False
- logging = False
- stratum = None
-
- output = run_commands(module, ({"command": cmd, "output": "text"}))[0]
-
- if output:
- match = re.search(r"^ntp master(?: (\d+))", output, re.M)
- if match:
- master = True
- stratum = match.group(1)
- logging = "ntp logging" in output.lower()
-
- return {"master": master, "stratum": stratum, "logging": logging}
-
-
-def main():
- argument_spec = dict(
- master=dict(required=False, type="bool"),
- stratum=dict(required=False, type="str"),
- logging=dict(required=False, type="bool"),
- state=dict(choices=["absent", "present"], default="present"),
- )
-
- module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
-
- warnings = list()
-
- master = module.params["master"]
- stratum = module.params["stratum"]
- logging = module.params["logging"]
- state = module.params["state"]
-
- if stratum and master is False:
- if stratum != 8:
- module.fail_json(msg="master MUST be True when stratum is changed")
-
- current = get_current(module)
-
- result = {"changed": False}
-
- commands = list()
-
- if state == "absent":
- if current["master"]:
- commands.append("no ntp master")
- if current["logging"]:
- commands.append("no ntp logging")
-
- elif state == "present":
- if master and not current["master"]:
- commands.append("ntp master")
- elif master is False and current["master"]:
- commands.append("no ntp master")
- if stratum and stratum != current["stratum"]:
- commands.append("ntp master %s" % stratum)
-
- if logging and not current["logging"]:
- commands.append("ntp logging")
- elif logging is False and current["logging"]:
- commands.append("no ntp logging")
-
- result["commands"] = commands
- result["updates"] = commands
-
- if commands:
- if not module.check_mode:
- load_config(module, commands)
- result["changed"] = True
-
- result["warnings"] = warnings
-
- module.exit_json(**result)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ospf_interfaces.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ospf_interfaces.py
index 81c4ad45b..7ed26117a 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ospf_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_ospf_interfaces.py
@@ -41,7 +41,7 @@ options:
description:
- Name/Identifier of the interface.
type: str
- required: True
+ required: true
address_family:
description:
- OSPF settings on the interfaces in address-family context.
@@ -53,7 +53,7 @@ options:
- Address Family Identifier (AFI) for OSPF settings on the interfaces.
type: str
choices: ['ipv4', 'ipv6']
- required: True
+ required: true
processes:
description:
- Interfaces configuration for an OSPF process.
@@ -64,7 +64,7 @@ options:
description:
- OSPF process tag.
type: str
- required: True
+ required: true
area:
description:
- Area associated with interface.
@@ -74,7 +74,7 @@ options:
description:
- Area ID in IP address format.
type: str
- required: True
+ required: true
secondaries:
description:
- Do not include secondary IPv4/IPv6 addresses.
@@ -129,7 +129,7 @@ options:
- Valid values are Cisco type 7 ENCRYPTED password, 3DES ENCRYPTED password
and UNENCRYPTED (cleartext) password based on the value of encryption key.
type: str
- required: True
+ required: true
message_digest_key:
description:
- Message digest authentication password (key) settings.
@@ -139,7 +139,7 @@ options:
description:
- Key ID.
type: int
- required: True
+ required: true
encryption:
description:
- 0 Specifies an UNENCRYPTED ospf password (key) will follow.
@@ -152,7 +152,7 @@ options:
- Valid values are Cisco type 7 ENCRYPTED password, 3DES ENCRYPTED password
and UNENCRYPTED (cleartext) password based on the value of encryption key.
type: str
- required: True
+ required: true
cost:
description:
- Cost associated with interface.
@@ -236,46 +236,46 @@ EXAMPLES = """
config:
- name: Ethernet1/1
address_family:
- - afi: ipv4
- processes:
- - process_id: "100"
- area:
- area_id: 1.1.1.1
- secondaries: False
- multi_areas:
- - 11.11.11.11
- - afi: ipv6
- processes:
- - process_id: "200"
- area:
- area_id: 2.2.2.2
+ - afi: ipv4
+ processes:
+ - process_id: '100'
+ area:
+ area_id: 1.1.1.1
+ secondaries: false
multi_areas:
- - 21.0.0.0
- - process_id: "300"
+ - 11.11.11.11
+ - afi: ipv6
+ processes:
+ - process_id: '200'
+ area:
+ area_id: 2.2.2.2
+ multi_areas:
+ - 21.0.0.0
+ - process_id: '300'
+ multi_areas:
+ - 50.50.50.50
multi_areas:
- - 50.50.50.50
- multi_areas:
- - 16.10.10.10
+ - 16.10.10.10
- name: Ethernet1/2
address_family:
- - afi: ipv4
- authentication:
- enable: True
- key_chain: test-1
- message_digest_key:
- key_id: 10
- encryption: 3
- key: abc01d272be25d29
- cost: 100
- - afi: ipv6
- network: broadcast
- shutdown: True
+ - afi: ipv4
+ authentication:
+ enable: true
+ key_chain: test-1
+ message_digest_key:
+ key_id: 10
+ encryption: 3
+ key: abc01d272be25d29
+ cost: 100
+ - afi: ipv6
+ network: broadcast
+ shutdown: true
- name: Ethernet1/3
address_family:
- - afi: ipv4
- authentication_key:
- encryption: 7
- key: 12090404011C03162E
+ - afi: ipv4
+ authentication_key:
+ encryption: 7
+ key: 12090404011C03162E
state: merged
# Task output:
@@ -399,17 +399,17 @@ EXAMPLES = """
- name: Replace OSPF configurations of listed interfaces with provided configurations
cisco.nxos.nxos_ospf_interfaces:
config:
- - name: Ethernet1/1
- address_family:
- - afi: ipv4
- processes:
- - process_id: "100"
- area:
- area_id: 1.1.1.1
- secondaries: False
- multi_areas:
- - 11.11.11.12
- - name: Ethernet1/3
+ - name: Ethernet1/1
+ address_family:
+ - afi: ipv4
+ processes:
+ - process_id: "100"
+ area:
+ area_id: 1.1.1.1
+ secondaries: false
+ multi_areas:
+ - 11.11.11.12
+ - name: Ethernet1/3
state: replaced
# Task output:
@@ -543,16 +543,16 @@ EXAMPLES = """
- name: Override all OSPF interfaces configuration with provided configuration
cisco.nxos.nxos_ospf_interfaces:
config:
- - name: Ethernet1/1
- address_family:
- - afi: ipv4
- processes:
- - process_id: "100"
- area:
- area_id: 1.1.1.1
- secondaries: False
- multi_areas:
- - 11.11.11.12
+ - name: Ethernet1/1
+ address_family:
+ - afi: ipv4
+ processes:
+ - process_id: "100"
+ area:
+ area_id: 1.1.1.1
+ secondaries: false
+ multi_areas:
+ - 11.11.11.12
state: overridden
# Task output:
@@ -861,53 +861,56 @@ EXAMPLES = """
# Using rendered
-- name: Render platform specific configuration lines with state rendered (without connecting to the device)
+- name: >-
+ Render platform specific configuration lines with state rendered (without
+ connecting to the device)
cisco.nxos.nxos_ospf_interfaces:
config:
- name: Ethernet1/1
address_family:
- - afi: ipv4
- processes:
- - process_id: "100"
- area:
- area_id: 1.1.1.1
- secondaries: False
- multi_areas:
- - 11.11.11.11
- - afi: ipv6
- processes:
- - process_id: "200"
- area:
- area_id: 2.2.2.2
+ - afi: ipv4
+ processes:
+ - process_id: '100'
+ area:
+ area_id: 1.1.1.1
+ secondaries: false
multi_areas:
- - 21.0.0.0
- - process_id: "300"
+ - 11.11.11.11
+ - afi: ipv6
+ processes:
+ - process_id: '200'
+ area:
+ area_id: 2.2.2.2
+ multi_areas:
+ - 21.0.0.0
+ - process_id: '300'
+ multi_areas:
+ - 50.50.50.50
multi_areas:
- - 50.50.50.50
- multi_areas:
- - 16.10.10.10
+ - 16.10.10.10
- name: Ethernet1/2
address_family:
- - afi: ipv4
- authentication:
- enable: True
- key_chain: test-1
- message_digest_key:
- key_id: 10
- encryption: 3
- key: abc01d272be25d29
- cost: 100
- - afi: ipv6
- network: broadcast
- shutdown: True
+ - afi: ipv4
+ authentication:
+ enable: true
+ key_chain: test-1
+ message_digest_key:
+ key_id: 10
+ encryption: 3
+ key: abc01d272be25d29
+ cost: 100
+ - afi: ipv6
+ network: broadcast
+ shutdown: true
- name: Ethernet1/3
address_family:
- - afi: ipv4
- authentication_key:
- encryption: 7
- key: 12090404011C03162E
+ - afi: ipv4
+ authentication_key:
+ encryption: 7
+ key: 12090404011C03162E
state: rendered
+
# Task Output:
# ------------
# rendered:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv2.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv2.py
index be23724d2..1d127b707 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv2.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv2.py
@@ -1018,56 +1018,56 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv2:
config:
processes:
- - process_id: 100
- router_id: 203.0.113.20
- - process_id: 102
- router_id: 198.51.100.1
- areas:
- - area_id: 0.0.0.100
- filter_list:
- - route_map: rmap_1
- direction: in
- - route_map: rmap_2
- direction: out
- ranges:
- - prefix: 198.51.100.64/27
- not_advertise: true
- - prefix: 198.51.100.96/27
- cost: 120
- - area_id: 0.0.0.101
- authentication:
- message_digest: true
- redistribute:
- - protocol: eigrp
- id: 120
- route_map: rmap_1
- - protocol: direct
- route_map: ospf102-direct-connect
- vrfs:
- - vrf: zone1
- router_id: 198.51.100.129
- redistribute:
- - protocol: static
- route_map: zone1-static-connect
- summary_address:
- - prefix: 198.51.100.128/27
- tag: 121
- - prefix: 198.51.100.160/27
+ - process_id: 100
+ router_id: 203.0.113.20
+ - process_id: 102
+ router_id: 198.51.100.1
areas:
- - area_id: 0.0.0.102
- nssa:
- default_information_originate: true
- no_summary: true
- - area_id: 0.0.0.103
- nssa:
- no_summary: true
- translate:
- type7:
- always: true
- - vrf: zone2
- auto_cost:
- reference_bandwidth: 45
- unit: Gbps
+ - area_id: 0.0.0.100
+ filter_list:
+ - route_map: rmap_1
+ direction: in
+ - route_map: rmap_2
+ direction: out
+ ranges:
+ - prefix: 198.51.100.64/27
+ not_advertise: true
+ - prefix: 198.51.100.96/27
+ cost: 120
+ - area_id: 0.0.0.101
+ authentication:
+ message_digest: true
+ redistribute:
+ - protocol: eigrp
+ id: 120
+ route_map: rmap_1
+ - protocol: direct
+ route_map: ospf102-direct-connect
+ vrfs:
+ - vrf: zone1
+ router_id: 198.51.100.129
+ redistribute:
+ - protocol: static
+ route_map: zone1-static-connect
+ summary_address:
+ - prefix: 198.51.100.128/27
+ tag: 121
+ - prefix: 198.51.100.160/27
+ areas:
+ - area_id: 0.0.0.102
+ nssa:
+ default_information_originate: true
+ no_summary: true
+ - area_id: 0.0.0.103
+ nssa:
+ no_summary: true
+ translate:
+ type7:
+ always: true
+ - vrf: zone2
+ auto_cost:
+ reference_bandwidth: 45
+ unit: Gbps
state: merged
# Task output:
@@ -1199,43 +1199,46 @@ EXAMPLES = """
# vrf zone2
# auto-cost reference-bandwidth 45 Gbps
-- name: Replace device configurations of listed OSPF processes with provided configurations
+- name: >-
+ Replace device configurations of listed OSPF processes with provided
+ configurations
cisco.nxos.nxos_ospfv2:
config:
processes:
- - process_id: 102
- router_id: 198.51.100.1
- areas:
- - area_id: 0.0.0.100
- filter_list:
- - route_map: rmap_8
- direction: in
- ranges:
- - prefix: 198.51.100.64/27
- not_advertise: true
- - area_id: 0.0.0.101
- stub:
- no_summary: true
- redistribute:
- - protocol: eigrp
- id: 130
- route_map: rmap_1
- - protocol: direct
- route_map: ospf102-direct-connect
- vrfs:
- - vrf: zone1
- router_id: 198.51.100.129
- redistribute:
- - protocol: bgp
- id: 65563
- route_map: zone1-bgp-connect
+ - process_id: 102
+ router_id: 198.51.100.1
areas:
- - area_id: 0.0.0.102
- nssa:
- default_information_originate: true
- no_summary: true
+ - area_id: 0.0.0.100
+ filter_list:
+ - route_map: rmap_8
+ direction: in
+ ranges:
+ - prefix: 198.51.100.64/27
+ not_advertise: true
+ - area_id: 0.0.0.101
+ stub:
+ no_summary: true
+ redistribute:
+ - protocol: eigrp
+ id: 130
+ route_map: rmap_1
+ - protocol: direct
+ route_map: ospf102-direct-connect
+ vrfs:
+ - vrf: zone1
+ router_id: 198.51.100.129
+ redistribute:
+ - protocol: bgp
+ id: 65563
+ route_map: zone1-bgp-connect
+ areas:
+ - area_id: 0.0.0.102
+ nssa:
+ default_information_originate: true
+ no_summary: true
state: replaced
+
# Task output:
# ------------
# before:
@@ -1389,11 +1392,11 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv2:
config:
processes:
- - process_id: 104
- router_id: 203.0.113.20
- - process_id: 102
- router_id: 198.51.100.1
- shutdown: true
+ - process_id: 104
+ router_id: 203.0.113.20
+ - process_id: 102
+ router_id: 198.51.100.1
+ shutdown: true
state: overridden
# Task output:
@@ -1511,7 +1514,7 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv2:
config:
processes:
- - process_id: 102
+ - process_id: 102
state: deleted
# Task output:
@@ -1674,62 +1677,65 @@ EXAMPLES = """
# Using rendered
-- name: Render platform specific configuration lines (without connecting to the device)
+- name: >-
+ Render platform specific configuration lines (without connecting to the
+ device)
cisco.nxos.nxos_ospfv2:
config:
processes:
- - process_id: 100
- router_id: 203.0.113.20
- - process_id: 102
- router_id: 198.51.100.1
- areas:
- - area_id: 0.0.0.100
- filter_list:
- - route_map: rmap_1
- direction: in
- - route_map: rmap_2
- direction: out
- ranges:
- - prefix: 198.51.100.64/27
- not_advertise: true
- - prefix: 198.51.100.96/27
- cost: 120
- - area_id: 0.0.0.101
- authentication:
- message_digest: true
- redistribute:
- - protocol: eigrp
- id: 120
- route_map: rmap_1
- - protocol: direct
- route_map: ospf102-direct-connect
- vrfs:
- - vrf: zone1
- router_id: 198.51.100.129
- redistribute:
- - protocol: static
- route_map: zone1-static-connect
- summary_address:
- - prefix: 198.51.100.128/27
- tag: 121
- - prefix: 198.51.100.160/27
+ - process_id: 100
+ router_id: 203.0.113.20
+ - process_id: 102
+ router_id: 198.51.100.1
areas:
- - area_id: 0.0.0.102
- nssa:
- default_information_originate: true
- no_summary: true
- - area_id: 0.0.0.103
- nssa:
- no_summary: true
- translate:
- type7:
- always: true
- - vrf: zone2
- auto_cost:
- reference_bandwidth: 45
- unit: Gbps
+ - area_id: 0.0.0.100
+ filter_list:
+ - route_map: rmap_1
+ direction: in
+ - route_map: rmap_2
+ direction: out
+ ranges:
+ - prefix: 198.51.100.64/27
+ not_advertise: true
+ - prefix: 198.51.100.96/27
+ cost: 120
+ - area_id: 0.0.0.101
+ authentication:
+ message_digest: true
+ redistribute:
+ - protocol: eigrp
+ id: 120
+ route_map: rmap_1
+ - protocol: direct
+ route_map: ospf102-direct-connect
+ vrfs:
+ - vrf: zone1
+ router_id: 198.51.100.129
+ redistribute:
+ - protocol: static
+ route_map: zone1-static-connect
+ summary_address:
+ - prefix: 198.51.100.128/27
+ tag: 121
+ - prefix: 198.51.100.160/27
+ areas:
+ - area_id: 0.0.0.102
+ nssa:
+ default_information_originate: true
+ no_summary: true
+ - area_id: 0.0.0.103
+ nssa:
+ no_summary: true
+ translate:
+ type7:
+ always: true
+ - vrf: zone2
+ auto_cost:
+ reference_bandwidth: 45
+ unit: Gbps
state: rendered
+
# Task output:
# ------------
# rendered:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv3.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv3.py
index 357afda11..226de291b 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv3.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_ospfv3.py
@@ -87,7 +87,7 @@ options:
description:
- The Area ID in IP Address format.
type: str
- required: True
+ required: true
default_cost:
description:
- Specify the default cost.
@@ -102,13 +102,13 @@ options:
description:
- The Route-map name.
type: str
- required: True
+ required: true
direction:
description:
- The direction to apply the route map.
type: str
choices: [in, out]
- required: True
+ required: true
ranges:
description:
- Configure an address range for the area.
@@ -119,7 +119,7 @@ options:
description:
- IP in Prefix format (x.x.x.x/len)
type: str
- required: True
+ required: true
cost:
description:
- Cost to use for the range.
@@ -169,7 +169,7 @@ options:
- The name of the protocol.
type: str
choices: [bgp, direct, eigrp, isis, lisp, ospfv3, rip, static]
- required: True
+ required: true
id:
description:
- The identifier for the protocol specified.
@@ -178,7 +178,7 @@ options:
description:
- The route map policy to constrain redistribution.
type: str
- required: True
+ required: true
summary_address:
description:
- Configure route summarization for redistribution.
@@ -189,7 +189,7 @@ options:
description:
- IPv6 prefix format 'xxxx:xxxx/ml', 'xxxx:xxxx::/ml' or 'xxxx::xx/128'
type: str
- required: True
+ required: true
not_advertise:
description:
- Suppress advertising the specified summary.
@@ -208,7 +208,7 @@ options:
description:
- The Route Map name.
type: str
- required: True
+ required: true
filter:
description:
- Block the OSPF routes from being sent to RIB.
@@ -250,7 +250,7 @@ options:
description:
- The Area ID in IP Address format.
type: str
- required: True
+ required: true
nssa:
description:
- NSSA settings for the area.
@@ -320,12 +320,12 @@ options:
description:
- Reference bandwidth used to assign OSPF cost.
type: int
- required: True
+ required: true
unit:
description:
- Specify in which unit the reference bandwidth is specified.
type: str
- required: True
+ required: true
choices: [Gbps, Mbps]
flush_routes:
description:
@@ -378,7 +378,7 @@ options:
description:
- Set the maximum number of non self-generated LSAs.
type: int
- required: True
+ required: true
threshold:
description:
- Threshold value (%) at which to generate a warning message.
@@ -477,7 +477,7 @@ options:
description:
- The OSPF process tag.
type: str
- required: True
+ required: true
router_id:
description:
- Set OSPF process router-id.
@@ -537,7 +537,7 @@ options:
description:
- The Area ID in IP Address format.
type: str
- required: True
+ required: true
nssa:
description:
- NSSA settings for the area.
@@ -607,12 +607,12 @@ options:
description:
- Reference bandwidth used to assign OSPF cost.
type: int
- required: True
+ required: true
unit:
description:
- Specify in which unit the reference bandwidth is specified.
type: str
- required: True
+ required: true
choices: [Gbps, Mbps]
graceful_restart:
description:
@@ -657,7 +657,7 @@ options:
description:
- Set the maximum number of non self-generated LSAs.
type: int
- required: True
+ required: true
threshold:
description:
- Threshold value (%) at which to generate a warning message.
@@ -799,7 +799,7 @@ options:
description:
- Name/Identifier of the VRF.
type: str
- required: True
+ required: true
state:
description:
- The state the configuration should be left in.
@@ -826,49 +826,49 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv3:
config:
processes:
- - process_id: 100
- router_id: 203.0.113.20
- - process_id: 102
- router_id: 198.51.100.1
- address_family:
- afi: ipv6
- safi: unicast
- areas:
- - area_id: 0.0.0.100
- filter_list:
- - route_map: rmap_1
- direction: in
- - route_map: rmap_2
- direction: out
- ranges:
- - prefix: 2001:db2::/32
- not_advertise: true
- - prefix: 2001:db3::/32
- cost: 120
- redistribute:
- - protocol: eigrp
- id: 120
- route_map: rmap_1
- - protocol: direct
- route_map: ospf102-direct-connect
- vrfs:
- - vrf: zone1
- router_id: 198.51.100.129
- areas:
- - area_id: 0.0.0.102
- nssa:
- default_information_originate: true
- no_summary: true
- - area_id: 0.0.0.103
- nssa:
- no_summary: true
- translate:
- type7:
- always: true
- - vrf: zone2
- auto_cost:
- reference_bandwidth: 45
- unit: Gbps
+ - process_id: 100
+ router_id: 203.0.113.20
+ - process_id: 102
+ router_id: 198.51.100.1
+ address_family:
+ afi: ipv6
+ safi: unicast
+ areas:
+ - area_id: 0.0.0.100
+ filter_list:
+ - route_map: rmap_1
+ direction: in
+ - route_map: rmap_2
+ direction: out
+ ranges:
+ - prefix: '2001:db2::/32'
+ not_advertise: true
+ - prefix: '2001:db3::/32'
+ cost: 120
+ redistribute:
+ - protocol: eigrp
+ id: 120
+ route_map: rmap_1
+ - protocol: direct
+ route_map: ospf102-direct-connect
+ vrfs:
+ - vrf: zone1
+ router_id: 198.51.100.129
+ areas:
+ - area_id: 0.0.0.102
+ nssa:
+ default_information_originate: true
+ no_summary: true
+ - area_id: 0.0.0.103
+ nssa:
+ no_summary: true
+ translate:
+ type7:
+ always: true
+ - vrf: zone2
+ auto_cost:
+ reference_bandwidth: 45
+ unit: Gbps
state: merged
# Task output:
@@ -992,33 +992,33 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv3:
config:
processes:
- - process_id: 102
- router_id: 198.51.100.1
- address_family:
- afi: ipv6
- safi: unicast
- areas:
- - area_id: 0.0.0.100
- filter_list:
- - route_map: rmap_8
- direction: in
- ranges:
- - not_advertise: true
- prefix: 2001:db2::/32
- redistribute:
- - protocol: eigrp
- id: 130
- route_map: rmap_1
- - protocol: direct
- route_map: ospf102-direct-connect
- vrfs:
- - vrf: zone1
- router_id: 198.51.100.129
- areas:
- - area_id: 0.0.0.102
- nssa:
- default_information_originate: True
- no_summary: True
+ - process_id: 102
+ router_id: 198.51.100.1
+ address_family:
+ afi: ipv6
+ safi: unicast
+ areas:
+ - area_id: 0.0.0.100
+ filter_list:
+ - route_map: rmap_8
+ direction: in
+ ranges:
+ - not_advertise: true
+ prefix: 2001:db2::/32
+ redistribute:
+ - protocol: eigrp
+ id: 130
+ route_map: rmap_1
+ - protocol: direct
+ route_map: ospf102-direct-connect
+ vrfs:
+ - vrf: zone1
+ router_id: 198.51.100.129
+ areas:
+ - area_id: 0.0.0.102
+ nssa:
+ default_information_originate: true
+ no_summary: true
state: replaced
# Task output:
@@ -1158,11 +1158,11 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv3:
config:
processes:
- - process_id: 104
- router_id: 203.0.113.20
- - process_id: 102
- router_id: 198.51.100.1
- shutdown: true
+ - process_id: 104
+ router_id: 203.0.113.20
+ - process_id: 102
+ router_id: 198.51.100.1
+ shutdown: true
state: overridden
# Task output:
@@ -1278,7 +1278,7 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv3:
config:
processes:
- - process_id: 102
+ - process_id: 102
state: deleted
# Task output:
@@ -1330,7 +1330,7 @@ EXAMPLES = """
# vrf: zone2
#
# commands:
-# - no router ospfv3 102
+# - no router ospfv3 102
#
# after:
# processes:
@@ -1436,49 +1436,49 @@ EXAMPLES = """
cisco.nxos.nxos_ospfv3:
config:
processes:
- - process_id: 100
- router_id: 203.0.113.20
- - process_id: 102
- router_id: 198.51.100.1
- address_family:
- afi: ipv6
- safi: unicast
- areas:
- - area_id: 0.0.0.100
- filter_list:
- - route_map: rmap_1
- direction: in
- - route_map: rmap_2
- direction: out
- ranges:
- - prefix: 2001:db2::/32
- not_advertise: true
- - prefix: 2001:db3::/32
- cost: 120
- redistribute:
- - protocol: eigrp
- id: 120
- route_map: rmap_1
- - protocol: direct
- route_map: ospf102-direct-connect
- vrfs:
- - vrf: zone1
- router_id: 198.51.100.129
- areas:
- - area_id: 0.0.0.102
- nssa:
- default_information_originate: true
- no_summary: true
- - area_id: 0.0.0.103
- nssa:
- no_summary: true
- translate:
- type7:
- always: true
- - vrf: zone2
- auto_cost:
- reference_bandwidth: 45
- unit: Gbps
+ - process_id: 100
+ router_id: 203.0.113.20
+ - process_id: 102
+ router_id: 198.51.100.1
+ address_family:
+ afi: ipv6
+ safi: unicast
+ areas:
+ - area_id: 0.0.0.100
+ filter_list:
+ - route_map: rmap_1
+ direction: in
+ - route_map: rmap_2
+ direction: out
+ ranges:
+ - prefix: 2001:db2::/32
+ not_advertise: true
+ - prefix: 2001:db3::/32
+ cost: 120
+ redistribute:
+ - protocol: eigrp
+ id: 120
+ route_map: rmap_1
+ - protocol: direct
+ route_map: ospf102-direct-connect
+ vrfs:
+ - vrf: zone1
+ router_id: 198.51.100.129
+ areas:
+ - area_id: 0.0.0.102
+ nssa:
+ default_information_originate: true
+ no_summary: true
+ - area_id: 0.0.0.103
+ nssa:
+ no_summary: true
+ translate:
+ type7:
+ always: true
+ - vrf: zone2
+ auto_cost:
+ reference_bandwidth: 45
+ unit: Gbps
state: rendered
# Task output:
@@ -1571,7 +1571,7 @@ EXAMPLES = """
# router_id: 192.0.100.2
# - process_id: "102"
# router_id: 198.54.100.1
-# shutdown: True
+# shutdown: true
# Using gathered
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_route_maps.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_route_maps.py
index bcf7076f0..bf57dcb7a 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_route_maps.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_route_maps.py
@@ -573,44 +573,44 @@ EXAMPLES = """
- route_map: rmap3
entries:
- - sequence: 10
- description: "*** first stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- verify_availability:
- - address: 3.3.3.3
- track: 1
- - address: 4.4.4.4
- track: 3
+ - sequence: 10
+ description: "*** first stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ verify_availability:
+ - address: 3.3.3.3
+ track: 1
+ - address: 4.4.4.4
+ track: 3
- - sequence: 20
- description: "*** second stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- address: 6.6.6.6 2.2.2.2
- load_share: true
- drop_on_fail: true
+ - sequence: 20
+ description: "*** second stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ address: 6.6.6.6 2.2.2.2
+ load_share: true
+ drop_on_fail: true
- - sequence: 30
- description: "*** third stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- peer_address: true
+ - sequence: 30
+ description: "*** third stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ peer_address: true
- - sequence: 40
- description: "*** fourth stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- unchanged: true
- redist_unchanged: true
+ - sequence: 40
+ description: "*** fourth stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ unchanged: true
+ redist_unchanged: true
state: merged
# Task output
@@ -875,35 +875,35 @@ EXAMPLES = """
- AllowPrefix1
set:
community:
- local_as: True
+ local_as: true
- route_map: rmap3
entries:
- - sequence: 10
- description: "*** first stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- verify_availability:
- - address: 3.3.3.3
- track: 1
- - sequence: 20
- description: "*** second stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- peer_address: true
- - sequence: 30
- description: "*** third stanza ***"
- action: permit
- set:
- ip:
- next_hop:
- address: 6.6.6.6 2.2.2.2
- load_share: true
- drop_on_fail: true
+ - sequence: 10
+ description: "*** first stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ verify_availability:
+ - address: 3.3.3.3
+ track: 1
+ - sequence: 20
+ description: "*** second stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ peer_address: true
+ - sequence: 30
+ description: "*** third stanza ***"
+ action: permit
+ set:
+ ip:
+ next_hop:
+ address: 6.6.6.6 2.2.2.2
+ load_share: true
+ drop_on_fail: true
state: replaced
# Task output
@@ -1062,7 +1062,7 @@ EXAMPLES = """
# - AllowPrefix1
# set:
# community:
-# local_as: True
+# local_as: true
#
# - route_map: rmap2
# entries:
@@ -1210,7 +1210,7 @@ EXAMPLES = """
- AllowPrefix1
set:
community:
- local_as: True
+ local_as: true
state: overridden
# Task output
@@ -1321,7 +1321,7 @@ EXAMPLES = """
# - AllowPrefix1
# set:
# community:
-# local_as: True
+# local_as: true
#
# After state:
# ------------
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_snmp_server.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_snmp_server.py
index 7354dc1ee..d31dbc72c 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_snmp_server.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_snmp_server.py
@@ -727,18 +727,18 @@ EXAMPLES = """
location: serverroom-1
traps:
aaa:
- server_state_change: True
+ server_state_change: true
system:
- clock_change_notification: True
+ clock_change_notification: true
hosts:
- host: 192.0.2.1
- traps: True
+ traps: true
version: '1'
community: public
- host: 192.0.2.1
source_interface: Ethernet1/1
- host: 192.0.2.2
- informs: True
+ informs: true
version: '3'
auth: NMS
users:
@@ -748,16 +748,16 @@ EXAMPLES = """
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
- localized_key: True
+ localized_key: true
- user: snmp_user_2
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
- localized_key: True
+ localized_key: true
priv:
privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
- aes_128: True
+ aes_128: true
use_acls:
- user: snmp_user_1
ipv4: acl1
@@ -776,7 +776,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
@@ -808,9 +808,9 @@ EXAMPLES = """
# location: serverroom-1
# traps:
# aaa:
-# server_state_change: True
+# server_state_change: true
# system:
-# clock_change_notification: True
+# clock_change_notification: true
# hosts:
# - host: 192.0.2.1
# traps: true
@@ -831,7 +831,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
@@ -840,7 +840,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
-# localized_key: True
+# localized_key: true
#
# - authentication:
# algorithm: md5
@@ -914,16 +914,16 @@ EXAMPLES = """
location: serverroom-2
traps:
aaa:
- server_state_change: True
+ server_state_change: true
hosts:
- host: 192.0.2.1
- traps: True
+ traps: true
version: '1'
community: public
- host: 192.0.2.1
source_interface: Ethernet1/1
- host: 192.0.3.2
- informs: True
+ informs: true
version: '3'
auth: NMS
users:
@@ -933,7 +933,7 @@ EXAMPLES = """
authentication:
algorithm: md5
password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
- localized_key: True
+ localized_key: true
priv:
privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
@@ -942,17 +942,17 @@ EXAMPLES = """
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
- localized_key: True
+ localized_key: true
- user: snmp_user_2
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
- localized_key: True
+ localized_key: true
priv:
privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
- aes_128: True
+ aes_128: true
use_acls:
- user: snmp_user_1
ipv4: acl1
@@ -973,9 +973,9 @@ EXAMPLES = """
# location: serverroom-1
# traps:
# aaa:
-# server_state_change: True
+# server_state_change: true
# system:
-# clock_change_notification: True
+# clock_change_notification: true
# hosts:
# - host: 192.0.2.1
# traps: true
@@ -996,7 +996,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
@@ -1005,7 +1005,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
-# localized_key: True
+# localized_key: true
#
# - authentication:
# algorithm: md5
@@ -1047,16 +1047,16 @@ EXAMPLES = """
# location: serverroom-2
# traps:
# aaa:
-# server_state_change: True
+# server_state_change: true
# hosts:
# - host: 192.0.2.1
-# traps: True
+# traps: true
# version: '1'
# community: public
# - host: 192.0.2.1
# source_interface: Ethernet1/1
# - host: 192.0.3.2
-# informs: True
+# informs: true
# version: '3'
# auth: NMS
# users:
@@ -1066,7 +1066,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
@@ -1075,17 +1075,17 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: '0x5632724fb8ac3699296af26281e1d0f1'
-# localized_key: True
+# localized_key: true
#
# - user: snmp_user_2
# group: network-operator
# authentication:
# algorithm: md5
# password: '0x5632724fb8ac3699296af26281e1d0f1'
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
-# aes_128: True
+# aes_128: true
#
# use_acls:
# - user: snmp_user_1
@@ -1151,9 +1151,9 @@ EXAMPLES = """
# location: serverroom-1
# traps:
# aaa:
-# server_state_change: True
+# server_state_change: true
# system:
-# clock_change_notification: True
+# clock_change_notification: true
# hosts:
# - host: 192.0.2.1
# traps: true
@@ -1174,7 +1174,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
@@ -1183,7 +1183,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
-# localized_key: True
+# localized_key: true
#
# - authentication:
# algorithm: md5
@@ -1228,7 +1228,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
-# localized_key: True
+# localized_key: true
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
@@ -1254,18 +1254,18 @@ EXAMPLES = """
location: serverroom-1
traps:
aaa:
- server_state_change: True
+ server_state_change: true
system:
- clock_change_notification: True
+ clock_change_notification: true
hosts:
- host: 192.0.2.1
- traps: True
+ traps: true
version: '1'
community: public
- host: 192.0.2.1
source_interface: Ethernet1/1
- host: 192.0.2.2
- informs: True
+ informs: true
version: '3'
auth: NMS
users:
@@ -1275,16 +1275,16 @@ EXAMPLES = """
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
- localized_key: True
+ localized_key: true
- user: snmp_user_2
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
- localized_key: True
+ localized_key: true
priv:
privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
- aes_128: True
+ aes_128: true
use_acls:
- user: snmp_user_1
ipv4: acl1
@@ -1351,9 +1351,9 @@ EXAMPLES = """
# location: serverroom-1
# traps:
# aaa:
-# server_state_change: True
+# server_state_change: true
# system:
-# clock_change_notification: True
+# clock_change_notification: true
# hosts:
# - host: 192.0.2.1
# traps: true
@@ -1374,7 +1374,7 @@ EXAMPLES = """
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
-# localized_key: True
+# localized_key: true
#
# - authentication:
# algorithm: md5
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_static_routes.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_static_routes.py
index a7fdf6713..679f5cdb4 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_static_routes.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_static_routes.py
@@ -184,7 +184,7 @@ EXAMPLES = """
- name: Delete routes based on VRF
cisco.nxos.nxos_static_routes:
config:
- - vrf: trial_vrf
+ - vrf: trial_vrf
state: deleted
# Task Output
@@ -264,9 +264,9 @@ EXAMPLES = """
- name: Delete routes based on AFI in a VRF
cisco.nxos.nxos_static_routes:
config:
- - vrf: trial_vrf
- address_families:
- - afi: ipv4
+ - vrf: trial_vrf
+ address_families:
+ - afi: ipv4
state: deleted
# Task Output
@@ -348,28 +348,28 @@ EXAMPLES = """
- name: Merge new static route configuration
cisco.nxos.nxos_static_routes:
config:
- - vrf: trial_vrf
- address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.64/24
- next_hops:
- - forward_router_address: 192.0.2.22
- tag: 4
- admin_distance: 2
- - address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.16/24
- next_hops:
- - forward_router_address: 192.0.2.24
- route_name: new_route
- - afi: ipv6
- routes:
- - dest: 2001:db8::/64
- next_hops:
- - interface: eth1/3
- forward_router_address: 2001:db8::12
+ - vrf: trial_vrf
+ address_families:
+ - afi: ipv4
+ routes:
+ - dest: 192.0.2.64/24
+ next_hops:
+ - forward_router_address: 192.0.2.22
+ tag: 4
+ admin_distance: 2
+ - address_families:
+ - afi: ipv4
+ routes:
+ - dest: 192.0.2.16/24
+ next_hops:
+ - forward_router_address: 192.0.2.24
+ route_name: new_route
+ - afi: ipv6
+ routes:
+ - dest: '2001:db8::/64'
+ next_hops:
+ - interface: eth1/3
+ forward_router_address: '2001:db8::12'
state: merged
# Task Output
@@ -431,19 +431,19 @@ EXAMPLES = """
- name: Overridden existing static route configuration with new configuration
cisco.nxos.nxos_static_routes:
config:
- - vrf: trial_vrf
- address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.16/28
- next_hops:
- - forward_router_address: 192.0.2.23
- route_name: overridden_route1
- admin_distance: 3
- - forward_router_address: 192.0.2.45
- route_name: overridden_route2
- dest_vrf: destinationVRF
- interface: Ethernet1/2
+ - vrf: trial_vrf
+ address_families:
+ - afi: ipv4
+ routes:
+ - dest: 192.0.2.16/28
+ next_hops:
+ - forward_router_address: 192.0.2.23
+ route_name: overridden_route1
+ admin_distance: 3
+ - forward_router_address: 192.0.2.45
+ route_name: overridden_route2
+ dest_vrf: destinationVRF
+ interface: Ethernet1/2
state: overridden
# Task Output
@@ -520,18 +520,18 @@ EXAMPLES = """
- name: Replaced the existing static configuration of a prefix with new configuration
cisco.nxos.nxos_static_routes:
config:
- - address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.16/28
- next_hops:
- - forward_router_address: 192.0.2.23
- route_name: replaced_route1
- admin_distance: 3
- - forward_router_address: 192.0.2.45
- route_name: replaced_route2
- dest_vrf: destinationVRF
- interface: Ethernet1/2
+ - address_families:
+ - afi: ipv4
+ routes:
+ - dest: 192.0.2.16/28
+ next_hops:
+ - forward_router_address: 192.0.2.23
+ route_name: replaced_route1
+ admin_distance: 3
+ - forward_router_address: 192.0.2.45
+ route_name: replaced_route2
+ dest_vrf: destinationVRF
+ interface: Ethernet1/2
state: replaced
# Task Output
@@ -650,18 +650,18 @@ EXAMPLES = """
- name: Render required configuration to be pushed to the device
cisco.nxos.nxos_static_routes:
config:
- - address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.48/28
- next_hops:
- - forward_router_address: 192.0.2.13
- - afi: ipv6
- routes:
- - dest: 2001:db8::/64
- next_hops:
- - interface: eth1/3
- forward_router_address: 2001:db8::12
+ - address_families:
+ - afi: ipv4
+ routes:
+ - dest: 192.0.2.48/28
+ next_hops:
+ - forward_router_address: 192.0.2.13
+ - afi: ipv6
+ routes:
+ - dest: 2001:db8::/64
+ next_hops:
+ - interface: eth1/3
+ forward_router_address: 2001:db8::12
state: rendered
# Task Output
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_system.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_system.py
index df4bbde0d..dafbf9f1f 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_system.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_system.py
@@ -98,14 +98,14 @@ EXAMPLES = """
- name: configure name servers
cisco.nxos.nxos_system:
name_servers:
- - 8.8.8.8
- - 8.8.4.4
+ - 8.8.8.8
+ - 8.8.4.4
- name: configure name servers with VRF support
cisco.nxos.nxos_system:
name_servers:
- - {server: 8.8.8.8, vrf: mgmt}
- - {server: 8.8.4.4, vrf: mgmt}
+ - {server: 8.8.8.8, vrf: mgmt}
+ - {server: 8.8.4.4, vrf: mgmt}
"""
RETURN = """
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_telemetry.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_telemetry.py
index 7498ff880..89a58e2d2 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_telemetry.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_telemetry.py
@@ -225,41 +225,41 @@ EXAMPLES = """
source_interface: Ethernet1/1
vrf: management
destination_groups:
- - id: 2
- destination:
- ip: 192.168.0.2
- port: 50001
- protocol: gRPC
- encoding: GPB
- - id: 55
- destination:
- ip: 192.168.0.55
- port: 60001
- protocol: gRPC
- encoding: GPB
+ - id: 2
+ destination:
+ ip: 192.168.0.2
+ port: 50001
+ protocol: gRPC
+ encoding: GPB
+ - id: 55
+ destination:
+ ip: 192.168.0.55
+ port: 60001
+ protocol: gRPC
+ encoding: GPB
sensor_groups:
- - id: 1
- data_source: NX-API
- path:
- name: '"show lldp neighbors detail"'
- depth: 0
- - id: 55
- data_source: DME
- path:
- name: sys/ch
- depth: unbounded
- filter_condition: ne(eqptFt.operSt,"ok")
+ - id: 1
+ data_source: NX-API
+ path:
+ name: '"show lldp neighbors detail"'
+ depth: 0
+ - id: 55
+ data_source: DME
+ path:
+ name: sys/ch
+ depth: unbounded
+ filter_condition: ne(eqptFt.operSt,"ok")
subscriptions:
- - id: 5
- destination_group: 55
- sensor_group:
- id: 1
- sample_interval: 1000
- - id: 6
- destination_group: 2
- sensor_group:
- id: 55
- sample_interval: 2000
+ - id: 5
+ destination_group: 55
+ sensor_group:
+ id: 1
+ sample_interval: 1000
+ - id: 6
+ destination_group: 2
+ sensor_group:
+ id: 55
+ sample_interval: 2000
state: merged
@@ -277,18 +277,16 @@ EXAMPLES = """
source_interface: Ethernet1/1
vrf: management
destination_groups:
- - id: 2
- destination:
- ip: 192.168.0.2
- port: 50001
- protocol: gRPC
- encoding: GPB
+ - id: 2
+ destination:
+ ip: 192.168.0.2
+ port: 50001
+ protocol: gRPC
+ encoding: GPB
subscriptions:
- - id: 5
- destination_group: 55
+ - id: 5
+ destination_group: 55
state: replaced
-
-
"""
RETURN = """
before:
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_user.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_user.py
index 2456c53ac..d3e847359 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_user.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_user.py
@@ -170,8 +170,8 @@ EXAMPLES = """
- name: set multiple users role
cisco.nxos.nxos_user:
aggregate:
- - name: netop
- - name: netend
+ - name: netop
+ - name: netend
role: network-operator
state: present
"""
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py
index cac276b64..4116f524b 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_vlans.py
@@ -117,10 +117,10 @@ EXAMPLES = """
- name: Merge provided configuration with device configuration.
cisco.nxos.nxos_vlans:
config:
- - vlan_id: 5
- name: test-vlan5
- - vlan_id: 10
- enabled: false
+ - vlan_id: 5
+ name: test-vlan5
+ - vlan_id: 10
+ enabled: false
state: merged
# After state:
@@ -147,11 +147,11 @@ EXAMPLES = """
- name: Replace device configuration of specified vlan with provided configuration.
cisco.nxos.nxos_vlans:
config:
- - vlan_id: 5
- name: test-vlan
- enabled: false
- - vlan_id: 10
- enabled: false
+ - vlan_id: 5
+ name: test-vlan
+ enabled: false
+ - vlan_id: 10
+ enabled: false
state: replaced
# After state:
@@ -182,10 +182,10 @@ EXAMPLES = """
- name: Override device configuration of all vlans with provided configuration.
cisco.nxos.nxos_vlans:
config:
- - vlan_id: 5
- name: test-vlan
- - vlan_id: 10
- state: active
+ - vlan_id: 5
+ name: test-vlan
+ - vlan_id: 10
+ state: active
state: overridden
# After state:
@@ -210,8 +210,8 @@ EXAMPLES = """
- name: Delete vlans.
cisco.nxos.nxos_vlans:
config:
- - vlan_id: 5
- - vlan_id: 10
+ - vlan_id: 5
+ - vlan_id: 10
state: deleted
# After state:
@@ -223,13 +223,13 @@ EXAMPLES = """
- name: Use rendered state to convert task input to device specific commands
cisco.nxos.nxos_vlans:
config:
- - vlan_id: 5
- name: vlan5
- mapped_vni: 100
+ - vlan_id: 5
+ name: vlan5
+ mapped_vni: 100
- - vlan_id: 6
- name: vlan6
- state: suspend
+ - vlan_id: 6
+ name: vlan6
+ state: suspend
state: rendered
# Task Output (redacted)
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf.py
index 6b81ba99a..6017d3c88 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf.py
@@ -169,48 +169,48 @@ EXAMPLES = """
name: ntc
description: testing
state: present
-
- name: Aggregate definition of VRFs
cisco.nxos.nxos_vrf:
aggregate:
- - {name: test1, description: Testing, admin_state: down}
- - {name: test2, interfaces: Ethernet1/2}
-
+ - name: test1
+ description: Testing
+ admin_state: down
+ - name: test2
+ interfaces: Ethernet1/2
- name: Aggregate definitions of VRFs with Purge
cisco.nxos.nxos_vrf:
aggregate:
- - {name: ntc1, description: purge test1}
- - {name: ntc2, description: purge test2}
+ - name: ntc1
+ description: purge test1
+ - name: ntc2
+ description: purge test2
state: present
purge: true
-
- name: Delete VRFs exist on switch
cisco.nxos.nxos_vrf:
aggregate:
- - {name: ntc1}
- - {name: ntc2}
+ - name: ntc1
+ - name: ntc2
state: absent
-
- name: Assign interfaces to VRF declaratively
cisco.nxos.nxos_vrf:
name: test1
interfaces:
- - Ethernet2/3
- - Ethernet2/5
-
+ - Ethernet2/3
+ - Ethernet2/5
- name: Check interfaces assigned to VRF
cisco.nxos.nxos_vrf:
name: test1
associated_interfaces:
- - Ethernet2/3
- - Ethernet2/5
-
-- name: Ensure VRF is tagged with interface Ethernet2/5 only (Removes from Ethernet2/3)
+ - Ethernet2/3
+ - Ethernet2/5
+- name: >-
+ Ensure VRF is tagged with interface Ethernet2/5 only (Removes from
+ Ethernet2/3)
cisco.nxos.nxos_vrf:
name: test1
interfaces:
- - Ethernet2/5
-
+ - Ethernet2/5
- name: Delete VRF
cisco.nxos.nxos_vrf:
name: ntc
@@ -375,7 +375,9 @@ def map_obj_to_commands(updates, module):
commands.append("vrf member {0}".format(name))
elif set(interfaces) != set(obj_in_have["interfaces"]):
- missing_interfaces = list(set(interfaces) - set(obj_in_have["interfaces"]))
+ missing_interfaces = list(
+ set(interfaces) - set(obj_in_have["interfaces"]),
+ )
for i in missing_interfaces:
commands.append("vrf context {0}".format(name))
commands.append("exit")
@@ -541,7 +543,9 @@ def check_declarative_intent_params(want, module, element_spec, result):
if obj_in_have:
interfaces = obj_in_have.get("interfaces")
if interfaces is not None and i not in interfaces:
- module.fail_json(msg="Interface %s not configured on vrf %s" % (i, w["name"]))
+ module.fail_json(
+ msg="Interface %s not configured on vrf %s" % (i, w["name"]),
+ )
def vrf_error_check(module, commands, responses):
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf_af.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf_af.py
index bf155ce8f..5bd043706 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf_af.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_vrf_af.py
@@ -103,55 +103,50 @@ EXAMPLES = """
afi: ipv4
route_target_both_auto_evpn: true
state: present
-
- cisco.nxos.nxos_vrf_af:
vrf: ntc
afi: ipv4
route_targets:
- - rt: 65000:1000
- direction: import
- - rt: 65001:1000
- direction: import
-
+ - rt: '65000:1000'
+ direction: import
+ - rt: '65001:1000'
+ direction: import
- cisco.nxos.nxos_vrf_af:
vrf: ntc
afi: ipv4
route_targets:
- - rt: 65000:1000
- direction: import
- - rt: 65001:1000
- state: absent
-
+ - rt: '65000:1000'
+ direction: import
+ - rt: '65001:1000'
+ state: absent
- cisco.nxos.nxos_vrf_af:
vrf: ntc
afi: ipv4
route_targets:
- - rt: 65000:1000
- direction: export
- - rt: 65001:1000
- direction: export
-
+ - rt: '65000:1000'
+ direction: export
+ - rt: '65001:1000'
+ direction: export
- cisco.nxos.nxos_vrf_af:
vrf: ntc
afi: ipv4
route_targets:
- - rt: 65000:1000
- direction: export
- state: absent
-
+ - rt: '65000:1000'
+ direction: export
+ state: absent
- cisco.nxos.nxos_vrf_af:
vrf: ntc
afi: ipv4
route_targets:
- - rt: 65000:1000
- direction: both
- state: present
- - rt: 65001:1000
- direction: import
- state: present
- - rt: 65002:1000
- direction: both
- state: absent
+ - rt: '65000:1000'
+ direction: both
+ state: present
+ - rt: '65001:1000'
+ direction: import
+ state: present
+ - rt: '65002:1000'
+ direction: both
+ state: absent
"""
RETURN = """
@@ -248,10 +243,25 @@ def main():
if platform.startswith("N9K") and rt.get("rt") == "auto":
rt_commands = match_current_rt(rt, "both", current, rt_commands)
else:
- rt_commands = match_current_rt(rt, "import", current, rt_commands)
- rt_commands = match_current_rt(rt, "export", current, rt_commands)
+ rt_commands = match_current_rt(
+ rt,
+ "import",
+ current,
+ rt_commands,
+ )
+ rt_commands = match_current_rt(
+ rt,
+ "export",
+ current,
+ rt_commands,
+ )
else:
- rt_commands = match_current_rt(rt, rt.get("direction"), current, rt_commands)
+ rt_commands = match_current_rt(
+ rt,
+ rt.get("direction"),
+ current,
+ rt_commands,
+ )
if rt_commands:
commands.extend(rt_commands)
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_vsan.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_vsan.py
index d95d95a96..70f9b50ee 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_vsan.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_vsan.py
@@ -51,25 +51,25 @@ EXAMPLES = """
- name: Test that vsan module works
cisco.nxos.nxos_vsan:
vsan:
- - id: 922
- interface:
- - fc1/1
- - fc1/2
- - port-channel 1
- name: vsan-SAN-A
- remove: false
- suspend: false
- - id: 923
- interface:
- - fc1/11
- - fc1/21
- - port-channel 2
- name: vsan-SAN-B
- remove: false
- suspend: true
- - id: 1923
- name: vsan-SAN-Old
- remove: true
+ - id: 922
+ interface:
+ - fc1/1
+ - fc1/2
+ - port-channel 1
+ name: vsan-SAN-A
+ remove: false
+ suspend: false
+ - id: 923
+ interface:
+ - fc1/11
+ - fc1/21
+ - port-channel 2
+ name: vsan-SAN-B
+ remove: false
+ suspend: true
+ - id: 1923
+ name: vsan-SAN-Old
+ remove: true
"""
RETURN = """
@@ -198,7 +198,9 @@ def main():
interface=dict(type="list", elements="str"),
)
- argument_spec = dict(vsan=dict(type="list", elements="dict", options=vsan_element_spec))
+ argument_spec = dict(
+ vsan=dict(type="list", elements="dict", options=vsan_element_spec),
+ )
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
warnings = list()
@@ -238,7 +240,9 @@ def main():
if vsanremove:
# Negative case:
if vsanid == "4079" or vsanid == "4094":
- messages.append(str(vsanid) + " is a reserved vsan, hence cannot be removed")
+ messages.append(
+ str(vsanid) + " is a reserved vsan, hence cannot be removed",
+ )
continue
if vsanid == sw_vsanid:
commands.append("no vsan " + str(vsanid))
@@ -270,7 +274,9 @@ def main():
if vsanname is not None:
# Negative case:
if vsanid == "4079" or vsanid == "4094":
- messages.append(str(vsanid) + " is a reserved vsan, and cannot be renamed")
+ messages.append(
+ str(vsanid) + " is a reserved vsan, and cannot be renamed",
+ )
else:
if vsanname == sw_vsanname:
messages.append(
@@ -282,12 +288,16 @@ def main():
)
else:
commands.append("vsan " + str(vsanid) + " name " + vsanname)
- messages.append("setting vsan name to " + vsanname + " for vsan " + str(vsanid))
+ messages.append(
+ "setting vsan name to " + vsanname + " for vsan " + str(vsanid),
+ )
if vsansuspend:
# Negative case:
if vsanid == "4079" or vsanid == "4094":
- messages.append(str(vsanid) + " is a reserved vsan, and cannot be suspended")
+ messages.append(
+ str(vsanid) + " is a reserved vsan, and cannot be suspended",
+ )
else:
if sw_vsanstate == "suspended":
messages.append(
@@ -322,7 +332,9 @@ def main():
+ " interface list",
)
else:
- commands.append("vsan " + str(vsanid) + " interface " + each_interface_name)
+ commands.append(
+ "vsan " + str(vsanid) + " interface " + each_interface_name,
+ )
messages.append(
"adding interface " + each_interface_name + " to vsan " + str(vsanid),
)
diff --git a/ansible_collections/cisco/nxos/plugins/modules/nxos_zone_zoneset.py b/ansible_collections/cisco/nxos/plugins/modules/nxos_zone_zoneset.py
index 7c9fba30a..5d519150f 100644
--- a/ansible_collections/cisco/nxos/plugins/modules/nxos_zone_zoneset.py
+++ b/ansible_collections/cisco/nxos/plugins/modules/nxos_zone_zoneset.py
@@ -10,180 +10,184 @@ DOCUMENTATION = """
module: nxos_zone_zoneset
short_description: Configuration of zone/zoneset for Cisco NXOS MDS Switches.
description:
-- Configuration of zone/zoneset for Cisco MDS NXOS.
+ - Configuration of zone/zoneset for Cisco MDS NXOS.
version_added: 1.0.0
author:
-- Suhas Bharadwaj (@srbharadwaj) (subharad@cisco.com)
+ - Suhas Bharadwaj (@srbharadwaj) (subharad@cisco.com)
notes:
-- Tested against Cisco MDS NX-OS 8.4(1)
+ - Tested against Cisco MDS NX-OS 8.4(1)
options:
zone_zoneset_details:
description:
- - List of zone/zoneset details to be added or removed
+ - List of zone/zoneset details to be added or removed
type: list
elements: dict
suboptions:
vsan:
description:
- - vsan id
+ - vsan id
required: true
type: int
mode:
description:
- - mode of the zone for the vsan
+ - mode of the zone for the vsan
choices:
- - enhanced
- - basic
+ - enhanced
+ - basic
type: str
default_zone:
description:
- - default zone behaviour for the vsan
+ - default zone behaviour for the vsan
choices:
- - permit
- - deny
+ - permit
+ - deny
type: str
smart_zoning:
description:
- - Removes the vsan if True
+ - Removes the vsan if True
type: bool
zone:
description:
- - List of zone options for that vsan
+ - List of zone options for that vsan
type: list
elements: dict
suboptions:
name:
description:
- - name of the zone
+ - name of the zone
required: true
type: str
remove:
description:
- - Deletes the zone if True
+ - Deletes the zone if True
type: bool
default: false
members:
description:
- - Members of the zone that needs to be removed or added
+ - Members of the zone that needs to be removed or added
type: list
elements: dict
suboptions:
pwwn:
description:
- - pwwn member of the zone, use alias 'device_alias' as option for
- device_alias member
+ - >-
+ pwwn member of the zone, use alias 'device_alias' as option
+ for device_alias member
aliases:
- - device_alias
+ - device_alias
required: true
type: str
remove:
description:
- - Removes member from the zone if True
+ - Removes member from the zone if True
type: bool
default: false
devtype:
description:
- - devtype of the zone member used along with Smart zoning config
+ - >-
+ devtype of the zone member used along with Smart zoning
+ config
choices:
- - initiator
- - target
- - both
+ - initiator
+ - target
+ - both
type: str
zoneset:
description:
- - List of zoneset options for the vsan
+ - List of zoneset options for the vsan
type: list
elements: dict
suboptions:
name:
description:
- - name of the zoneset
+ - name of the zoneset
required: true
type: str
remove:
description:
- - Removes zoneset if True
+ - Removes zoneset if True
type: bool
default: false
action:
description:
- - activates/de-activates the zoneset
+ - activates/de-activates the zoneset
choices:
- - activate
- - deactivate
+ - activate
+ - deactivate
type: str
members:
description:
- - Members of the zoneset that needs to be removed or added
+ - Members of the zoneset that needs to be removed or added
type: list
elements: dict
suboptions:
name:
description:
- - name of the zone that needs to be added to the zoneset or removed
- from the zoneset
+ - >-
+ name of the zone that needs to be added to the zoneset or
+ removed from the zoneset
required: true
type: str
remove:
description:
- - Removes zone member from the zoneset
+ - Removes zone member from the zoneset
type: bool
default: false
+
"""
EXAMPLES = """
- name: Test that zone/zoneset module works
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- - mode: enhanced
- vsan: 22
- zone:
- - members:
- - pwwn: 11:11:11:11:11:11:11:11
- - device_alias: test123
- - pwwn: 61:61:62:62:12:12:12:12
- remove: true
- name: zoneA
- - members:
- - pwwn: 10:11:11:11:11:11:11:11
- - pwwn: 62:62:62:62:21:21:21:21
- name: zoneB
- - name: zoneC
- remove: true
- zoneset:
- - action: activate
- members:
- - name: zoneA
- - name: zoneB
- - name: zoneC
- remove: true
- name: zsetname1
- - action: deactivate
- name: zsetTestExtra
- remove: true
- - mode: basic
- smart_zoning: true
- vsan: 21
- zone:
- - members:
- - devtype: both
- pwwn: 11:11:11:11:11:11:11:11
- - pwwn: 62:62:62:62:12:12:12:12
- - devtype: both
- pwwn: 92:62:62:62:12:12:1a:1a
- remove: true
- name: zone21A
- - members:
- - pwwn: 10:11:11:11:11:11:11:11
- - pwwn: 62:62:62:62:21:21:21:21
- name: zone21B
- zoneset:
- - action: activate
- members:
- - name: zone21A
- - name: zone21B
- name: zsetname212
-
+ - mode: enhanced
+ vsan: 22
+ zone:
+ - members:
+ - pwwn: 31314874576271
+ - device_alias: test123
+ - pwwn: '61:61:62:62:12:12:12:12'
+ remove: true
+ name: zoneA
+ - members:
+ - pwwn: 28515514576271
+ - pwwn: '62:62:62:62:21:21:21:21'
+ name: zoneB
+ - name: zoneC
+ remove: true
+ zoneset:
+ - action: activate
+ members:
+ - name: zoneA
+ - name: zoneB
+ - name: zoneC
+ remove: true
+ name: zsetname1
+ - action: deactivate
+ name: zsetTestExtra
+ remove: true
+ - mode: basic
+ smart_zoning: true
+ vsan: 21
+ zone:
+ - members:
+ - devtype: both
+ pwwn: 31314874576271
+ - pwwn: '62:62:62:62:12:12:12:12'
+ - devtype: both
+ pwwn: '92:62:62:62:12:12:1a:1a'
+ remove: true
+ name: zone21A
+ - members:
+ - pwwn: 28515514576271
+ - pwwn: '62:62:62:62:21:21:21:21'
+ name: zone21B
+ zoneset:
+ - action: activate
+ members:
+ - name: zone21A
+ - name: zone21B
+ name: zsetname212
"""
RETURN = """
@@ -472,7 +476,11 @@ def main():
)
argument_spec = dict(
- zone_zoneset_details=dict(type="list", elements="dict", options=zonedetails_spec),
+ zone_zoneset_details=dict(
+ type="list",
+ elements="dict",
+ options=zonedetails_spec,
+ ),
)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
@@ -519,13 +527,17 @@ def main():
if op_default_zone is not None:
if op_default_zone != sw_default_zone:
if op_default_zone == "permit":
- commands_executed.append("zone default-zone permit vsan " + str(vsan))
+ commands_executed.append(
+ "zone default-zone permit vsan " + str(vsan),
+ )
messages.append(
"default zone configuration changed from deny to permit for vsan "
+ str(vsan),
)
else:
- commands_executed.append("no zone default-zone permit vsan " + str(vsan))
+ commands_executed.append(
+ "no zone default-zone permit vsan " + str(vsan),
+ )
messages.append(
"default zone configuration changed from permit to deny for vsan "
+ str(vsan),
@@ -565,10 +577,14 @@ def main():
if op_smart_zoning is not None:
if op_smart_zoning != sw_smart_zoning_bool:
if op_smart_zoning:
- commands_executed.append("zone smart-zoning enable vsan " + str(vsan))
+ commands_executed.append(
+ "zone smart-zoning enable vsan " + str(vsan),
+ )
messages.append("smart-zoning enabled for vsan " + str(vsan))
else:
- commands_executed.append("no zone smart-zoning enable vsan " + str(vsan))
+ commands_executed.append(
+ "no zone smart-zoning enable vsan " + str(vsan),
+ )
messages.append("smart-zoning disabled for vsan " + str(vsan))
else:
messages.append(
@@ -589,8 +605,12 @@ def main():
removeflag = eachzone["remove"]
if removeflag:
if shZoneObj.isZonePresent(zname):
- messages.append("zone '" + zname + "' is removed from vsan " + str(vsan))
- commands_executed.append("no zone name " + zname + " vsan " + str(vsan))
+ messages.append(
+ "zone '" + zname + "' is removed from vsan " + str(vsan),
+ )
+ commands_executed.append(
+ "no zone name " + zname + " vsan " + str(vsan),
+ )
else:
messages.append(
"zone '"
@@ -606,8 +626,12 @@ def main():
"zone '" + zname + "' is already present in vsan " + str(vsan),
)
else:
- commands_executed.append("zone name " + zname + " vsan " + str(vsan))
- messages.append("zone '" + zname + "' is created in vsan " + str(vsan))
+ commands_executed.append(
+ "zone name " + zname + " vsan " + str(vsan),
+ )
+ messages.append(
+ "zone '" + zname + "' is created in vsan " + str(vsan),
+ )
else:
cmdmemlist = []
for eachmem in zmembers:
@@ -721,7 +745,9 @@ def main():
+ str(vsan),
)
if len(cmdmemlist) != 0:
- commands_executed.append("zone name " + zname + " vsan " + str(vsan))
+ commands_executed.append(
+ "zone name " + zname + " vsan " + str(vsan),
+ )
commands_executed = commands_executed + cmdmemlist
# Process zoneset member options
@@ -758,7 +784,10 @@ def main():
zsetmem_name = eachzsmem["name"]
zsetmem_removeflag = eachzsmem["remove"]
if zsetmem_removeflag:
- if shZonesetObj.isZonePresentInZoneset(zsetname, zsetmem_name):
+ if shZonesetObj.isZonePresentInZoneset(
+ zsetname,
+ zsetmem_name,
+ ):
cmd = "no member " + zsetmem_name
cmdmemlist.append(cmd)
messages.append(
@@ -780,7 +809,10 @@ def main():
+ " ,hence there is nothing to remove",
)
else:
- if shZonesetObj.isZonePresentInZoneset(zsetname, zsetmem_name):
+ if shZonesetObj.isZonePresentInZoneset(
+ zsetname,
+ zsetmem_name,
+ ):
messages.append(
"zoneset member '"
+ zsetmem_name
@@ -844,7 +876,9 @@ def main():
messages.append(
"activating zoneset '" + zsetname + "' in vsan " + str(vsan),
)
- actcmd.append("zoneset activate name " + zsetname + " vsan " + str(vsan))
+ actcmd.append(
+ "zoneset activate name " + zsetname + " vsan " + str(vsan),
+ )
else:
messages.append(
"no changes to existing zoneset '"