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:
Sam Doran 2016-11-16 12:24:21 -05:00 committed by Matt Clay
parent 4c3f8cbd92
commit 895179929c
19 changed files with 456 additions and 318 deletions

View file

@ -34,10 +34,13 @@ extends_documentation_fragment: openstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Authenticate to the cloud and retreive the service catalog - name: Authenticate to the cloud and retrieve the service catalog
- os_auth: os_auth:
cloud: rax-dfw cloud: rax-dfw
- debug: var=service_catalog
- name: Show service catalog
debug:
var: service_catalog
''' '''
def main(): def main():

View file

@ -39,15 +39,17 @@ author: "Monty Taylor (@emonty)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Get list of clouds that do not support security groups - name: Get list of clouds that do not support security groups
- os_client_config: os_client_config:
- debug: var={{ item }}
with_items: "{{ openstack.clouds|rejectattr('secgroup_source', 'none')|list() }}"
# Get the information back just about the mordred cloud - debug:
- os_client_config: var: "{{ item }}"
with_items: "{{ openstack.clouds | rejectattr('secgroup_source', 'none') | list }}"
- name: Get the information back just about the mordred cloud
os_client_config:
clouds: clouds:
- mordred - mordred
''' '''

View file

@ -42,15 +42,18 @@ extends_documentation_fragment: openstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Gather facts about a previously created image named image1 - name: Gather facts about a previously created image named image1
- os_image_facts: os_image_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
image: image1 image: image1
- debug: var=openstack
- name: Show openstack facts
debug:
var: openstack
''' '''
RETURN = ''' RETURN = '''

View file

@ -46,30 +46,36 @@ extends_documentation_fragment: openstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Gather facts about previously created networks - name: Gather facts about previously created networks
- os_networks_facts: os_networks_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
- debug: var=openstack_networks
# Gather facts about a previously created network by name - name: Show openstack networks
- os_networks_facts: debug:
var: openstack_networks
- name: Gather facts about a previously created network by name
os_networks_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
name: network1 name: network1
- debug: var=openstack_networks
# Gather facts about a previously created network with filter (note: name and - name: Show openstack networks
filters parameters are Not mutually exclusive) debug:
- os_networks_facts: var: openstack_networks
- name: Gather facts about a previously created network with filter
# Note: name and filters parameters are Not mutually exclusive
os_networks_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
@ -78,7 +84,10 @@ EXAMPLES = '''
subnets: subnets:
- 057d4bdf-6d4d-4728-bb0f-5ac45a6f7400 - 057d4bdf-6d4d-4728-bb0f-5ac45a6f7400
- 443d4dc0-91d4-4998-b21c-357d10433483 - 443d4dc0-91d4-4998-b21c-357d10433483
- debug: var=openstack_networks
- name: Show openstack networks
debug:
var: openstack_networks
''' '''
RETURN = ''' RETURN = '''

View file

@ -88,22 +88,21 @@ requirements: ["shade"]
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of - name: "Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of local disk, and 10GB of ephemeral."
# local disk, and 10GB of ephemeral. os_nova_flavor:
- os_nova_flavor: cloud: mycloud
cloud=mycloud state: present
state=present name: tiny
name=tiny ram: 1024
ram=1024 vcpus: 1
vcpus=1 disk: 10
disk=10 ephemeral: 10
ephemeral=10
# Delete 'tiny' flavor - name: "Delete 'tiny' flavor"
- os_nova_flavor: os_nova_flavor:
cloud=mycloud cloud: mycloud
state=absent state: absent
name=tiny name: tiny
''' '''
RETURN = ''' RETURN = '''

View file

@ -60,11 +60,19 @@ requirements: ["shade"]
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Creates a object named 'fstab' in the 'config' container - name: "Create a object named 'fstab' in the 'config' container"
- os_object: cloud=mordred state=present name=fstab container=config filename=/etc/fstab os_object:
cloud: mordred
state: present
name: fstab
container: config
filename: /etc/fstab
# Deletes a container called config and all of its contents - name: Delete a container called config and all of its contents
- os_object: cloud=rax-iad state=absent container=config os_object:
cloud: rax-iad
state: absent
container: config
''' '''

View file

@ -205,12 +205,11 @@ requirements:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Creates a new instance and attaches to a network and passes metadata to - name: Create a new instance and attaches to a network and passes metadata to the instance
# the instance os_server:
- os_server:
state: present state: present
auth: auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
username: admin username: admin
password: admin password: admin
project_name: admin project_name: admin
@ -226,99 +225,98 @@ EXAMPLES = '''
hostname: test1 hostname: test1
group: uge_master group: uge_master
# Creates a new instance in HP Cloud AE1 region availability zone az2 and # Create a new instance in HP Cloud AE1 region availability zone az2 and
# automatically assigns a floating IP # automatically assigns a floating IP
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance - name: launch an instance
os_server: os_server:
state: present state: present
auth: auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
username: username username: username
password: Equality7-2521 password: Equality7-2521
project_name: username-project1 project_name: username-project1
name: vm1 name: vm1
region_name: region-b.geo-1 region_name: region-b.geo-1
availability_zone: az2 availability_zone: az2
image: 9302692b-b787-4b52-a3a6-daebb79cb498 image: 9302692b-b787-4b52-a3a6-daebb79cb498
key_name: test key_name: test
timeout: 200 timeout: 200
flavor: 101 flavor: 101
security_groups: default security_groups: default
auto_ip: yes auto_ip: yes
# Creates a new instance in named cloud mordred availability zone az2 # Create a new instance in named cloud mordred availability zone az2
# and assigns a pre-known floating IP # and assigns a pre-known floating IP
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance - name: launch an instance
os_server: os_server:
state: present state: present
cloud: mordred cloud: mordred
name: vm1 name: vm1
availability_zone: az2 availability_zone: az2
image: 9302692b-b787-4b52-a3a6-daebb79cb498 image: 9302692b-b787-4b52-a3a6-daebb79cb498
key_name: test key_name: test
timeout: 200 timeout: 200
flavor: 101 flavor: 101
floating_ips: floating_ips:
- 12.34.56.79 - 12.34.56.79
# Creates a new instance with 4G of RAM on Ubuntu Trusty, ignoring # Create a new instance with 4G of RAM on Ubuntu Trusty, ignoring
# deprecated images # deprecated images
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance - name: launch an instance
os_server: os_server:
name: vm1 name: vm1
state: present state: present
cloud: mordred cloud: mordred
region_name: region-b.geo-1 region_name: region-b.geo-1
image: Ubuntu Server 14.04 image: Ubuntu Server 14.04
image_exclude: deprecated image_exclude: deprecated
flavor_ram: 4096 flavor_ram: 4096
# Creates a new instance with 4G of RAM on Ubuntu Trusty on a Performance node # Create a new instance with 4G of RAM on Ubuntu Trusty on a Performance node
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance - name: launch an instance
os_server: os_server:
name: vm1 name: vm1
cloud: rax-dfw cloud: rax-dfw
state: present state: present
image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
flavor_ram: 4096 flavor_ram: 4096
flavor_include: Performance flavor_include: Performance
# Creates a new instance and attaches to multiple network # Creates a new instance and attaches to multiple network
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance with a string - name: launch an instance with a string
os_server: os_server:
auth: auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
username: admin username: admin
password: admin password: admin
project_name: admin project_name: admin
name: vm1 name: vm1
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529 image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
key_name: ansible_key key_name: ansible_key
timeout: 200 timeout: 200
flavor: 4 flavor: 4
nics: "net-id=4cb08b20-62fe-11e5-9d70-feff819cdc9f,net-id=542f0430-62fe-11e5-9d70-feff819cdc9f..." nics: "net-id=4cb08b20-62fe-11e5-9d70-feff819cdc9f,net-id=542f0430-62fe-11e5-9d70-feff819cdc9f..."
# Creates a new instance and attaches to a network and passes metadata to - name: Creates a new instance and attaches to a network and passes metadata to the instance
# the instance os_server:
- os_server:
state: present state: present
auth: auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
username: admin username: admin
password: admin password: admin
project_name: admin project_name: admin
@ -332,51 +330,51 @@ EXAMPLES = '''
- net-name: another_network - net-name: another_network
meta: "hostname=test1,group=uge_master" meta: "hostname=test1,group=uge_master"
# Creates a new instance and attaches to a specific network - name: Creates a new instance and attaches to a specific network
- os_server: os_server:
state: present state: present
auth: auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
username: admin username: admin
password: admin password: admin
project_name: admin project_name: admin
name: vm1 name: vm1
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529 image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
key_name: ansible_key key_name: ansible_key
timeout: 200 timeout: 200
flavor: 4 flavor: 4
network: another_network network: another_network
# Creates a new instance with 4G of RAM on a 75G Ubuntu Trusty volume # Create a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance - name: launch an instance
os_server: os_server:
name: vm1 name: vm1
state: present state: present
cloud: mordred cloud: mordred
region_name: ams01 region_name: ams01
image: Ubuntu Server 14.04 image: Ubuntu Server 14.04
flavor_ram: 4096 flavor_ram: 4096
boot_from_volume: True boot_from_volume: True
volume_size: 75 volume_size: 75
# Creates a new instance with 2 volumes attached # Creates a new instance with 2 volumes attached
- name: launch a compute instance - name: launch a compute instance
hosts: localhost hosts: localhost
tasks: tasks:
- name: launch an instance - name: launch an instance
os_server: os_server:
name: vm1 name: vm1
state: present state: present
cloud: mordred cloud: mordred
region_name: ams01 region_name: ams01
image: Ubuntu Server 14.04 image: Ubuntu Server 14.04
flavor_ram: 4096 flavor_ram: 4096
volumes: volumes:
- photos - photos
- music - music
''' '''

View file

@ -46,36 +46,45 @@ extends_documentation_fragment: openstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Gather facts about previously created subnets - name: Gather facts about previously created subnets
- os_subnets_facts: os_subnets_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
- debug: var=openstack_subnets
# Gather facts about a previously created subnet by name - name: Show openstack subnets
- os_subnets_facts: debug:
var: openstack_subnets
- name: Gather facts about a previously created subnet by name
os_subnets_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
name: subnet1 name: subnet1
- debug: var=openstack_subnets
# Gather facts about a previously created subnet with filter (note: name and - name: Show openstack subnets
filters parameters are Not mutually exclusive) debug:
- os_subnets_facts: var: openstack_subnets
- name: Gather facts about a previously created subnet with filter
# Note: name and filters parameters are not mutually exclusive
os_subnets_facts:
auth: auth:
auth_url: https://your_api_url.com:9000/v2.0 auth_url: 'https://your_api_url.com:9000/v2.0'
username: user username: user
password: password password: password
project_name: someproject project_name: someproject
filters: filters:
tenant_id: 55e2ce24b2a245b09f181bf025724cbe tenant_id: 55e2ce24b2a245b09f181bf025724cbe
- debug: var=openstack_subnets
- name: Show openstack subnets
debug:
var: openstack_subnets
''' '''
RETURN = ''' RETURN = '''

View file

@ -86,10 +86,12 @@ EXAMPLES = '''
gather_facts: no gather_facts: no
tasks: tasks:
- name: "List all containers" - name: "List all containers"
rax_files: state=list rax_files:
state: list
- name: "Create container called 'mycontainer'" - name: "Create container called 'mycontainer'"
rax_files: container=mycontainer rax_files:
container: mycontainer
- name: "Create container 'mycontainer2' with metadata" - name: "Create container 'mycontainer2' with metadata"
rax_files: rax_files:
@ -99,19 +101,30 @@ EXAMPLES = '''
file_for: someuser@example.com file_for: someuser@example.com
- name: "Set a container's web index page" - name: "Set a container's web index page"
rax_files: container=mycontainer web_index=index.html rax_files:
container: mycontainer
web_index: index.html
- name: "Set a container's web error page" - name: "Set a container's web error page"
rax_files: container=mycontainer web_error=error.html rax_files:
container: mycontainer
web_error: error.html
- name: "Make container public" - name: "Make container public"
rax_files: container=mycontainer public=yes rax_files:
container: mycontainer
public: yes
- name: "Make container public with a 24 hour TTL" - name: "Make container public with a 24 hour TTL"
rax_files: container=mycontainer public=yes ttl=86400 rax_files:
container: mycontainer
public: yes
ttl: 86400
- name: "Make container private" - name: "Make container private"
rax_files: container=mycontainer private=yes rax_files:
container: mycontainer
private: yes
- name: "Test Cloud Files Containers Metadata Storage" - name: "Test Cloud Files Containers Metadata Storage"
hosts: local hosts: local

View file

@ -102,28 +102,50 @@ EXAMPLES = '''
gather_facts: False gather_facts: False
tasks: tasks:
- name: "Get objects from test container" - name: "Get objects from test container"
rax_files_objects: container=testcont dest=~/Downloads/testcont rax_files_objects:
container: testcont
dest: ~/Downloads/testcont
- name: "Get single object from test container" - name: "Get single object from test container"
rax_files_objects: container=testcont src=file1 dest=~/Downloads/testcont rax_files_objects:
container: testcont
src: file1
dest: ~/Downloads/testcont
- name: "Get several objects from test container" - name: "Get several objects from test container"
rax_files_objects: container=testcont src=file1,file2,file3 dest=~/Downloads/testcont rax_files_objects:
container: testcont
src: file1,file2,file3
dest: ~/Downloads/testcont
- name: "Delete one object in test container" - name: "Delete one object in test container"
rax_files_objects: container=testcont method=delete dest=file1 rax_files_objects:
container: testcont
method: delete
dest: file1
- name: "Delete several objects in test container" - name: "Delete several objects in test container"
rax_files_objects: container=testcont method=delete dest=file2,file3,file4 rax_files_objects:
container: testcont
method: delete
dest: file2,file3,file4
- name: "Delete all objects in test container" - name: "Delete all objects in test container"
rax_files_objects: container=testcont method=delete rax_files_objects:
container: testcont
method: delete
- name: "Upload all files to test container" - name: "Upload all files to test container"
rax_files_objects: container=testcont method=put src=~/Downloads/onehundred rax_files_objects:
container: testcont
method: put
src: ~/Downloads/onehundred
- name: "Upload one file to test container" - name: "Upload one file to test container"
rax_files_objects: container=testcont method=put src=~/Downloads/testcont/file1 rax_files_objects:
container: testcont
method: put
src: ~/Downloads/testcont/file1
- name: "Upload one file to test container with metadata" - name: "Upload one file to test container with metadata"
rax_files_objects: rax_files_objects:
@ -135,14 +157,25 @@ EXAMPLES = '''
who_uploaded_this: someuser@example.com who_uploaded_this: someuser@example.com
- name: "Upload one file to test container with TTL of 60 seconds" - name: "Upload one file to test container with TTL of 60 seconds"
rax_files_objects: container=testcont method=put src=~/Downloads/testcont/file3 expires=60 rax_files_objects:
container: testcont
method: put
src: ~/Downloads/testcont/file3
expires: 60
- name: "Attempt to get remote object that does not exist" - name: "Attempt to get remote object that does not exist"
rax_files_objects: container=testcont method=get src=FileThatDoesNotExist.jpg dest=~/Downloads/testcont rax_files_objects:
container: testcont
method: get
src: FileThatDoesNotExist.jpg
dest: ~/Downloads/testcont
ignore_errors: yes ignore_errors: yes
- name: "Attempt to delete remote object that does not exist" - name: "Attempt to delete remote object that does not exist"
rax_files_objects: container=testcont method=delete dest=FileThatDoesNotExist.jpg rax_files_objects:
container: testcont
method: delete
dest: FileThatDoesNotExist.jpg
ignore_errors: yes ignore_errors: yes
- name: "Test Cloud Files Objects Metadata" - name: "Test Cloud Files Objects Metadata"
@ -150,10 +183,16 @@ EXAMPLES = '''
gather_facts: false gather_facts: false
tasks: tasks:
- name: "Get metadata on one object" - name: "Get metadata on one object"
rax_files_objects: container=testcont type=meta dest=file2 rax_files_objects:
container: testcont
type: meta
dest: file2
- name: "Get metadata on several objects" - name: "Get metadata on several objects"
rax_files_objects: container=testcont type=meta src=file2,file1 rax_files_objects:
container: testcont
type: meta
src: file2,file1
- name: "Set metadata on an object" - name: "Set metadata on an object"
rax_files_objects: rax_files_objects:
@ -167,7 +206,10 @@ EXAMPLES = '''
clear_meta: true clear_meta: true
- name: "Verify metadata is set" - name: "Verify metadata is set"
rax_files_objects: container=testcont type=meta src=file17 rax_files_objects:
container: testcont
type: meta
src: file17
- name: "Delete metadata" - name: "Delete metadata"
rax_files_objects: rax_files_objects:
@ -180,7 +222,9 @@ EXAMPLES = '''
key2: '' key2: ''
- name: "Get metadata on all objects" - name: "Get metadata on all objects"
rax_files_objects: container=testcont type=meta rax_files_objects:
container: testcont
type: meta
''' '''
try: try:

View file

@ -78,25 +78,33 @@ extends_documentation_fragment: mysql
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Create a new database with name 'bobdata' - name: Create a new database with name 'bobdata'
- mysql_db: mysql_db:
name: bobdata name: bobdata
state: present state: present
# Copy database dump file to remote host and restore it to database 'my_db' # Copy database dump file to remote host and restore it to database 'my_db'
- copy: - name: Copy database dump file
copy:
src: dump.sql.bz2 src: dump.sql.bz2
dest: /tmp dest: /tmp
- mysql_db: - name: Restore database
mysql_db:
name: my_db name: my_db
state: import state: import
target: /tmp/dump.sql.bz2 target: /tmp/dump.sql.bz2
# Dumps all databases to hostname.sql - name: Dump all databases to hostname.sql
- mysql_db: state=dump name=all target=/tmp/{{ inventory_hostname }}.sql mysql_db:
state: dump
name: all
target: /tmp/{{ inventory_hostname }}.sql
# Imports file.sql similar to mysql -u <username> -p <password> < hostname.sql - name: Import file.sql similar to mysql -u <username> -p <password> < hostname.sql
- mysql_db: state=import name=all target=/tmp/{{ inventory_hostname }}.sql mysql_db:
state: import
name: all
target: /tmp/{{ inventory_hostname }}.sql
''' '''
import os import os

View file

@ -114,7 +114,8 @@ EXAMPLES = '''
mode: "u=rw,g=r,o=r" mode: "u=rw,g=r,o=r"
# touch the same file, but add/remove some permissions # touch the same file, but add/remove some permissions
- file: path=/etc/foo.conf - file:
path: /etc/foo.conf
state: touch state: touch
mode: "u+rw,g-wx,o-rwx" mode: "u+rw,g-wx,o-rwx"

View file

@ -152,20 +152,24 @@ author: "Romeo Theriault (@romeotheriault)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Check that you can connect (GET) to a page and it returns a status 200 - name: Check that you can connect (GET) to a page and it returns a status 200
- uri: url=http://www.example.com uri:
url: 'http://www.example.com'
# Check that a page returns a status 200 and fail if the word AWESOME is not # Check that a page returns a status 200 and fail if the word AWESOME is not
# in the page contents. # 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 register: webpage
- action: fail - name: Fail if AWESOME is not in the page content
fail:
when: "'AWESOME' not in webpage.content" when: "'AWESOME' not in webpage.content"
# Create a JIRA issue - name: Create a JIRA issue
- uri: uri:
url: https://your.jira.example.com/rest/api/2/issue/ url: https://your.jira.example.com/rest/api/2/issue/
method: POST method: POST
user: your_username user: your_username
@ -192,8 +196,8 @@ EXAMPLES = '''
return_content: yes return_content: yes
HEADER_Cookie: "{{login.set_cookie}}" HEADER_Cookie: "{{login.set_cookie}}"
# Queue build of a project in Jenkins: - name: Queue build of a project in Jenkins
- uri: uri:
url: "http://{{ jenkins.host }}/job/{{ jenkins.job }}/build?token={{ jenkins.token }}" url: "http://{{ jenkins.host }}/job/{{ jenkins.job }}/build?token={{ jenkins.token }}"
method: GET method: GET
user: "{{ jenkins.user }}" user: "{{ jenkins.user }}"

View file

@ -146,33 +146,39 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
# Options ['virtual_mac', 'virtual_ip'] are required together # Options ['virtual_mac', 'virtual_ip'] are required together
# configure a bond interface with IP address # configure a bond interface with IP address
cl_bond: name=bond0 slaves="swp4-5" ipv4=10.1.1.1/24 - cl_bond:
notify: reload networking name: bond0
slaves: "swp4-5"
ipv4: 10.1.1.1/24
notify: reload networking
# configure bond as a dual-connected clag bond # configure bond as a dual-connected clag bond
cl_bond: name=bond1 slaves="swp1s0 swp2s0" clag_id=1 - cl_bond:
notify: reload networking name: bond1
slaves: "swp1s0 swp2s0"
clag_id: 1
notify: reload networking
# define cl_bond once in tasks file # define cl_bond once in tasks file
# then write interface config in variables file # then write interface config in variables file
# with just the options you want. # with just the options you want.
cl_bond: - cl_bond:
name: "{{ item.key }}" name: "{{ item.key }}"
slaves: "{{ item.value.slaves }}" slaves: "{{ item.value.slaves }}"
clag_id: "{{ item.value.clag_id|default(omit) }}" clag_id: "{{ item.value.clag_id|default(omit) }}"
ipv4: "{{ item.value.ipv4|default(omit) }}" ipv4: "{{ item.value.ipv4|default(omit) }}"
ipv6: "{{ item.value.ipv6|default(omit) }}" ipv6: "{{ item.value.ipv6|default(omit) }}"
alias_name: "{{ item.value.alias_name|default(omit) }}" alias_name: "{{ item.value.alias_name|default(omit) }}"
addr_method: "{{ item.value.addr_method|default(omit) }}" addr_method: "{{ item.value.addr_method|default(omit) }}"
mtu: "{{ item.value.mtu|default(omit) }}" mtu: "{{ item.value.mtu|default(omit) }}"
vids: "{{ item.value.vids|default(omit) }}" vids: "{{ item.value.vids|default(omit) }}"
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}" virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}" virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}" mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}"
mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}" mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}"
mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}" mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}"
with_dict: "{{ cl_bonds }}" with_dict: "{{ cl_bonds }}"
notify: reload networking notify: reload networking
# In vars file # In vars file
# ============ # ============

View file

@ -101,40 +101,47 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
# Options ['virtual_mac', 'virtual_ip'] are required together # Options ['virtual_mac', 'virtual_ip'] are required together
# configure a bridge vlan aware bridge. # configure a bridge vlan aware bridge.
cl_bridge: name=br0 ports='swp1-12' vlan_aware='yes' - cl_bridge:
notify: reload networking name: br0
ports: 'swp1-12'
vlan_aware: 'yes'
notify: reload networking
# configure bridge interface to define a default set of vlans # configure bridge interface to define a default set of vlans
cl_bridge: name=bridge ports='swp1-12' vlan_aware='yes' vids='1-100' - cl_bridge:
notify: reload networking name: bridge
ports: 'swp1-12'
vlan_aware: 'yes'
vids: '1-100'
notify: reload networking
# define cl_bridge once in tasks file # define cl_bridge once in tasks file
# then write interface config in variables file # then write interface config in variables file
# with just the options you want. # with just the options you want.
cl_bridge: - cl_bridge:
name: "{{ item.key }}" name: "{{ item.key }}"
ports: "{{ item.value.ports }}" ports: "{{ item.value.ports }}"
vlan_aware: "{{ item.value.vlan_aware|default(omit) }}" vlan_aware: "{{ item.value.vlan_aware|default(omit) }}"
ipv4: "{{ item.value.ipv4|default(omit) }}" ipv4: "{{ item.value.ipv4|default(omit) }}"
ipv6: "{{ item.value.ipv6|default(omit) }}" ipv6: "{{ item.value.ipv6|default(omit) }}"
alias_name: "{{ item.value.alias_name|default(omit) }}" alias_name: "{{ item.value.alias_name|default(omit) }}"
addr_method: "{{ item.value.addr_method|default(omit) }}" addr_method: "{{ item.value.addr_method|default(omit) }}"
mtu: "{{ item.value.mtu|default(omit) }}" mtu: "{{ item.value.mtu|default(omit) }}"
vids: "{{ item.value.vids|default(omit) }}" vids: "{{ item.value.vids|default(omit) }}"
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}" virtual_ip: "{{ item.value.virtual_ip|default(omit) }}"
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}" virtual_mac: "{{ item.value.virtual_mac|default(omit) }}"
mstpctl_treeprio: "{{ item.value.mstpctl_treeprio|default(omit) }}" mstpctl_treeprio: "{{ item.value.mstpctl_treeprio|default(omit) }}"
with_dict: "{{ cl_bridges }}" with_dict: "{{ cl_bridges }}"
notify: reload networking notify: reload networking
# In vars file # In vars file
# ============ # ============
cl_bridge: cl_bridge:
br0: br0:
alias_name: 'vlan aware bridge' alias_name: 'vlan aware bridge'
ports: ['swp1', 'swp3'] ports: ['swp1', 'swp3']
vlan_aware: true vlan_aware: true
vids: ['1-100'] vids: ['1-100']
''' '''
RETURN = ''' RETURN = '''

View file

@ -59,32 +59,40 @@ Example playbook entries using the cl_img_install module
## Download and install the image from a webserver. ## Download and install the image from a webserver.
- name: install image using using http url. Switch slots so the subsequent - name: Install image using using http url. Switch slots so the subsequent will load the new version
will load the new version cl_img_install:
cl_img_install: version=2.0.1 version: 2.0.1
src='http://10.1.1.1/CumulusLinux-2.0.1.bin' src: 'http://10.1.1.1/CumulusLinux-2.0.1.bin'
switch_slot=yes switch_slot: yes
## Copy the software from the ansible server to the switch. ## Copy the software from the ansible server to the switch.
## The module will get the code version from the filename ## 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 ## 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 ## A subsequent reload will not run the new code
- name: download cumulus linux to local system - name: Download cumulus linux to local system
get_url: src=ftp://cumuluslinux.bin dest=/root/CumulusLinux-2.0.1.bin get_url:
src: 'ftp://cumuluslinux.bin'
dest: /root/CumulusLinux-2.0.1.bin
- name: install image from local filesystem. Get version from the filename - name: Install image from local filesystem. Get version from the filename.
cl_img_install: src='/root/CumulusLinux-2.0.1.bin' 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 ## 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 ## to inform the module exactly what code version is been installed
- name: download cumulus linux to local system - name: Download cumulus linux to local system
get_url: src=ftp://CumulusLinux-2.0.1.bin dest=/root/image.bin get_url:
src: 'ftp://CumulusLinux-2.0.1.bin'
dest: /root/image.bin
- name: install image and switch slots. only reboot needed - name: install image and switch slots. only reboot needed
cl_img_install: version=2.0.1 src=/root/image.bin switch_slot=yes' cl_img_install:
version: 2.0.1
src: /root/image.bin
switch_slot: yes
''' '''
RETURN = ''' RETURN = '''

View file

@ -114,45 +114,55 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
# Options ['virtual_mac', 'virtual_ip'] are required together # Options ['virtual_mac', 'virtual_ip'] are required together
# configure a front panel port with an IP - name: Configure a front panel port with an IP
cl_interface: name=swp1 ipv4=10.1.1.1/24 cl_interface:
notify: reload networking name: swp1
ipv4: 10.1.1.1/24
notify: reload networking
# configure front panel to use DHCP - name: Configure front panel to use DHCP
cl_interface: name=swp2 addr_family=dhcp cl_interface:
notify: reload networking name: swp2
addr_family: dhcp
notify: reload networking
# configure a SVI for vlan 100 interface with an IP - name: Configure a SVI for vlan 100 interface with an IP
cl_interface: name=bridge.100 ipv4=10.1.1.1/24 cl_interface:
notify: reload networking name: bridge.100
ipv4: 10.1.1.1/24
notify: reload networking
# configure subinterface with an IP - name: Configure subinterface with an IP
cl_interface: name=bond0.100 alias_name='my bond' ipv4=10.1.1.1/24 cl_interface:
notify: reload networking name: bond0.100
alias_name: 'my bond'
ipv4: 10.1.1.1/24
notify: reload networking
# define cl_interfaces once in tasks # define cl_interfaces once in tasks
# then write interfaces in variables file # then write interfaces in variables file
# with just the options you want. # with just the options you want.
cl_interface: - name: Create interfaces
name: "{{ item.key }}" cl_interface:
ipv4: "{{ item.value.ipv4|default(omit) }}" name: "{{ item.key }}"
ipv6: "{{ item.value.ipv6|default(omit) }}" ipv4: "{{ item.value.ipv4 | default(omit) }}"
alias_name: "{{ item.value.alias_name|default(omit) }}" ipv6: "{{ item.value.ipv6 | default(omit) }}"
addr_method: "{{ item.value.addr_method|default(omit) }}" alias_name: "{{ item.value.alias_name | default(omit) }}"
speed: "{{ item.value.link_speed|default(omit) }}" addr_method: "{{ item.value.addr_method | default(omit) }}"
mtu: "{{ item.value.mtu|default(omit) }}" speed: "{{ item.value.link_speed | default(omit) }}"
clagd_enable: "{{ item.value.clagd_enable|default(omit) }}" mtu: "{{ item.value.mtu | default(omit) }}"
clagd_peer_ip: "{{ item.value.clagd_peer_ip|default(omit) }}" clagd_enable: "{{ item.value.clagd_enable | default(omit) }}"
clagd_sys_mac: "{{ item.value.clagd_sys_mac|default(omit) }}" clagd_peer_ip: "{{ item.value.clagd_peer_ip | default(omit) }}"
clagd_priority: "{{ item.value.clagd_priority|default(omit) }}" clagd_sys_mac: "{{ item.value.clagd_sys_mac | default(omit) }}"
vids: "{{ item.value.vids|default(omit) }}" clagd_priority: "{{ item.value.clagd_priority | default(omit) }}"
virtual_ip: "{{ item.value.virtual_ip|default(omit) }}" vids: "{{ item.value.vids | default(omit) }}"
virtual_mac: "{{ item.value.virtual_mac|default(omit) }}" virtual_ip: "{{ item.value.virtual_ip | default(omit) }}"
mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}" virtual_mac: "{{ item.value.virtual_mac | default(omit) }}"
mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}" mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork | default('no') }}"
mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}" mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge | default('no') }}"
with_dict: "{{ cl_interfaces }}" mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard | default('no') }}"
notify: reload networking with_dict: "{{ cl_interfaces }}"
notify: reload networking
# In vars file # In vars file

View file

@ -55,33 +55,37 @@ options:
''' '''
EXAMPLES = ''' 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
- hosts: all tasks:
tasks: - name: install license using http url
- name: install license using http url cl_license:
cl_license: src='http://10.1.1.1/license.txt' src: 'http://10.1.1.1/license.txt'
notify: restart switchd notify: restart switchd
- name: Triggers switchd to be restarted right away, before play, or role - name: Triggers switchd to be restarted right away, before play, or role
is over. This is desired behaviour is over. This is desired behaviour
meta: flush_handlers meta: flush_handlers
- name: configure interfaces - name: Configure interfaces
template: src=interfaces.j2 dest=/etc/network/interfaces template:
notify: restart networking src: interfaces.j2
dest: /etc/network/interfaces
notify: restart networking
handlers: handlers:
- name: restart switchd - name: restart switchd
service: name=switchd state=restarted service:
- name: restart networking name: switchd
service: name=networking state=reloaded state: restarted
- name: restart networking
---- service:
name: networking
state: reloaded
# Force all switches to accept a new license. Typically not needed # 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
---- ----

View file

@ -48,7 +48,9 @@ attributes defined in the ports.conf file on Cumulus Linux
## Unganged port config using simple args ## Unganged port config using simple args
- name: configure ports.conf setup - 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 notify: restart switchd
## Unganged port configuration on certain ports using complex args ## Unganged port configuration on certain ports using complex args