mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 01:45:25 -07:00
Examples syntax batch6 (#5623)
* Change example syntax on os_auth module * Change example syntax on os_client_config module * Change example syntax on os_image_facts module * Change example syntax on os_networks_facts module * Change example syntax on os_nova_flavor module * Change example syntax on os_object module * Change example syntax on os_server module * Change example syntax on os_subnet_facts module * Change example syntax on rax_files module * Change example syntax on rax_files_objects module * Change example syntax on mysql_db module * Change example syntax on file module * Change example syntax on uri module * Change example syntax on cl_bond module * Change example syntax on cl_bridge module * Change example syntax on cl_img_install module * Change example syntax on cl_interface module * Change example syntax on cl_license module * Change example syntax on cl_ports module * Remove trailing colon
This commit is contained in:
parent
4c3f8cbd92
commit
895179929c
19 changed files with 456 additions and 318 deletions
|
@ -152,20 +152,24 @@ author: "Romeo Theriault (@romeotheriault)"
|
|||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Check that you can connect (GET) to a page and it returns a status 200
|
||||
- uri: url=http://www.example.com
|
||||
- name: Check that you can connect (GET) to a page and it returns a status 200
|
||||
uri:
|
||||
url: 'http://www.example.com'
|
||||
|
||||
# Check that a page returns a status 200 and fail if the word AWESOME is not
|
||||
# in the page contents.
|
||||
- action: uri url=http://www.example.com return_content=yes
|
||||
- uri:
|
||||
url: http://www.example.com
|
||||
return_content: yes
|
||||
register: webpage
|
||||
|
||||
- action: fail
|
||||
- name: Fail if AWESOME is not in the page content
|
||||
fail:
|
||||
when: "'AWESOME' not in webpage.content"
|
||||
|
||||
|
||||
# Create a JIRA issue
|
||||
- uri:
|
||||
- name: Create a JIRA issue
|
||||
uri:
|
||||
url: https://your.jira.example.com/rest/api/2/issue/
|
||||
method: POST
|
||||
user: your_username
|
||||
|
@ -192,8 +196,8 @@ EXAMPLES = '''
|
|||
return_content: yes
|
||||
HEADER_Cookie: "{{login.set_cookie}}"
|
||||
|
||||
# Queue build of a project in Jenkins:
|
||||
- uri:
|
||||
- name: Queue build of a project in Jenkins
|
||||
uri:
|
||||
url: "http://{{ jenkins.host }}/job/{{ jenkins.job }}/build?token={{ jenkins.token }}"
|
||||
method: GET
|
||||
user: "{{ jenkins.user }}"
|
||||
|
|
|
@ -146,33 +146,39 @@ notes:
|
|||
EXAMPLES = '''
|
||||
# Options ['virtual_mac', 'virtual_ip'] are required together
|
||||
# configure a bond interface with IP address
|
||||
cl_bond: name=bond0 slaves="swp4-5" ipv4=10.1.1.1/24
|
||||
notify: reload networking
|
||||
- cl_bond:
|
||||
name: bond0
|
||||
slaves: "swp4-5"
|
||||
ipv4: 10.1.1.1/24
|
||||
notify: reload networking
|
||||
|
||||
# configure bond as a dual-connected clag bond
|
||||
cl_bond: name=bond1 slaves="swp1s0 swp2s0" clag_id=1
|
||||
notify: reload networking
|
||||
- cl_bond:
|
||||
name: bond1
|
||||
slaves: "swp1s0 swp2s0"
|
||||
clag_id: 1
|
||||
notify: reload networking
|
||||
|
||||
# define cl_bond once in tasks file
|
||||
# then write interface config in variables file
|
||||
# with just the options you want.
|
||||
cl_bond:
|
||||
name: "{{ item.key }}"
|
||||
slaves: "{{ item.value.slaves }}"
|
||||
clag_id: "{{ item.value.clag_id|default(omit) }}"
|
||||
ipv4: "{{ item.value.ipv4|default(omit) }}"
|
||||
ipv6: "{{ item.value.ipv6|default(omit) }}"
|
||||
alias_name: "{{ item.value.alias_name|default(omit) }}"
|
||||
addr_method: "{{ item.value.addr_method|default(omit) }}"
|
||||
mtu: "{{ item.value.mtu|default(omit) }}"
|
||||
vids: "{{ item.value.vids|default(omit) }}"
|
||||
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
|
||||
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
|
||||
mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}"
|
||||
mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}"
|
||||
mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}"
|
||||
with_dict: "{{ cl_bonds }}"
|
||||
notify: reload networking
|
||||
- cl_bond:
|
||||
name: "{{ item.key }}"
|
||||
slaves: "{{ item.value.slaves }}"
|
||||
clag_id: "{{ item.value.clag_id|default(omit) }}"
|
||||
ipv4: "{{ item.value.ipv4|default(omit) }}"
|
||||
ipv6: "{{ item.value.ipv6|default(omit) }}"
|
||||
alias_name: "{{ item.value.alias_name|default(omit) }}"
|
||||
addr_method: "{{ item.value.addr_method|default(omit) }}"
|
||||
mtu: "{{ item.value.mtu|default(omit) }}"
|
||||
vids: "{{ item.value.vids|default(omit) }}"
|
||||
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
|
||||
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
|
||||
mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}"
|
||||
mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}"
|
||||
mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}"
|
||||
with_dict: "{{ cl_bonds }}"
|
||||
notify: reload networking
|
||||
|
||||
# In vars file
|
||||
# ============
|
||||
|
|
|
@ -101,40 +101,47 @@ notes:
|
|||
EXAMPLES = '''
|
||||
# Options ['virtual_mac', 'virtual_ip'] are required together
|
||||
# configure a bridge vlan aware bridge.
|
||||
cl_bridge: name=br0 ports='swp1-12' vlan_aware='yes'
|
||||
notify: reload networking
|
||||
- cl_bridge:
|
||||
name: br0
|
||||
ports: 'swp1-12'
|
||||
vlan_aware: 'yes'
|
||||
notify: reload networking
|
||||
|
||||
# configure bridge interface to define a default set of vlans
|
||||
cl_bridge: name=bridge ports='swp1-12' vlan_aware='yes' vids='1-100'
|
||||
notify: reload networking
|
||||
- cl_bridge:
|
||||
name: bridge
|
||||
ports: 'swp1-12'
|
||||
vlan_aware: 'yes'
|
||||
vids: '1-100'
|
||||
notify: reload networking
|
||||
|
||||
# define cl_bridge once in tasks file
|
||||
# then write interface config in variables file
|
||||
# with just the options you want.
|
||||
cl_bridge:
|
||||
name: "{{ item.key }}"
|
||||
ports: "{{ item.value.ports }}"
|
||||
vlan_aware: "{{ item.value.vlan_aware|default(omit) }}"
|
||||
ipv4: "{{ item.value.ipv4|default(omit) }}"
|
||||
ipv6: "{{ item.value.ipv6|default(omit) }}"
|
||||
alias_name: "{{ item.value.alias_name|default(omit) }}"
|
||||
addr_method: "{{ item.value.addr_method|default(omit) }}"
|
||||
mtu: "{{ item.value.mtu|default(omit) }}"
|
||||
vids: "{{ item.value.vids|default(omit) }}"
|
||||
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
|
||||
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
|
||||
mstpctl_treeprio: "{{ item.value.mstpctl_treeprio|default(omit) }}"
|
||||
with_dict: "{{ cl_bridges }}"
|
||||
notify: reload networking
|
||||
- cl_bridge:
|
||||
name: "{{ item.key }}"
|
||||
ports: "{{ item.value.ports }}"
|
||||
vlan_aware: "{{ item.value.vlan_aware|default(omit) }}"
|
||||
ipv4: "{{ item.value.ipv4|default(omit) }}"
|
||||
ipv6: "{{ item.value.ipv6|default(omit) }}"
|
||||
alias_name: "{{ item.value.alias_name|default(omit) }}"
|
||||
addr_method: "{{ item.value.addr_method|default(omit) }}"
|
||||
mtu: "{{ item.value.mtu|default(omit) }}"
|
||||
vids: "{{ item.value.vids|default(omit) }}"
|
||||
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
|
||||
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
|
||||
mstpctl_treeprio: "{{ item.value.mstpctl_treeprio|default(omit) }}"
|
||||
with_dict: "{{ cl_bridges }}"
|
||||
notify: reload networking
|
||||
|
||||
# In vars file
|
||||
# ============
|
||||
cl_bridge:
|
||||
br0:
|
||||
alias_name: 'vlan aware bridge'
|
||||
ports: ['swp1', 'swp3']
|
||||
vlan_aware: true
|
||||
vids: ['1-100']
|
||||
br0:
|
||||
alias_name: 'vlan aware bridge'
|
||||
ports: ['swp1', 'swp3']
|
||||
vlan_aware: true
|
||||
vids: ['1-100']
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -59,32 +59,40 @@ Example playbook entries using the cl_img_install module
|
|||
|
||||
## Download and install the image from a webserver.
|
||||
|
||||
- name: install image using using http url. Switch slots so the subsequent
|
||||
will load the new version
|
||||
cl_img_install: version=2.0.1
|
||||
src='http://10.1.1.1/CumulusLinux-2.0.1.bin'
|
||||
switch_slot=yes
|
||||
- name: Install image using using http url. Switch slots so the subsequent will load the new version
|
||||
cl_img_install:
|
||||
version: 2.0.1
|
||||
src: 'http://10.1.1.1/CumulusLinux-2.0.1.bin'
|
||||
switch_slot: yes
|
||||
|
||||
## Copy the software from the ansible server to the switch.
|
||||
## The module will get the code version from the filename
|
||||
## The code will be installed in the alternate slot but the slot will not be primary
|
||||
## A subsequent reload will not run the new code
|
||||
|
||||
- name: download cumulus linux to local system
|
||||
get_url: src=ftp://cumuluslinux.bin dest=/root/CumulusLinux-2.0.1.bin
|
||||
- name: Download cumulus linux to local system
|
||||
get_url:
|
||||
src: 'ftp://cumuluslinux.bin'
|
||||
dest: /root/CumulusLinux-2.0.1.bin
|
||||
|
||||
- name: install image from local filesystem. Get version from the filename
|
||||
cl_img_install: src='/root/CumulusLinux-2.0.1.bin'
|
||||
- name: Install image from local filesystem. Get version from the filename.
|
||||
cl_img_install:
|
||||
src: /root/CumulusLinux-2.0.1.bin
|
||||
|
||||
|
||||
## If the image name has been changed from the original name, use the `version` option
|
||||
## to inform the module exactly what code version is been installed
|
||||
|
||||
- name: download cumulus linux to local system
|
||||
get_url: src=ftp://CumulusLinux-2.0.1.bin dest=/root/image.bin
|
||||
- name: Download cumulus linux to local system
|
||||
get_url:
|
||||
src: 'ftp://CumulusLinux-2.0.1.bin'
|
||||
dest: /root/image.bin
|
||||
|
||||
- name: install image and switch slots. only reboot needed
|
||||
cl_img_install: version=2.0.1 src=/root/image.bin switch_slot=yes'
|
||||
- name: install image and switch slots. only reboot needed
|
||||
cl_img_install:
|
||||
version: 2.0.1
|
||||
src: /root/image.bin
|
||||
switch_slot: yes
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -114,45 +114,55 @@ notes:
|
|||
|
||||
EXAMPLES = '''
|
||||
# Options ['virtual_mac', 'virtual_ip'] are required together
|
||||
# configure a front panel port with an IP
|
||||
cl_interface: name=swp1 ipv4=10.1.1.1/24
|
||||
notify: reload networking
|
||||
- name: Configure a front panel port with an IP
|
||||
cl_interface:
|
||||
name: swp1
|
||||
ipv4: 10.1.1.1/24
|
||||
notify: reload networking
|
||||
|
||||
# configure front panel to use DHCP
|
||||
cl_interface: name=swp2 addr_family=dhcp
|
||||
notify: reload networking
|
||||
- name: Configure front panel to use DHCP
|
||||
cl_interface:
|
||||
name: swp2
|
||||
addr_family: dhcp
|
||||
notify: reload networking
|
||||
|
||||
# configure a SVI for vlan 100 interface with an IP
|
||||
cl_interface: name=bridge.100 ipv4=10.1.1.1/24
|
||||
notify: reload networking
|
||||
- name: Configure a SVI for vlan 100 interface with an IP
|
||||
cl_interface:
|
||||
name: bridge.100
|
||||
ipv4: 10.1.1.1/24
|
||||
notify: reload networking
|
||||
|
||||
# configure subinterface with an IP
|
||||
cl_interface: name=bond0.100 alias_name='my bond' ipv4=10.1.1.1/24
|
||||
notify: reload networking
|
||||
- name: Configure subinterface with an IP
|
||||
cl_interface:
|
||||
name: bond0.100
|
||||
alias_name: 'my bond'
|
||||
ipv4: 10.1.1.1/24
|
||||
notify: reload networking
|
||||
|
||||
# define cl_interfaces once in tasks
|
||||
# then write interfaces in variables file
|
||||
# with just the options you want.
|
||||
cl_interface:
|
||||
name: "{{ item.key }}"
|
||||
ipv4: "{{ item.value.ipv4|default(omit) }}"
|
||||
ipv6: "{{ item.value.ipv6|default(omit) }}"
|
||||
alias_name: "{{ item.value.alias_name|default(omit) }}"
|
||||
addr_method: "{{ item.value.addr_method|default(omit) }}"
|
||||
speed: "{{ item.value.link_speed|default(omit) }}"
|
||||
mtu: "{{ item.value.mtu|default(omit) }}"
|
||||
clagd_enable: "{{ item.value.clagd_enable|default(omit) }}"
|
||||
clagd_peer_ip: "{{ item.value.clagd_peer_ip|default(omit) }}"
|
||||
clagd_sys_mac: "{{ item.value.clagd_sys_mac|default(omit) }}"
|
||||
clagd_priority: "{{ item.value.clagd_priority|default(omit) }}"
|
||||
vids: "{{ item.value.vids|default(omit) }}"
|
||||
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
|
||||
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
|
||||
mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}"
|
||||
mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}"
|
||||
mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}"
|
||||
with_dict: "{{ cl_interfaces }}"
|
||||
notify: reload networking
|
||||
- name: Create interfaces
|
||||
cl_interface:
|
||||
name: "{{ item.key }}"
|
||||
ipv4: "{{ item.value.ipv4 | default(omit) }}"
|
||||
ipv6: "{{ item.value.ipv6 | default(omit) }}"
|
||||
alias_name: "{{ item.value.alias_name | default(omit) }}"
|
||||
addr_method: "{{ item.value.addr_method | default(omit) }}"
|
||||
speed: "{{ item.value.link_speed | default(omit) }}"
|
||||
mtu: "{{ item.value.mtu | default(omit) }}"
|
||||
clagd_enable: "{{ item.value.clagd_enable | default(omit) }}"
|
||||
clagd_peer_ip: "{{ item.value.clagd_peer_ip | default(omit) }}"
|
||||
clagd_sys_mac: "{{ item.value.clagd_sys_mac | default(omit) }}"
|
||||
clagd_priority: "{{ item.value.clagd_priority | default(omit) }}"
|
||||
vids: "{{ item.value.vids | default(omit) }}"
|
||||
virtual_ip: "{{ item.value.virtual_ip | default(omit) }}"
|
||||
virtual_mac: "{{ item.value.virtual_mac | default(omit) }}"
|
||||
mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork | default('no') }}"
|
||||
mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge | default('no') }}"
|
||||
mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard | default('no') }}"
|
||||
with_dict: "{{ cl_interfaces }}"
|
||||
notify: reload networking
|
||||
|
||||
|
||||
# In vars file
|
||||
|
|
|
@ -55,33 +55,37 @@ options:
|
|||
|
||||
'''
|
||||
EXAMPLES = '''
|
||||
Example playbook using the cl_license module to manage licenses on Cumulus Linux
|
||||
# Example playbook using the cl_license module to manage licenses on Cumulus Linux
|
||||
|
||||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: install license using http url
|
||||
cl_license: src='http://10.1.1.1/license.txt'
|
||||
notify: restart switchd
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: install license using http url
|
||||
cl_license:
|
||||
src: 'http://10.1.1.1/license.txt'
|
||||
notify: restart switchd
|
||||
|
||||
- name: Triggers switchd to be restarted right away, before play, or role
|
||||
is over. This is desired behaviour
|
||||
meta: flush_handlers
|
||||
- name: Triggers switchd to be restarted right away, before play, or role
|
||||
is over. This is desired behaviour
|
||||
meta: flush_handlers
|
||||
|
||||
- name: configure interfaces
|
||||
template: src=interfaces.j2 dest=/etc/network/interfaces
|
||||
notify: restart networking
|
||||
- name: Configure interfaces
|
||||
template:
|
||||
src: interfaces.j2
|
||||
dest: /etc/network/interfaces
|
||||
notify: restart networking
|
||||
|
||||
handlers:
|
||||
- name: restart switchd
|
||||
service: name=switchd state=restarted
|
||||
- name: restart networking
|
||||
service: name=networking state=reloaded
|
||||
|
||||
----
|
||||
handlers:
|
||||
- name: restart switchd
|
||||
service:
|
||||
name: switchd
|
||||
state: restarted
|
||||
- name: restart networking
|
||||
service:
|
||||
name: networking
|
||||
state: reloaded
|
||||
|
||||
# Force all switches to accept a new license. Typically not needed
|
||||
ansible -m cl_license -a "src='http://10.1.1.1/new_lic' force=yes" -u root all
|
||||
ansible -m cl_license -a "src='http://10.1.1.1/new_lic' force=yes" -u root all
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -48,7 +48,9 @@ attributes defined in the ports.conf file on Cumulus Linux
|
|||
|
||||
## Unganged port config using simple args
|
||||
- name: configure ports.conf setup
|
||||
cl_ports: speed_4_by_10g="swp1, swp32" speed_40g="swp2-31"
|
||||
cl_ports:
|
||||
speed_4_by_10g: "swp1, swp32"
|
||||
speed_40g: "swp2-31"
|
||||
notify: restart switchd
|
||||
|
||||
## Unganged port configuration on certain ports using complex args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue