diff options
author | Sam Doran <sdoran@ansible.com> | 2016-11-22 11:07:21 -0500 |
---|---|---|
committer | John R Barker <john@johnrbarker.com> | 2016-11-22 16:07:21 +0000 |
commit | 99de7f02cd10dab087842246d6c038720942337e (patch) | |
tree | 0b26196e50e3c4b65621acfcb159cb1a6ece549f /network/nxos | |
parent | bb901bbfcc8edaa9a2da3a17d661658845e18762 (diff) | |
download | ansible-modules-core-99de7f02cd10dab087842246d6c038720942337e.tar.gz |
Examples syntax batch7 (#5624)
* Change example syntax on nxos_feature module
* Change example syntax on nxos_hsrp module
* Change example syntax on nxos_igmp module
* Change example syntax on nxos_interface module
* Change example syntax on nxos_interface_ospf module
* Change example syntax on nxos_ip_interface module
* Change example syntax on nxos_ping module
* Change example syntax on nxos_switchport module
* Change example syntax on nxos_vlan module
* Change example syntax on nxos_vrf module
* Change example syntax on nxos_vrf_interface module
* Change example syntax on nxos_vrrp module
* Change example syntax on meta module
* Change example syntax on set_fact module
* Change example syntax on win_copy module
* Change example syntax on win_file module
* Change example syntax on win_get_url module
Remove escaping of \ characeter in Windows paths since it's no longer required for single quoted or unquoted values when using multi-line YAML syntax.
* Change example syntax on win_lineinfile module
* Change example syntax on win_msi module
* Change example syntax on win_stat module
* Remove nxos_bgp example from nxos_igmp module
* Mark examples as regexp to avoid syntax error
* Cleanup win_copy.py examples
* Cleanup win_file.py examples
* Remove quotes in win_get_url.py examples
* Cleanup quotes and languare in win_lineinfile.py
* Cleanup examples in win_group.py
* Cleanup examples in win_service.py
* Don't use : in documentation because it breaks the YAML syntax check
* Cleanup win_copy.py examples
* Cleanup win_copy.py examples
* Minor change to fix test failure
* Use single quotes
Diffstat (limited to 'network/nxos')
-rw-r--r-- | network/nxos/nxos_bgp.py | 4 | ||||
-rw-r--r-- | network/nxos/nxos_feature.py | 24 | ||||
-rw-r--r-- | network/nxos/nxos_hsrp.py | 33 | ||||
-rw-r--r-- | network/nxos/nxos_igmp.py | 33 | ||||
-rw-r--r-- | network/nxos/nxos_interface.py | 48 | ||||
-rw-r--r-- | network/nxos/nxos_interface_ospf.py | 2 | ||||
-rw-r--r-- | network/nxos/nxos_ip_interface.py | 21 | ||||
-rw-r--r-- | network/nxos/nxos_ping.py | 15 | ||||
-rw-r--r-- | network/nxos/nxos_switchport.py | 46 | ||||
-rw-r--r-- | network/nxos/nxos_vlan.py | 37 | ||||
-rw-r--r-- | network/nxos/nxos_vrf.py | 8 | ||||
-rw-r--r-- | network/nxos/nxos_vrf_interface.py | 17 | ||||
-rw-r--r-- | network/nxos/nxos_vrrp.py | 31 |
13 files changed, 234 insertions, 85 deletions
diff --git a/network/nxos/nxos_bgp.py b/network/nxos/nxos_bgp.py index c937fb8d..18ca8402 100644 --- a/network/nxos/nxos_bgp.py +++ b/network/nxos/nxos_bgp.py @@ -286,8 +286,8 @@ options: EXAMPLES = ''' -# configure a simple asn -- nxos_bgp: +- name: Configure a simple ASN + nxos_bgp: asn: 65535 vrf: test router_id: 1.1.1.1 diff --git a/network/nxos/nxos_feature.py b/network/nxos/nxos_feature.py index bdf7980b..a00c71a4 100644 --- a/network/nxos/nxos_feature.py +++ b/network/nxos/nxos_feature.py @@ -41,12 +41,24 @@ options: ''' EXAMPLES = ''' -# Ensure lacp is enabled -- nxos_feature: feature=lacp state=enabled host={{ inventory_hostname }} -# Ensure ospf is disabled -- nxos_feature: feature=ospf state=disabled host={{ inventory_hostname }} -# Ensure vpc is enabled -- nxos_feature: feature=vpc state=enabled host={{ inventory_hostname }} +- name: Ensure lacp is enabled + nxos_feature: + feature: lacp + state: enabled + host: "{{ inventory_hostname }}" + +- name: Ensure ospf is disabled + nxos_feature: + feature: ospf + state: disabled + host: "{{ inventory_hostname }}" + +- name: Ensure vpc is enabled + nxos_feature: + feature: vpc + state: enabled + host: "{{ inventory_hostname }}" + ''' RETURN = ''' diff --git a/network/nxos/nxos_hsrp.py b/network/nxos/nxos_hsrp.py index d21fcaa6..ec6e5893 100644 --- a/network/nxos/nxos_hsrp.py +++ b/network/nxos/nxos_hsrp.py @@ -81,12 +81,33 @@ options: ''' EXAMPLES = ''' -# ensure hsrp is configured with following params on a SVI -- nxos_hsrp: group=10 vip=10.1.1.1 priority=150 interface=vlan10 preempt=enabled host=68.170.147.165 -# ensure hsrp is configured with following params on a SVI -- nxos_hsrp: group=10 vip=10.1.1.1 priority=150 interface=vlan10 preempt=enabled host=68.170.147.165 auth_type=text auth_string=CISCO -# removing hsrp config for given interface, group, and vip -- nxos_hsrp: group=10 interface=vlan10 vip=10.1.1.1 host=68.170.147.165 state=absent +- name: Ensure HSRP is configured with following params on a SVI + nxos_hsrp: + group: 10 + vip: 10.1.1.1 + priority: 150 + interface: vlan10 + preempt: enabled + host: 68.170.147.165 + +- name: Ensure HSRP is configured with following params on a SVI + nxos_hsrp: + group: 10 + vip: 10.1.1.1 + priority: 150 + interface: vlan10 + preempt: enabled + host: 68.170.147.165 + auth_type: text + auth_string: CISCO + +- name: Remove HSRP config for given interface, group, and VIP + nxos_hsrp: + group: 10 + interface: vlan10 + vip: 10.1.1.1 + host: 68.170.147.165 + state: absent ''' RETURN = ''' diff --git a/network/nxos/nxos_igmp.py b/network/nxos/nxos_igmp.py index 05827a34..d1ac322c 100644 --- a/network/nxos/nxos_igmp.py +++ b/network/nxos/nxos_igmp.py @@ -61,24 +61,21 @@ options: choices: ['present', 'default'] ''' EXAMPLES = ''' -# default igmp global params (all params except restart) -- nxos_igmp: state=default host={{ inventory_hostname }} -# ensure the following igmp global config exists on the device -- nxos_igmp: flush_routes=true enforce_rtr_alert=true host={{ inventory_hostname }} -# restart the igmp process -- nxos_igmp: restart=true host={{ inventory_hostname }} -''' - -EXAMPLES = ''' -# configure a simple asn -- nxos_bgp: - asn=65535 - vrf=test - router_id=1.1.1.1 - state=present - username: "{{ un }}" - password: "{{ pwd }}" - host: "{{ inventory_hostname }}" +- name: Default igmp global params (all params except restart) + nxos_igmp: + state: default + host: "{{ inventory_hostname }}" + +- name: Ensure the following igmp global config exists on the device + nxos_igmp: + flush_routes: true + enforce_rtr_alert: true + host: "{{ inventory_hostname }}" + +- name: Restart the igmp process + nxos_igmp: + restart: true + host: "{{ inventory_hostname }}" ''' RETURN = ''' diff --git a/network/nxos/nxos_interface.py b/network/nxos/nxos_interface.py index 7c1186ee..ac1c773d 100644 --- a/network/nxos/nxos_interface.py +++ b/network/nxos/nxos_interface.py @@ -85,23 +85,47 @@ options: ''' EXAMPLES = ''' -# Ensure an interface is a Layer 3 port and that it has the proper description -- nxos_interface: interface=Ethernet1/1 description='Configured by Ansible' mode=layer3 host=68.170.147.165 -# Admin down an interface -- nxos_interface: interface=Ethernet2/1 host=68.170.147.165 admin_state=down -# Remove all loopback interfaces -- nxos_interface: interface=loopback state=absent host=68.170.147.165 -# Remove all logical interfaces -- nxos_interface: interface_type={{ item }} state=absent host={{ inventory_hostname }} +- name Ensure an interface is a Layer 3 port and that it has the proper description + nxos_interface: + interface: Ethernet1/1 + description: 'Configured by Ansible' + mode: layer3 + host: 68.170.147.165 + +- name Admin down an interface + nxos_interface: + interface: Ethernet2/1 + host: 68.170.147.165 + admin_state: down + +- name Remove all loopback interfaces + nxos_interface: + interface: loopback + state: absent + host: 68.170.147.165 + +- name Remove all logical interfaces + nxos_interface: + interface_type: "{{ item }} " + state: absent + host: "{{ inventory_hostname }}" + with_items: - loopback - portchannel - svi - nve -# Admin up all ethernet interfaces -- nxos_interface: interface=ethernet host=68.170.147.165 admin_state=up -# Admin down ALL interfaces (physical and logical) -- nxos_interface: interface=all host=68.170.147.165 admin_state=down +- name Admin up all ethernet interfaces + nxos_interface: + interface: ethernet + host: 68.170.147.165 + admin_state: up + +- name Admin down ALL interfaces (physical and logical) + nxos_interface: + interface: all + host: 68.170.147.165 + admin_state: down ''' RETURN = ''' proposed: diff --git a/network/nxos/nxos_interface_ospf.py b/network/nxos/nxos_interface_ospf.py index 5cf050e8..2e5a291d 100644 --- a/network/nxos/nxos_interface_ospf.py +++ b/network/nxos/nxos_interface_ospf.py @@ -118,7 +118,7 @@ EXAMPLES = ''' interface: ethernet1/32 ospf: 1 area: 1 - cost=default + cost: default username: "{{ un }}" password: "{{ pwd }}" host: "{{ inventory_hostname }}" diff --git a/network/nxos/nxos_ip_interface.py b/network/nxos/nxos_ip_interface.py index 25d50cbc..416ebadd 100644 --- a/network/nxos/nxos_ip_interface.py +++ b/network/nxos/nxos_ip_interface.py @@ -57,10 +57,23 @@ options: ''' EXAMPLES = ''' -# ensure ipv4 address is configured on Ethernet1/32 -- nxos_ip_interface: interface=Ethernet1/32 transport=nxapi version=v4 state=present addr=20.20.20.20 mask=24 -# ensure ipv6 address is configured on Ethernet1/31 -- nxos_ip_interface: interface=Ethernet1/31 transport=cli version=v6 state=present addr=2001::db8:800:200c:cccb mask=64 +- name: Ensure ipv4 address is configured on Ethernet1/32 + nxos_ip_interface: + interface: Ethernet1/32 + transport: nxapi + version: v4 + state: present + addr: 20.20.20.20 + mask: 24 + +- name: Ensure ipv6 address is configured on Ethernet1/31 + nxos_ip_interface: + interface: Ethernet1/31 + transport: cli + version: v6 + state: present + addr: '2001::db8:800:200c:cccb' + mask: 64 ''' RETURN = ''' diff --git a/network/nxos/nxos_ping.py b/network/nxos/nxos_ping.py index ea4ecb68..5764de8f 100644 --- a/network/nxos/nxos_ping.py +++ b/network/nxos/nxos_ping.py @@ -50,10 +50,17 @@ options: ''' EXAMPLES = ''' -# test reachability to 8.8.8.8 using mgmt vrf -- nxos_ping: dest=8.8.8.8 vrf=management host=68.170.147.165 -# Test reachability to a few different public IPs using mgmt vrf -- nxos_ping: dest=nxos_ping vrf=management host=68.170.147.165 +- name: Test reachability to 8.8.8.8 using mgmt vrf + nxos_ping: + dest: 8.8.8.8 + vrf: management + host: 68.170.147.165 + +- name: Test reachability to a few different public IPs using mgmt vrf + nxos_ping: + dest: nxos_ping + vrf: management + host: 68.170.147.165 with_items: - 8.8.8.8 - 4.4.4.4 diff --git a/network/nxos/nxos_switchport.py b/network/nxos/nxos_switchport.py index 387c7c7c..006a2dcd 100644 --- a/network/nxos/nxos_switchport.py +++ b/network/nxos/nxos_switchport.py @@ -79,16 +79,42 @@ options: default: null ''' EXAMPLES = ''' -# ENSURE Eth1/5 is in its default switchport state -- nxos_switchport: interface=eth1/5 state=unconfigured host={{ inventory_hostname }} -# ENSURE Eth1/5 is configured for access vlan 20 -- nxos_switchport: interface=eth1/5 mode=access access_vlan=20 host={{ inventory_hostname }} -# ENSURE Eth1/5 only has vlans 5-10 as trunk vlans -- nxos_switchport: interface=eth1/5 mode=trunk native_vlan=10 trunk_vlans=5-10 host={{ inventory_hostname }} -# Ensure eth1/5 is a trunk port and ensure 2-50 are being tagged (doesn't mean others aren't also being tagged) -- nxos_switchport: interface=eth1/5 mode=trunk native_vlan=10 trunk_vlans=2-50 host={{ inventory_hostname }} -# Ensure these VLANs are not being tagged on the trunk -- nxos_switchport: interface=eth1/5 mode=trunk trunk_vlans=51-4094 host={{ inventory_hostname }} state=absent +- name: Ensure Eth1/5 is in its default switchport state + nxos_switchport: + interface: eth1/5 + state: unconfigured + host: "{{ inventory_hostname }}" + +- name: Ensure Eth1/5 is configured for access vlan 20 + nxos_switchport: + interface: eth1/5 + mode: access + access_vlan: 20 + host: "{{ inventory_hostname }}" + +- name: Ensure Eth1/5 only has vlans 5-10 as trunk vlans + nxos_switchport: + interface: eth1/5 + mode: trunk + native_vlan: 10 + trunk_vlans: 5-10 + host: "{{ inventory_hostname }}" + +- name: Ensure eth1/5 is a trunk port and ensure 2-50 are being tagged (doesn't mean others aren't also being tagged) + nxos_switchport: + interface: eth1/5 + mode: trunk + native_vlan: 10 + trunk_vlans: 2-50 + host: "{{ inventory_hostname }}" + +- name: Ensure these VLANs are not being tagged on the trunk + nxos_switchport: + interface: eth1/5 + mode: trunk + trunk_vlans: 51-4094 + host: "{{ inventory_hostname }} " + state: absent ''' RETURN = ''' diff --git a/network/nxos/nxos_vlan.py b/network/nxos/nxos_vlan.py index cb06bd84..184d8b49 100644 --- a/network/nxos/nxos_vlan.py +++ b/network/nxos/nxos_vlan.py @@ -71,16 +71,33 @@ options: ''' EXAMPLES = ''' -# Ensure a range of VLANs are not present on the switch -- nxos_vlan: vlan_range="2-10,20,50,55-60,100-150" host=68.170.147.165 username=cisco password=cisco state=absent transport=nxapi - -# Ensure VLAN 50 exists with the name WEB and is in the shutdown state -- nxos_vlan: vlan_id=50 host=68.170.147.165 admin_state=down name=WEB transport=nxapi username=cisco password=cisco - -# Ensure VLAN is NOT on the device -- nxos_vlan: vlan_id=50 host=68.170.147.165 state=absent transport=nxapi username=cisco password=cisco - - +- name: Ensure a range of VLANs are not present on the switch + nxos_vlan: + vlan_range: "2-10,20,50,55-60,100-150" + host: 68.170.147.165 + username: cisco + password: cisco + state: absent + transport: nxapi + +- name: Ensure VLAN 50 exists with the name WEB and is in the shutdown state + nxos_vlan: + vlan_id: 50 + host: 68.170.147.165 + admin_state: down + name: WEB + transport: nxapi + username: cisco + password: cisco + +- name: Ensure VLAN is NOT on the device + nxos_vlan: + vlan_id: 50 + host: 68.170.147.165 + state: absent + transport: nxapi + username: cisco + password: cisco ''' RETURN = ''' diff --git a/network/nxos/nxos_vrf.py b/network/nxos/nxos_vrf.py index 8c8c2c17..8dde538f 100644 --- a/network/nxos/nxos_vrf.py +++ b/network/nxos/nxos_vrf.py @@ -76,8 +76,12 @@ options: ''' EXAMPLES = ''' -# ensure ntc VRF exists on switch -- nxos_vrf: vrf=ntc username="{{ un }}" password="{{ pwd }}" host="{{ inventory_hostname }}" +- name: Ensure ntc VRF exists on switch + nxos_vrf: + vrf: ntc + username: "{{ un }}" + password: "{{ pwd }}" + host: "{{ inventory_hostname }}" ''' RETURN = ''' diff --git a/network/nxos/nxos_vrf_interface.py b/network/nxos/nxos_vrf_interface.py index fe80c0f8..cd3c5704 100644 --- a/network/nxos/nxos_vrf_interface.py +++ b/network/nxos/nxos_vrf_interface.py @@ -52,10 +52,19 @@ options: ''' EXAMPLES = ''' -# ensure vrf ntc exists on Eth1/1 -- nxos_vrf_interface: vrf=ntc interface=Ethernet1/1 host=68.170.147.165 state=present -# ensure ntc VRF does not exist on Eth1/1 -- nxos_vrf_interface: vrf=ntc interface=Ethernet1/1 host=68.170.147.165 state=absent +- name: Ensure vrf ntc exists on Eth1/1 + nxos_vrf_interface: + vrf: ntc + interface: Ethernet1/1 + host: 68.170.147.165 + state: present + +- name: Ensure ntc VRF does not exist on Eth1/1 + nxos_vrf_interface: + vrf: ntc + interface: Ethernet1/1 + host: 68.170.147.165 + state: absent ''' RETURN = ''' diff --git a/network/nxos/nxos_vrrp.py b/network/nxos/nxos_vrrp.py index c389a90d..a034b0e2 100644 --- a/network/nxos/nxos_vrrp.py +++ b/network/nxos/nxos_vrrp.py @@ -74,12 +74,31 @@ options: ''' EXAMPLES = ''' -# ensure vrrp group 100 and vip 10.1.100.1 is on vlan10 -- nxos_vrrp: interface=vlan10 group=100 vip=10.1.100.1 host=68.170.147.165 -# ensure removal of the vrrp group config # vip is required to ensure the user knows what they are removing -- nxos_vrrp: interface=vlan10 group=100 vip=10.1.100.1 state=absent host=68.170.147.165 -# re-config with more params -- nxos_vrrp: interface=vlan10 group=100 vip=10.1.100.1 preempt=false priority=130 authentication=AUTHKEY host=68.170.147.165 +- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10 + nxos_vrrp: + interface: vlan10 + group: 100 + vip: 10.1.100.1 + host: 68.170.147.165 + +- name: Ensure removal of the vrrp group config + # vip is required to ensure the user knows what they are removing + nxos_vrrp: + interface: vlan10 + group: 100 + vip: 10.1.100.1 + state: absent + host: 68.170.147.165 + +- name: Re-config with more params + nxos_vrrp: + interface: vlan10 + group: 100 + vip: 10.1.100.1 + preempt: false + priority: 130 + authentication: AUTHKEY + host: 68.170.147.165 ''' RETURN = ''' |