diff options
author | Sam Doran <sdoran@ansible.com> | 2016-11-16 12:24:21 -0500 |
---|---|---|
committer | John R Barker <john@johnrbarker.com> | 2016-11-16 17:24:21 +0000 |
commit | a257f9cc9c5e481ad7902db53fc46f4001adcbad (patch) | |
tree | 14ee2910780dff97626fe9572d3d36d7944e2ab9 /cloud | |
parent | bb97885f91573a8d76c307d03cef1a54702ed3c7 (diff) | |
download | ansible-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
Diffstat (limited to 'cloud')
-rw-r--r-- | cloud/openstack/os_auth.py | 9 | ||||
-rw-r--r-- | cloud/openstack/os_client_config.py | 16 | ||||
-rw-r--r-- | cloud/openstack/os_image_facts.py | 11 | ||||
-rw-r--r-- | cloud/openstack/os_networks_facts.py | 35 | ||||
-rw-r--r-- | cloud/openstack/os_nova_flavor.py | 31 | ||||
-rw-r--r-- | cloud/openstack/os_object.py | 18 | ||||
-rw-r--r-- | cloud/openstack/os_server.py | 222 | ||||
-rw-r--r-- | cloud/openstack/os_subnets_facts.py | 37 | ||||
-rw-r--r-- | cloud/rackspace/rax_files.py | 27 | ||||
-rw-r--r-- | cloud/rackspace/rax_files_objects.py | 74 |
10 files changed, 284 insertions, 196 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: |