diff --git a/lib/ansible/modules/cloud/openstack/os_auth.py b/lib/ansible/modules/cloud/openstack/os_auth.py index 7038f3f7016..6eb1580df44 100644 --- a/lib/ansible/modules/cloud/openstack/os_auth.py +++ b/lib/ansible/modules/cloud/openstack/os_auth.py @@ -34,10 +34,13 @@ extends_documentation_fragment: openstack ''' EXAMPLES = ''' -# Authenticate to the cloud and retreive 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/lib/ansible/modules/cloud/openstack/os_client_config.py b/lib/ansible/modules/cloud/openstack/os_client_config.py index 1627bdfe322..ba524a5b0b5 100644 --- a/lib/ansible/modules/cloud/openstack/os_client_config.py +++ b/lib/ansible/modules/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/lib/ansible/modules/cloud/openstack/os_image_facts.py b/lib/ansible/modules/cloud/openstack/os_image_facts.py index 4058d4003e8..9f693c73b77 100644 --- a/lib/ansible/modules/cloud/openstack/os_image_facts.py +++ b/lib/ansible/modules/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/lib/ansible/modules/cloud/openstack/os_networks_facts.py b/lib/ansible/modules/cloud/openstack/os_networks_facts.py index 9db5eceaa69..c261fc32b76 100644 --- a/lib/ansible/modules/cloud/openstack/os_networks_facts.py +++ b/lib/ansible/modules/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/lib/ansible/modules/cloud/openstack/os_nova_flavor.py b/lib/ansible/modules/cloud/openstack/os_nova_flavor.py index 102b2bf2aee..8dd939bc8c2 100644 --- a/lib/ansible/modules/cloud/openstack/os_nova_flavor.py +++ b/lib/ansible/modules/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 +- 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 -# Delete 'tiny' flavor -- os_nova_flavor: - cloud=mycloud - state=absent - name=tiny +- name: "Delete 'tiny' flavor" + os_nova_flavor: + cloud: mycloud + state: absent + name: tiny ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/openstack/os_object.py b/lib/ansible/modules/cloud/openstack/os_object.py index 87d09e73f13..30c77964796 100644 --- a/lib/ansible/modules/cloud/openstack/os_object.py +++ b/lib/ansible/modules/cloud/openstack/os_object.py @@ -60,11 +60,19 @@ requirements: ["shade"] ''' EXAMPLES = ''' -# Creates a object named 'fstab' in the 'config' container -- os_object: cloud=mordred state=present name=fstab container=config filename=/etc/fstab +- name: "Create 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: Delete a container called config and all of its contents + os_object: + cloud: rax-iad + state: absent + container: config ''' diff --git a/lib/ansible/modules/cloud/openstack/os_server.py b/lib/ansible/modules/cloud/openstack/os_server.py index 4acd6c8c3d1..ccdf290fdc7 100644 --- a/lib/ansible/modules/cloud/openstack/os_server.py +++ b/lib/ansible/modules/cloud/openstack/os_server.py @@ -205,12 +205,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 @@ -226,99 +225,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 + - 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 +# 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 + - 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 +# 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 + - 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 +# 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..." + - 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: 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 @@ -332,51 +330,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 +- 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 -# 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 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/lib/ansible/modules/cloud/openstack/os_subnets_facts.py b/lib/ansible/modules/cloud/openstack/os_subnets_facts.py index 8d853de76de..dce24362f78 100644 --- a/lib/ansible/modules/cloud/openstack/os_subnets_facts.py +++ b/lib/ansible/modules/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 -# Gather facts about a previously created subnet with filter (note: name and - filters parameters are Not mutually exclusive) -- os_subnets_facts: +- name: Show openstack subnets + debug: + 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_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/lib/ansible/modules/cloud/rackspace/rax_files.py b/lib/ansible/modules/cloud/rackspace/rax_files.py index 48d5db21284..77ab70d8e8c 100644 --- a/lib/ansible/modules/cloud/rackspace/rax_files.py +++ b/lib/ansible/modules/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/lib/ansible/modules/cloud/rackspace/rax_files_objects.py b/lib/ansible/modules/cloud/rackspace/rax_files_objects.py index d89a8067093..d0175996b14 100644 --- a/lib/ansible/modules/cloud/rackspace/rax_files_objects.py +++ b/lib/ansible/modules/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/lib/ansible/modules/database/mysql/mysql_db.py b/lib/ansible/modules/database/mysql/mysql_db.py index 2b6a19d57a3..437288425f8 100644 --- a/lib/ansible/modules/database/mysql/mysql_db.py +++ b/lib/ansible/modules/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 -p < hostname.sql -- mysql_db: state=import name=all target=/tmp/{{ inventory_hostname }}.sql +- name: Import file.sql similar to mysql -u -p < hostname.sql + mysql_db: + state: import + name: all + target: /tmp/{{ inventory_hostname }}.sql ''' import os diff --git a/lib/ansible/modules/files/file.py b/lib/ansible/modules/files/file.py index 9e5b56a482c..9f1ab945dcc 100644 --- a/lib/ansible/modules/files/file.py +++ b/lib/ansible/modules/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/lib/ansible/modules/network/basics/uri.py b/lib/ansible/modules/network/basics/uri.py index d641d979013..98f86b1542a 100644 --- a/lib/ansible/modules/network/basics/uri.py +++ b/lib/ansible/modules/network/basics/uri.py @@ -152,20 +152,24 @@ author: "Romeo Theriault (@romeotheriault)" ''' EXAMPLES = ''' -# Check that you can connect (GET) to a page and it returns a status 200 -- uri: url=http://www.example.com +- name: Check that you can connect (GET) to a page and it returns a status 200 + uri: + url: 'http://www.example.com' # Check that a page returns a status 200 and fail if the word AWESOME is not # in the page contents. -- action: uri url=http://www.example.com return_content=yes +- uri: + url: http://www.example.com + return_content: yes register: webpage -- action: fail +- name: Fail if AWESOME is not in the page content + fail: when: "'AWESOME' not in webpage.content" -# Create a JIRA issue -- uri: +- name: Create a JIRA issue + uri: url: https://your.jira.example.com/rest/api/2/issue/ method: POST user: your_username @@ -192,8 +196,8 @@ EXAMPLES = ''' return_content: yes HEADER_Cookie: "{{login.set_cookie}}" -# Queue build of a project in Jenkins: -- uri: +- name: Queue build of a project in Jenkins + uri: url: "http://{{ jenkins.host }}/job/{{ jenkins.job }}/build?token={{ jenkins.token }}" method: GET user: "{{ jenkins.user }}" diff --git a/lib/ansible/modules/network/cumulus/cl_bond.py b/lib/ansible/modules/network/cumulus/cl_bond.py index cc8930ce8be..958edc7fe30 100644 --- a/lib/ansible/modules/network/cumulus/cl_bond.py +++ b/lib/ansible/modules/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/lib/ansible/modules/network/cumulus/cl_bridge.py b/lib/ansible/modules/network/cumulus/cl_bridge.py index 752d4fdd6e4..abeb0758a78 100644 --- a/lib/ansible/modules/network/cumulus/cl_bridge.py +++ b/lib/ansible/modules/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/lib/ansible/modules/network/cumulus/cl_img_install.py b/lib/ansible/modules/network/cumulus/cl_img_install.py index 00e4f9034c2..cfd5f4548a0 100644 --- a/lib/ansible/modules/network/cumulus/cl_img_install.py +++ b/lib/ansible/modules/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/lib/ansible/modules/network/cumulus/cl_interface.py b/lib/ansible/modules/network/cumulus/cl_interface.py index 241a69c7eff..475f9ce21dc 100644 --- a/lib/ansible/modules/network/cumulus/cl_interface.py +++ b/lib/ansible/modules/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 +- name: Configure a front panel port with an IP + cl_interface: + name: swp1 + ipv4: 10.1.1.1/24 + notify: reload networking -# configure front panel to use DHCP -cl_interface: name=swp2 addr_family=dhcp -notify: reload networking +- name: Configure front panel to use DHCP + cl_interface: + name: swp2 + addr_family: dhcp + notify: reload networking -# configure a SVI for vlan 100 interface with an IP -cl_interface: name=bridge.100 ipv4=10.1.1.1/24 -notify: reload networking +- name: Configure a SVI for vlan 100 interface with an IP + cl_interface: + name: bridge.100 + ipv4: 10.1.1.1/24 + notify: reload networking -# configure subinterface with an IP -cl_interface: name=bond0.100 alias_name='my bond' ipv4=10.1.1.1/24 -notify: reload networking +- name: Configure subinterface with an IP + cl_interface: + name: bond0.100 + alias_name: 'my bond' + ipv4: 10.1.1.1/24 + notify: reload networking # define cl_interfaces once in tasks # then write interfaces in variables file # with just the options you want. -cl_interface: - name: "{{ item.key }}" - ipv4: "{{ item.value.ipv4|default(omit) }}" - ipv6: "{{ item.value.ipv6|default(omit) }}" - alias_name: "{{ item.value.alias_name|default(omit) }}" - addr_method: "{{ item.value.addr_method|default(omit) }}" - speed: "{{ item.value.link_speed|default(omit) }}" - mtu: "{{ item.value.mtu|default(omit) }}" - clagd_enable: "{{ item.value.clagd_enable|default(omit) }}" - clagd_peer_ip: "{{ item.value.clagd_peer_ip|default(omit) }}" - clagd_sys_mac: "{{ item.value.clagd_sys_mac|default(omit) }}" - clagd_priority: "{{ item.value.clagd_priority|default(omit) }}" - vids: "{{ item.value.vids|default(omit) }}" - virtual_ip: "{{ item.value.virtual_ip|default(omit) }}" - virtual_mac: "{{ item.value.virtual_mac|default(omit) }}" - mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork|default('no') }}" - mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge|default('no') }}" - mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard|default('no') }}" -with_dict: "{{ cl_interfaces }}" -notify: reload networking + - name: Create interfaces + cl_interface: + name: "{{ item.key }}" + ipv4: "{{ item.value.ipv4 | default(omit) }}" + ipv6: "{{ item.value.ipv6 | default(omit) }}" + alias_name: "{{ item.value.alias_name | default(omit) }}" + addr_method: "{{ item.value.addr_method | default(omit) }}" + speed: "{{ item.value.link_speed | default(omit) }}" + mtu: "{{ item.value.mtu | default(omit) }}" + clagd_enable: "{{ item.value.clagd_enable | default(omit) }}" + clagd_peer_ip: "{{ item.value.clagd_peer_ip | default(omit) }}" + clagd_sys_mac: "{{ item.value.clagd_sys_mac | default(omit) }}" + clagd_priority: "{{ item.value.clagd_priority | default(omit) }}" + vids: "{{ item.value.vids | default(omit) }}" + virtual_ip: "{{ item.value.virtual_ip | default(omit) }}" + virtual_mac: "{{ item.value.virtual_mac | default(omit) }}" + mstpctl_portnetwork: "{{ item.value.mstpctl_portnetwork | default('no') }}" + mstpctl_portadminedge: "{{ item.value.mstpctl_portadminedge | default('no') }}" + mstpctl_bpduguard: "{{ item.value.mstpctl_bpduguard | default('no') }}" + with_dict: "{{ cl_interfaces }}" + notify: reload networking # In vars file diff --git a/lib/ansible/modules/network/cumulus/cl_license.py b/lib/ansible/modules/network/cumulus/cl_license.py index 7690d8ac1ce..8097cda5f56 100644 --- a/lib/ansible/modules/network/cumulus/cl_license.py +++ b/lib/ansible/modules/network/cumulus/cl_license.py @@ -55,33 +55,37 @@ options: ''' EXAMPLES = ''' -Example playbook using the cl_license module to manage licenses on Cumulus Linux +# Example playbook using the cl_license module to manage licenses on Cumulus Linux ---- - - hosts: all - tasks: - - name: install license using http url - cl_license: src='http://10.1.1.1/license.txt' - notify: restart switchd +- hosts: all + tasks: + - name: install license using http url + cl_license: + src: 'http://10.1.1.1/license.txt' + notify: restart switchd - - name: Triggers switchd to be restarted right away, before play, or role - is over. This is desired behaviour - meta: flush_handlers + - name: Triggers switchd to be restarted right away, before play, or role + is over. This is desired behaviour + meta: flush_handlers - - name: configure interfaces - template: src=interfaces.j2 dest=/etc/network/interfaces - notify: restart networking + - name: Configure interfaces + template: + src: interfaces.j2 + dest: /etc/network/interfaces + notify: restart networking - handlers: - - name: restart switchd - service: name=switchd state=restarted - - name: restart networking - service: name=networking state=reloaded - ----- + handlers: + - name: restart switchd + service: + name: switchd + state: restarted + - name: restart networking + service: + name: networking + state: reloaded # Force all switches to accept a new license. Typically not needed -ansible -m cl_license -a "src='http://10.1.1.1/new_lic' force=yes" -u root all +ansible -m cl_license -a "src='http://10.1.1.1/new_lic' force=yes" -u root all ---- diff --git a/lib/ansible/modules/network/cumulus/cl_ports.py b/lib/ansible/modules/network/cumulus/cl_ports.py index 02728203400..9ed48089cc4 100644 --- a/lib/ansible/modules/network/cumulus/cl_ports.py +++ b/lib/ansible/modules/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