summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Doran <sdoran@ansible.com>2016-11-16 12:24:21 -0500
committerJohn R Barker <john@johnrbarker.com>2016-11-16 17:24:21 +0000
commita257f9cc9c5e481ad7902db53fc46f4001adcbad (patch)
tree14ee2910780dff97626fe9572d3d36d7944e2ab9
parentbb97885f91573a8d76c307d03cef1a54702ed3c7 (diff)
downloadansible-modules-core-a257f9cc9c5e481ad7902db53fc46f4001adcbad.tar.gz
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
-rw-r--r--cloud/openstack/os_auth.py9
-rw-r--r--cloud/openstack/os_client_config.py16
-rw-r--r--cloud/openstack/os_image_facts.py11
-rw-r--r--cloud/openstack/os_networks_facts.py35
-rw-r--r--cloud/openstack/os_nova_flavor.py31
-rw-r--r--cloud/openstack/os_object.py18
-rw-r--r--cloud/openstack/os_server.py222
-rw-r--r--cloud/openstack/os_subnets_facts.py37
-rw-r--r--cloud/rackspace/rax_files.py27
-rw-r--r--cloud/rackspace/rax_files_objects.py74
-rw-r--r--database/mysql/mysql_db.py24
-rw-r--r--files/file.py3
-rw-r--r--network/basics/uri.py20
-rw-r--r--network/cumulus/cl_bond.py48
-rw-r--r--network/cumulus/cl_bridge.py55
-rw-r--r--network/cumulus/cl_img_install.py34
-rw-r--r--network/cumulus/cl_interface.py80
-rw-r--r--network/cumulus/cl_license.py54
-rw-r--r--network/cumulus/cl_ports.py4
19 files changed, 470 insertions, 332 deletions
diff --git a/cloud/openstack/os_auth.py b/cloud/openstack/os_auth.py
index 4f4d22ea..f4cdea43 100644
--- a/cloud/openstack/os_auth.py
+++ b/cloud/openstack/os_auth.py
@@ -37,10 +37,13 @@ extends_documentation_fragment: openstack
'''
EXAMPLES = '''
-# Authenticate to the cloud and retrieve the service catalog
-- os_auth:
+- name: Authenticate to the cloud and retrieve the service catalog
+ os_auth:
cloud: rax-dfw
-- debug: var=service_catalog
+
+- name: Show service catalog
+ debug:
+ var: service_catalog
'''
def main():
diff --git a/cloud/openstack/os_client_config.py b/cloud/openstack/os_client_config.py
index 1627bdfe..ba524a5b 100644
--- a/cloud/openstack/os_client_config.py
+++ b/cloud/openstack/os_client_config.py
@@ -39,15 +39,17 @@ author: "Monty Taylor (@emonty)"
'''
EXAMPLES = '''
-# Get list of clouds that do not support security groups
-- os_client_config:
-- debug: var={{ item }}
- with_items: "{{ openstack.clouds|rejectattr('secgroup_source', 'none')|list() }}"
+- name: Get list of clouds that do not support security groups
+ os_client_config:
-# Get the information back just about the mordred cloud
-- os_client_config:
+- debug:
+ 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:
- - mordred
+ - mordred
'''
diff --git a/cloud/openstack/os_image_facts.py b/cloud/openstack/os_image_facts.py
index 4058d400..9f693c73 100644
--- a/cloud/openstack/os_image_facts.py
+++ b/cloud/openstack/os_image_facts.py
@@ -42,15 +42,18 @@ extends_documentation_fragment: openstack
'''
EXAMPLES = '''
-# Gather facts about a previously created image named image1
-- os_image_facts:
+- name: Gather facts about a previously created image named image1
+ os_image_facts:
auth:
- auth_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
image: image1
-- debug: var=openstack
+
+- name: Show openstack facts
+ debug:
+ var: openstack
'''
RETURN = '''
diff --git a/cloud/openstack/os_networks_facts.py b/cloud/openstack/os_networks_facts.py
index 9db5ecea..c261fc32 100644
--- a/cloud/openstack/os_networks_facts.py
+++ b/cloud/openstack/os_networks_facts.py
@@ -46,30 +46,36 @@ extends_documentation_fragment: openstack
'''
EXAMPLES = '''
-# Gather facts about previously created networks
-- os_networks_facts:
+- name: Gather facts about previously created networks
+ os_networks_facts:
auth:
- auth_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
-- debug: var=openstack_networks
-# Gather facts about a previously created network by name
-- os_networks_facts:
+- name: Show openstack networks
+ debug:
+ var: openstack_networks
+
+- name: Gather facts about a previously created network by name
+ os_networks_facts:
auth:
- auth_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
name: network1
-- debug: var=openstack_networks
-# Gather facts about a previously created network with filter (note: name and
- filters parameters are Not mutually exclusive)
-- os_networks_facts:
+- name: Show openstack networks
+ debug:
+ 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_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
@@ -78,7 +84,10 @@ EXAMPLES = '''
subnets:
- 057d4bdf-6d4d-4728-bb0f-5ac45a6f7400
- 443d4dc0-91d4-4998-b21c-357d10433483
-- debug: var=openstack_networks
+
+- name: Show openstack networks
+ debug:
+ var: openstack_networks
'''
RETURN = '''
diff --git a/cloud/openstack/os_nova_flavor.py b/cloud/openstack/os_nova_flavor.py
index 102b2bf2..8dd939bc 100644
--- a/cloud/openstack/os_nova_flavor.py
+++ b/cloud/openstack/os_nova_flavor.py
@@ -88,22 +88,21 @@ requirements: ["shade"]
'''
EXAMPLES = '''
-# Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of
-# local disk, and 10GB of ephemeral.
-- os_nova_flavor:
- cloud=mycloud
- state=present
- name=tiny
- ram=1024
- vcpus=1
- disk=10
- ephemeral=10
-
-# Delete 'tiny' flavor
-- os_nova_flavor:
- cloud=mycloud
- state=absent
- name=tiny
+- name: "Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of local disk, and 10GB of ephemeral."
+ os_nova_flavor:
+ cloud: mycloud
+ state: present
+ name: tiny
+ ram: 1024
+ vcpus: 1
+ disk: 10
+ ephemeral: 10
+
+- name: "Delete 'tiny' flavor"
+ os_nova_flavor:
+ cloud: mycloud
+ state: absent
+ name: tiny
'''
RETURN = '''
diff --git a/cloud/openstack/os_object.py b/cloud/openstack/os_object.py
index d5d77e13..d386d853 100644
--- a/cloud/openstack/os_object.py
+++ b/cloud/openstack/os_object.py
@@ -60,11 +60,19 @@ options:
'''
EXAMPLES = '''
-# Creates a object named 'fstab' in the 'config' container
-- os_object: cloud=mordred state=present name=fstab container=config filename=/etc/fstab
-
-# Deletes a container called config and all of its contents
-- os_object: cloud=rax-iad state=absent container=config
+- name: "Create a object named 'fstab' in the 'config' container"
+ os_object:
+ cloud: mordred
+ state: present
+ name: fstab
+ container: config
+ filename: /etc/fstab
+
+- name: Delete a container called config and all of its contents
+ os_object:
+ cloud: rax-iad
+ state: absent
+ container: config
'''
diff --git a/cloud/openstack/os_server.py b/cloud/openstack/os_server.py
index 12d8724e..f4d546d2 100644
--- a/cloud/openstack/os_server.py
+++ b/cloud/openstack/os_server.py
@@ -203,12 +203,11 @@ requirements:
'''
EXAMPLES = '''
-# Creates a new instance and attaches to a network and passes metadata to
-# the instance
-- os_server:
+- name: Create a new instance and attaches to a network and passes metadata to the instance
+ os_server:
state: present
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
password: admin
project_name: admin
@@ -224,99 +223,98 @@ EXAMPLES = '''
hostname: test1
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
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance
- os_server:
- state: present
- auth:
- auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
- username: username
- password: Equality7-2521
- project_name: username-project1
- name: vm1
- region_name: region-b.geo-1
- availability_zone: az2
- image: 9302692b-b787-4b52-a3a6-daebb79cb498
- key_name: test
- timeout: 200
- flavor: 101
- security_groups: default
- auto_ip: yes
-
-# Creates a new instance in named cloud mordred availability zone az2
+ - name: launch an instance
+ os_server:
+ state: present
+ auth:
+ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
+ username: username
+ password: Equality7-2521
+ project_name: username-project1
+ name: vm1
+ region_name: region-b.geo-1
+ availability_zone: az2
+ image: 9302692b-b787-4b52-a3a6-daebb79cb498
+ key_name: test
+ timeout: 200
+ flavor: 101
+ security_groups: default
+ auto_ip: yes
+
+# Create a new instance in named cloud mordred availability zone az2
# and assigns a pre-known floating IP
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance
- os_server:
- state: present
- cloud: mordred
- name: vm1
- availability_zone: az2
- image: 9302692b-b787-4b52-a3a6-daebb79cb498
- key_name: test
- timeout: 200
- flavor: 101
- floating_ips:
- - 12.34.56.79
-
-# Creates a new instance with 4G of RAM on Ubuntu Trusty, ignoring
+ - name: launch an instance
+ os_server:
+ state: present
+ cloud: mordred
+ name: vm1
+ availability_zone: az2
+ image: 9302692b-b787-4b52-a3a6-daebb79cb498
+ key_name: test
+ timeout: 200
+ flavor: 101
+ floating_ips:
+ - 12.34.56.79
+
+# Create a new instance with 4G of RAM on Ubuntu Trusty, ignoring
# deprecated images
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance
- os_server:
- name: vm1
- state: present
- cloud: mordred
- region_name: region-b.geo-1
- image: Ubuntu Server 14.04
- image_exclude: deprecated
- flavor_ram: 4096
-
-# Creates a new instance with 4G of RAM on Ubuntu Trusty on a Performance node
+ - name: launch an instance
+ os_server:
+ name: vm1
+ state: present
+ cloud: mordred
+ region_name: region-b.geo-1
+ image: Ubuntu Server 14.04
+ image_exclude: deprecated
+ flavor_ram: 4096
+
+# Create a new instance with 4G of RAM on Ubuntu Trusty on a Performance node
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance
- os_server:
- name: vm1
- cloud: rax-dfw
- state: present
- image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
- flavor_ram: 4096
- flavor_include: Performance
+ - name: launch an instance
+ os_server:
+ name: vm1
+ cloud: rax-dfw
+ state: present
+ image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
+ flavor_ram: 4096
+ flavor_include: Performance
# Creates a new instance and attaches to multiple network
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance with a string
- os_server:
- auth:
- auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
- username: admin
- password: admin
- project_name: admin
- name: vm1
- image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
- key_name: ansible_key
- timeout: 200
- flavor: 4
- 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
-# the instance
-- os_server:
+ - name: launch an instance with a string
+ os_server:
+ auth:
+ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
+ username: admin
+ password: admin
+ project_name: admin
+ name: vm1
+ image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
+ key_name: ansible_key
+ timeout: 200
+ flavor: 4
+ nics: "net-id=4cb08b20-62fe-11e5-9d70-feff819cdc9f,net-id=542f0430-62fe-11e5-9d70-feff819cdc9f..."
+
+- name: Creates a new instance and attaches to a network and passes metadata to the instance
+ os_server:
state: present
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
password: admin
project_name: admin
@@ -330,51 +328,51 @@ EXAMPLES = '''
- net-name: another_network
meta: "hostname=test1,group=uge_master"
-# Creates a new instance and attaches to a specific network
-- os_server:
- state: present
- auth:
- auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
- username: admin
- password: admin
- project_name: admin
- name: vm1
- image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
- key_name: ansible_key
- timeout: 200
- flavor: 4
- network: another_network
-
-# Creates a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
+- name: Creates a new instance and attaches to a specific network
+ os_server:
+ state: present
+ auth:
+ auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
+ username: admin
+ password: admin
+ project_name: admin
+ name: vm1
+ image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
+ key_name: ansible_key
+ timeout: 200
+ flavor: 4
+ network: another_network
+
+# Create a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance
- os_server:
- name: vm1
- state: present
- cloud: mordred
- region_name: ams01
- image: Ubuntu Server 14.04
- flavor_ram: 4096
- boot_from_volume: True
- volume_size: 75
+ - name: launch an instance
+ os_server:
+ name: vm1
+ state: present
+ cloud: mordred
+ region_name: ams01
+ image: Ubuntu Server 14.04
+ flavor_ram: 4096
+ boot_from_volume: True
+ volume_size: 75
# Creates a new instance with 2 volumes attached
- name: launch a compute instance
hosts: localhost
tasks:
- - name: launch an instance
- os_server:
- name: vm1
- state: present
- cloud: mordred
- region_name: ams01
- image: Ubuntu Server 14.04
- flavor_ram: 4096
- volumes:
- - photos
- - music
+ - name: launch an instance
+ os_server:
+ name: vm1
+ state: present
+ cloud: mordred
+ region_name: ams01
+ image: Ubuntu Server 14.04
+ flavor_ram: 4096
+ volumes:
+ - photos
+ - music
'''
diff --git a/cloud/openstack/os_subnets_facts.py b/cloud/openstack/os_subnets_facts.py
index 8d853de7..dce24362 100644
--- a/cloud/openstack/os_subnets_facts.py
+++ b/cloud/openstack/os_subnets_facts.py
@@ -46,36 +46,45 @@ extends_documentation_fragment: openstack
'''
EXAMPLES = '''
-# Gather facts about previously created subnets
-- os_subnets_facts:
+- name: Gather facts about previously created subnets
+ os_subnets_facts:
auth:
- auth_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
-- debug: var=openstack_subnets
-# Gather facts about a previously created subnet by name
-- os_subnets_facts:
+- name: Show openstack subnets
+ debug:
+ var: openstack_subnets
+
+- name: Gather facts about a previously created subnet by name
+ os_subnets_facts:
auth:
- auth_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
- name: subnet1
-- debug: var=openstack_subnets
+ name: subnet1
+
+- name: Show openstack subnets
+ debug:
+ var: openstack_subnets
-# Gather facts about a previously created subnet with filter (note: name and
- filters parameters are Not mutually exclusive)
-- os_subnets_facts:
+- name: Gather facts about a previously created subnet with filter
+ # Note: name and filters parameters are not mutually exclusive
+ os_subnets_facts:
auth:
- auth_url: https://your_api_url.com:9000/v2.0
+ auth_url: 'https://your_api_url.com:9000/v2.0'
username: user
password: password
project_name: someproject
filters:
tenant_id: 55e2ce24b2a245b09f181bf025724cbe
-- debug: var=openstack_subnets
+
+- name: Show openstack subnets
+ debug:
+ var: openstack_subnets
'''
RETURN = '''
diff --git a/cloud/rackspace/rax_files.py b/cloud/rackspace/rax_files.py
index 48d5db21..77ab70d8 100644
--- a/cloud/rackspace/rax_files.py
+++ b/cloud/rackspace/rax_files.py
@@ -86,10 +86,12 @@ EXAMPLES = '''
gather_facts: no
tasks:
- name: "List all containers"
- rax_files: state=list
+ rax_files:
+ state: list
- name: "Create container called 'mycontainer'"
- rax_files: container=mycontainer
+ rax_files:
+ container: mycontainer
- name: "Create container 'mycontainer2' with metadata"
rax_files:
@@ -99,19 +101,30 @@ EXAMPLES = '''
file_for: someuser@example.com
- 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"
- rax_files: container=mycontainer web_error=error.html
+ rax_files:
+ container: mycontainer
+ web_error: error.html
- 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"
- rax_files: container=mycontainer public=yes ttl=86400
+ rax_files:
+ container: mycontainer
+ public: yes
+ ttl: 86400
- name: "Make container private"
- rax_files: container=mycontainer private=yes
+ rax_files:
+ container: mycontainer
+ private: yes
- name: "Test Cloud Files Containers Metadata Storage"
hosts: local
diff --git a/cloud/rackspace/rax_files_objects.py b/cloud/rackspace/rax_files_objects.py
index d89a8067..d0175996 100644
--- a/cloud/rackspace/rax_files_objects.py
+++ b/cloud/rackspace/rax_files_objects.py
@@ -102,28 +102,50 @@ EXAMPLES = '''
gather_facts: False
tasks:
- 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"
- 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"
- 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"
- 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"
- 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"
- rax_files_objects: container=testcont method=delete
+ rax_files_objects:
+ container: testcont
+ method: delete
- 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"
- 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"
rax_files_objects:
@@ -135,14 +157,25 @@ EXAMPLES = '''
who_uploaded_this: someuser@example.com
- 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"
- 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
- 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
- name: "Test Cloud Files Objects Metadata"
@@ -150,10 +183,16 @@ EXAMPLES = '''
gather_facts: false
tasks:
- 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"
- 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"
rax_files_objects:
@@ -167,7 +206,10 @@ EXAMPLES = '''
clear_meta: true
- 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"
rax_files_objects:
@@ -180,7 +222,9 @@ EXAMPLES = '''
key2: ''
- name: "Get metadata on all objects"
- rax_files_objects: container=testcont type=meta
+ rax_files_objects:
+ container: testcont
+ type: meta
'''
try:
diff --git a/database/mysql/mysql_db.py b/database/mysql/mysql_db.py
index 2b6a19d5..43728842 100644
--- a/database/mysql/mysql_db.py
+++ b/database/mysql/mysql_db.py
@@ -78,25 +78,33 @@ extends_documentation_fragment: mysql
'''
EXAMPLES = '''
-# Create a new database with name 'bobdata'
-- mysql_db:
+- name: Create a new database with name 'bobdata'
+ mysql_db:
name: bobdata
state: present
# 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
dest: /tmp
-- mysql_db:
+- name: Restore database
+ mysql_db:
name: my_db
state: import
target: /tmp/dump.sql.bz2
-# Dumps all databases to hostname.sql
-- mysql_db: state=dump name=all target=/tmp/{{ inventory_hostname }}.sql
+- name: Dump all databases to 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
-- mysql_db: state=import name=all target=/tmp/{{ inventory_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
'''
import os
diff --git a/files/file.py b/files/file.py
index ed796cb1..25b00859 100644
--- a/files/file.py
+++ b/files/file.py
@@ -114,7 +114,8 @@ EXAMPLES = '''
mode: "u=rw,g=r,o=r"
# touch the same file, but add/remove some permissions
-- file: path=/etc/foo.conf
+- file:
+ path: /etc/foo.conf
state: touch
mode: "u+rw,g-wx,o-rwx"
diff --git a/network/basics/uri.py b/network/basics/uri.py
index afff0875..c66ce399 100644
--- a/network/basics/uri.py
+++ b/network/basics/uri.py
@@ -153,20 +153,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
@@ -193,8 +197,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 }}"
diff --git a/network/cumulus/cl_bond.py b/network/cumulus/cl_bond.py
index cc8930ce..958edc7f 100644
--- a/network/cumulus/cl_bond.py
+++ b/network/cumulus/cl_bond.py
@@ -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
# ============
diff --git a/network/cumulus/cl_bridge.py b/network/cumulus/cl_bridge.py
index 752d4fdd..abeb0758 100644
--- a/network/cumulus/cl_bridge.py
+++ b/network/cumulus/cl_bridge.py
@@ -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 = '''
diff --git a/network/cumulus/cl_img_install.py b/network/cumulus/cl_img_install.py
index 00e4f903..cfd5f454 100644
--- a/network/cumulus/cl_img_install.py
+++ b/network/cumulus/cl_img_install.py
@@ -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 = '''
diff --git a/network/cumulus/cl_interface.py b/network/cumulus/cl_interface.py
index 241a69c7..475f9ce2 100644
--- a/network/cumulus/cl_interface.py
+++ b/network/cumulus/cl_interface.py
@@ -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
-
-# 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
-
-# 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 a front panel port with an IP
+ cl_interface:
+ name: swp1
+ ipv4: 10.1.1.1/24
+ notify: reload networking
+
+- name: Configure front panel to use DHCP
+ cl_interface:
+ name: swp2
+ addr_family: dhcp
+ 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
+
+- 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
diff --git a/network/cumulus/cl_license.py b/network/cumulus/cl_license.py
index 7690d8ac..8097cda5 100644
--- a/network/cumulus/cl_license.py
+++ b/network/cumulus/cl_license.py
@@ -55,33 +55,37 @@ options:
'''
EXAMPLES = '''
-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
-
- - 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
-
- handlers:
- - name: restart switchd
- service: name=switchd state=restarted
- - name: restart networking
- service: name=networking state=reloaded
-
-----
+# 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
+
+ - 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
+
+ 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
----
diff --git a/network/cumulus/cl_ports.py b/network/cumulus/cl_ports.py
index 02728203..9ed48089 100644
--- a/network/cumulus/cl_ports.py
+++ b/network/cumulus/cl_ports.py
@@ -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