mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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
This commit is contained in:
parent
bf184b1a92
commit
c0c26f83a8
23 changed files with 352 additions and 162 deletions
|
@ -276,8 +276,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
|
||||
|
|
|
@ -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 = '''
|
||||
|
|
|
@ -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 = '''
|
||||
|
|
|
@ -60,24 +60,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 }}
|
||||
'''
|
||||
- name: Default igmp global params (all params except restart)
|
||||
nxos_igmp:
|
||||
state: default
|
||||
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: 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 = '''
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -123,7 +123,7 @@ EXAMPLES = '''
|
|||
interface: ethernet1/32
|
||||
ospf: 1
|
||||
area: 1
|
||||
cost=default
|
||||
cost: default
|
||||
username: "{{ un }}"
|
||||
password: "{{ pwd }}"
|
||||
host: "{{ inventory_hostname }}"
|
||||
|
|
|
@ -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 = '''
|
||||
|
|
|
@ -48,10 +48,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
|
||||
|
|
|
@ -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 = '''
|
||||
|
|
|
@ -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 = '''
|
||||
|
|
|
@ -76,10 +76,12 @@ options:
|
|||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# ensure ntc VRF exists on switch
|
||||
- nxos_vrf: vrf=ntc host=68.170.147.165
|
||||
# ensure ntc VRF does not exist on switch
|
||||
- nxos_vrf: vrf=ntc host=68.170.147.165 state=absent
|
||||
- name: Ensure ntc VRF exists on switch
|
||||
nxos_vrf:
|
||||
vrf: ntc
|
||||
username: "{{ un }}"
|
||||
password: "{{ pwd }}"
|
||||
host: "{{ inventory_hostname }}"
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -50,10 +50,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 = '''
|
||||
|
|
|
@ -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 = '''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue