diff --git a/lib/ansible/modules/cloud/amazon/_ec2_vpc.py b/lib/ansible/modules/cloud/amazon/_ec2_vpc.py index 491b508d1f0..2f2db3f6bad 100644 --- a/lib/ansible/modules/cloud/amazon/_ec2_vpc.py +++ b/lib/ansible/modules/cloud/amazon/_ec2_vpc.py @@ -105,14 +105,14 @@ EXAMPLES = ''' # It is assumed that their matching environment variables are set. # Basic creation example: - ec2_vpc: + - ec2_vpc: state: present cidr_block: 172.23.0.0/16 resource_tags: { "Environment":"Development" } region: us-west-2 # Full creation example with subnets and optional availability zones. # The absence or presence of subnets deletes or creates them respectively. - ec2_vpc: + - ec2_vpc: state: present cidr_block: 172.22.0.0/16 resource_tags: { "Environment":"Development" } @@ -143,12 +143,12 @@ EXAMPLES = ''' register: vpc # Removal of a VPC by id - ec2_vpc: + - ec2_vpc: state: absent vpc_id: vpc-aaaaaaa region: us-west-2 -If you have added elements not managed by this module, e.g. instances, NATs, etc then -the delete will fail until those dependencies are removed. +# If you have added elements not managed by this module, e.g. instances, NATs, etc then +# the delete will fail until those dependencies are removed. ''' diff --git a/lib/ansible/modules/cloud/amazon/cloudformation_facts.py b/lib/ansible/modules/cloud/amazon/cloudformation_facts.py index 8684a5f67f2..cd7e4babb7a 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation_facts.py @@ -73,7 +73,7 @@ EXAMPLES = ''' # Facts are published in ansible_facts['cloudformation'][] - debug: - msg: '{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}' + msg: "{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}" # Get all stack information about a stack - cloudformation_facts: diff --git a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py index 931a6706188..ad4dd6d44a6 100644 --- a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py @@ -145,10 +145,10 @@ EXAMPLES = ''' # Facts are published in ansible_facts['cloudfront'][] - debug: - msg: '{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}' + msg: "{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}" - debug: - msg: '{{ ansible_facts['cloudfront']['www.my-website.com'] }}' + msg: "{{ ansible_facts['cloudfront']['www.my-website.com'] }}" # Get all information about an invalidation for a distribution. - cloudfront_facts: diff --git a/lib/ansible/modules/cloud/amazon/cloudtrail.py b/lib/ansible/modules/cloud/amazon/cloudtrail.py index b6bc564fe97..1624d61d859 100644 --- a/lib/ansible/modules/cloud/amazon/cloudtrail.py +++ b/lib/ansible/modules/cloud/amazon/cloudtrail.py @@ -83,7 +83,8 @@ extends_documentation_fragment: aws EXAMPLES = """ - name: enable cloudtrail - local_action: cloudtrail + local_action: + module: cloudtrail state: enabled name: main s3_bucket_name: ourbucket @@ -91,7 +92,8 @@ EXAMPLES = """ region: us-east-1 - name: enable cloudtrail with different configuration - local_action: cloudtrail + local_action: + module: cloudtrail state: enabled name: main s3_bucket_name: ourbucket2 @@ -99,7 +101,8 @@ EXAMPLES = """ region: us-east-1 - name: remove cloudtrail - local_action: cloudtrail + local_action: + module: cloudtrail state: disabled name: main region: us-east-1 diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index a08914e0fab..db425f59d81 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -182,15 +182,15 @@ EXAMPLES = ''' # Rolling ASG Updates -Below is an example of how to assign a new launch config to an ASG and terminate old instances. - -All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in -a rolling fashion with instances using the current launch configuration, "my_new_lc". - -This could also be considered a rolling deploy of a pre-baked AMI. - -If this is a newly created group, the instances will not be replaced since all instances -will have the current launch configuration. +# Below is an example of how to assign a new launch config to an ASG and terminate old instances. +# +# All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in +# a rolling fashion with instances using the current launch configuration, "my_new_lc". +# +# This could also be considered a rolling deploy of a pre-baked AMI. +# +# If this is a newly created group, the instances will not be replaced since all instances +# will have the current launch configuration. - name: create launch config ec2_lc: @@ -213,8 +213,8 @@ will have the current launch configuration. desired_capacity: 5 region: us-east-1 -To only replace a couple of instances instead of all of them, supply a list -to "replace_instances": +# To only replace a couple of instances instead of all of them, supply a list +# to "replace_instances": - ec2_asg: name: myasg diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni.py b/lib/ansible/modules/cloud/amazon/ec2_eni.py index cc3a8be5942..a00b168f9a2 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eni.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eni.py @@ -175,7 +175,7 @@ EXAMPLES = ''' # Modify the interface to enable the delete_on_terminaton flag - ec2_eni: - eni_id: {{ "eni.interface.id" }} + eni_id: "{{ eni.interface.id }}" delete_on_termination: true ''' diff --git a/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py b/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py index f04cb69441a..9c51eea3072 100644 --- a/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py +++ b/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py @@ -90,7 +90,7 @@ EXAMPLES = ''' hostPort: 80 - name: busybox command: - - "/bin/sh -c \"while true; do echo ' Amazon ECS Sample App

Amazon ECS Sample App

Congratulations!

Your application is now running on a container in Amazon ECS.

' > top; /bin/date > date ; echo '
' > bottom; cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done\"" + - /bin/sh -c "while true; do echo 'Amazon ECS Sample App

Amazon ECS Sample App

Congratulations!

Your application is now running on a container in Amazon ECS.

' > top; /bin/date > date ; echo '
' > bottom; cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done" cpu: 10 entryPoint: - sh diff --git a/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py b/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py index 1a3508bfccb..e84e1174f3e 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py +++ b/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py @@ -54,7 +54,7 @@ extends_documentation_fragment: EXAMPLES = ''' # Add or change a subnet group -- elasticache_subnet_group +- elasticache_subnet_group: state: present name: norwegian-blue description: My Fancy Ex Parrot Subnet Group diff --git a/lib/ansible/modules/cloud/amazon/rds.py b/lib/ansible/modules/cloud/amazon/rds.py index 5e0775cf1f3..232b952b8d5 100644 --- a/lib/ansible/modules/cloud/amazon/rds.py +++ b/lib/ansible/modules/cloud/amazon/rds.py @@ -276,7 +276,7 @@ EXAMPLES = ''' wait: yes # Reboot an instance and wait for it to become available again -- rds +- rds: command: reboot instance_name: database wait: yes diff --git a/lib/ansible/modules/cloud/amazon/redshift_subnet_group.py b/lib/ansible/modules/cloud/amazon/redshift_subnet_group.py index f5aa01f24d1..1094b5e8f15 100644 --- a/lib/ansible/modules/cloud/amazon/redshift_subnet_group.py +++ b/lib/ansible/modules/cloud/amazon/redshift_subnet_group.py @@ -67,7 +67,7 @@ EXAMPLES = ''' - 'subnet-bbbbb' # Remove subnet group -redshift_subnet_group: > +- redshift_subnet_group: state: absent group_name: redshift-subnet ''' diff --git a/lib/ansible/modules/cloud/azure/azure_rm_deployment.py b/lib/ansible/modules/cloud/azure/azure_rm_deployment.py index fae1d942981..8c1e27a6f8e 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_deployment.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_deployment.py @@ -163,7 +163,7 @@ EXAMPLES = ''' - name: Add new instance to host group add_host: - hostname: '{{ item['ips'][0].public_ip }}' + hostname: "{{ item['ips'][0].public_ip }}" groupname: azure_vms with_items: "{{ azure.deployment.instances }}" diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py index b4c93d61f65..4580dfec8db 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py @@ -151,14 +151,14 @@ author: EXAMPLES = ''' - name: Create a network interface with minimal parameters - azure_rm_networkinterface: + azure_rm_networkinterface: name: nic001 resource_group: Testing virtual_network_name: vnet001 subnet_name: subnet001 - - name: Create a network interface with private IP address only (no Public IP) - azure_rm_networkinterface: + - name: Create a network interface with private IP address only (no Public IP) + azure_rm_networkinterface: name: nic001 resource_group: Testing virtual_network_name: vnet001 @@ -166,7 +166,7 @@ EXAMPLES = ''' public_ip: no - name: Create a network interface for use in a Windows host (opens RDP port) with custom RDP port - azure_rm_networkinterface: + azure_rm_networkinterface: name: nic002 resource_group: Testing virtual_network_name: vnet001 @@ -175,7 +175,7 @@ EXAMPLES = ''' rdp_port: 3399 - name: Create a network interface using existing security group and public IP - azure_rm_networkinterface: + azure_rm_networkinterface: name: nic003 resource_group: Testing virtual_network_name: vnet001 @@ -184,7 +184,7 @@ EXAMPLES = ''' public_ip_address_name: publicip001 - name: Delete network interface - azure_rm_networkinterface: + azure_rm_networkinterface: resource_group: Testing name: nic003 state: absent diff --git a/lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py b/lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py index 8d4d28d20f8..c919f6ac368 100644 --- a/lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py +++ b/lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py @@ -76,7 +76,7 @@ EXAMPLES = ''' # Note - You must set the CLC_V2_API_USERNAME And CLC_V2_API_PASSWD Environment variables before running these examples - name: Deploy package - clc_blueprint_package: + clc_blueprint_package: server_ids: - UC1TEST-SERVER1 - UC1TEST-SERVER2 diff --git a/lib/ansible/modules/cloud/cloudstack/cs_configuration.py b/lib/ansible/modules/cloud/cloudstack/cs_configuration.py index 696593550a5..058de9e55bd 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_configuration.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_configuration.py @@ -91,7 +91,7 @@ EXAMPLES = ''' # Ensure account configuration - local_action: - module: cs_configuration: + module: cs_configuration name: allow.public.user.templates value: false account: acme inc diff --git a/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py b/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py index 2724c58c71d..1ca4f66f4bb 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py @@ -84,7 +84,7 @@ EXAMPLES = ''' # register your existing local public key: - cs_sshkeypair: name: linus@example.com - public_key: '{{ lookup('file', '~/.ssh/id_rsa.pub') }}' + public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" delegate_to: localhost ''' diff --git a/lib/ansible/modules/cloud/docker/docker_image.py b/lib/ansible/modules/cloud/docker/docker_image.py index e720dbbf596..472c6273886 100644 --- a/lib/ansible/modules/cloud/docker/docker_image.py +++ b/lib/ansible/modules/cloud/docker/docker_image.py @@ -231,7 +231,7 @@ EXAMPLES = ''' load_path: my_sinatra.tar - name: Build image and with buildargs - docker_image: + docker_image: path: /path/to/build/dir name: myimage buildargs: diff --git a/lib/ansible/modules/cloud/google/gce.py b/lib/ansible/modules/cloud/google/gce.py index 298c724db39..6182bf45ce5 100644 --- a/lib/ansible/modules/cloud/google/gce.py +++ b/lib/ansible/modules/cloud/google/gce.py @@ -236,6 +236,7 @@ EXAMPLES = ''' credentials_file: "/path/to/your-key.json" project_id: "your-project-name" +--- # Example Playbook - name: Compute Engine Instance Examples hosts: localhost diff --git a/lib/ansible/modules/cloud/google/gcpubsub.py b/lib/ansible/modules/cloud/google/gcpubsub.py index 8d0c4136b8a..57240f25f03 100644 --- a/lib/ansible/modules/cloud/google/gcpubsub.py +++ b/lib/ansible/modules/cloud/google/gcpubsub.py @@ -91,10 +91,10 @@ gcpubsub: mykey2: myvalu2 mykey3: myvalue3 - message: "this is message 2" - attributes: - server: prod - sla: "99.9999" - owner: fred + attributes: + server: prod + sla: "99.9999" + owner: fred # Subscriptions ## Create Subscription (pull) diff --git a/lib/ansible/modules/cloud/misc/proxmox.py b/lib/ansible/modules/cloud/misc/proxmox.py index a6d428f92fb..7039438967d 100644 --- a/lib/ansible/modules/cloud/misc/proxmox.py +++ b/lib/ansible/modules/cloud/misc/proxmox.py @@ -286,7 +286,7 @@ EXAMPLES = ''' - proxmox: vmid: 100 api_user: root@pam - api_passwordL 1q2w3e + api_password: 1q2w3e api_host: node1 force: yes state: stopped diff --git a/lib/ansible/modules/cloud/misc/rhevm.py b/lib/ansible/modules/cloud/misc/rhevm.py index a2f6396fece..f720a0327ba 100644 --- a/lib/ansible/modules/cloud/misc/rhevm.py +++ b/lib/ansible/modules/cloud/misc/rhevm.py @@ -217,8 +217,7 @@ vm: EXAMPLES = ''' # basic get info from VM - action: rhevm - args: + - rhevm: name: "demo" user: "{{ rhev.admin.name }}" password: "{{ rhev.admin.pass }}" @@ -226,8 +225,7 @@ EXAMPLES = ''' state: "info" # basic create example from image - action: rhevm - args: + - rhevm: name: "demo" user: "{{ rhev.admin.name }}" password: "{{ rhev.admin.pass }}" @@ -237,8 +235,7 @@ EXAMPLES = ''' cluster: "centos" # power management - action: rhevm - args: + - rhevm: name: "uptime_server" user: "{{ rhev.admin.name }}" password: "{{ rhev.admin.pass }}" @@ -246,11 +243,10 @@ EXAMPLES = ''' cluster: "RH" state: "down" image: "centos7_x64" - cluster: "centos + cluster: "centos" # multi disk, multi nic create example - action: rhevm - args: + - rhevm: name: "server007" user: "{{ rhev.admin.name }}" password: "{{ rhev.admin.pass }}" @@ -290,23 +286,21 @@ EXAMPLES = ''' - "hd" # add a CD to the disk cd_drive - action: rhevm - args: - name: 'server007' - user: "{{ rhev.admin.name }}" - password: "{{ rhev.admin.pass }}" - state: 'cd' - cd_drive: 'rhev-tools-setup.iso' + - rhevm: + name: 'server007' + user: "{{ rhev.admin.name }}" + password: "{{ rhev.admin.pass }}" + state: 'cd' + cd_drive: 'rhev-tools-setup.iso' # new host deployment + host network configuration - action: rhevm - args: - name: "ovirt_node007" - password: "{{ rhevm.admin.pass }}" - type: "host" - state: present - cluster: "rhevm01" - ifaces: + - rhevm: + name: "ovirt_node007" + password: "{{ rhevm.admin.pass }}" + type: "host" + state: present + cluster: "rhevm01" + ifaces: - name: em1 - name: em2 - name: p3p1 diff --git a/lib/ansible/modules/cloud/misc/virt.py b/lib/ansible/modules/cloud/misc/virt.py index 4227aae43f3..80801c44718 100644 --- a/lib/ansible/modules/cloud/misc/virt.py +++ b/lib/ansible/modules/cloud/misc/virt.py @@ -75,17 +75,18 @@ EXAMPLES = ''' state: running # /usr/bin/ansible invocations -ansible host -m virt -a "name=alpha command=status" -ansible host -m virt -a "name=alpha command=get_xml" -ansible host -m virt -a "name=alpha command=create uri=lxc:///" +# ansible host -m virt -a "name=alpha command=status" +# ansible host -m virt -a "name=alpha command=get_xml" +# ansible host -m virt -a "name=alpha command=create uri=lxc:///" +--- # a playbook example of defining and launching an LXC guest tasks: - name: define vm virt: name: foo command: define - xml: '{{ lookup('template', 'container-template.xml.j2') }}' + xml: "{{ lookup('template', 'container-template.xml.j2') }}" uri: 'lxc:///' - name: start vm virt: diff --git a/lib/ansible/modules/cloud/misc/xenserver_facts.py b/lib/ansible/modules/cloud/misc/xenserver_facts.py index 947df0ec57e..04920fa91b9 100644 --- a/lib/ansible/modules/cloud/misc/xenserver_facts.py +++ b/lib/ansible/modules/cloud/misc/xenserver_facts.py @@ -34,10 +34,11 @@ options: {} EXAMPLES = ''' - name: Gather facts from xenserver - xenserver: + xenserver: - name: Print running VMs - debug: msg="{{ item }}" + debug: + msg: "{{ item }}" with_items: "{{ xs_vms.keys() }}" when: xs_vms[item]['power_state'] == "Running" diff --git a/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py b/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py index 01659846a45..c52e3abdc12 100644 --- a/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py +++ b/lib/ansible/modules/cloud/openstack/os_keystone_domain_facts.py @@ -58,7 +58,7 @@ EXAMPLES = ''' var: openstack_domains # Gather facts about a previously created domain with filter -- os_keystone_domain_facts +- os_keystone_domain_facts: cloud: awesomecloud name: demodomain filters: diff --git a/lib/ansible/modules/cloud/openstack/os_project_facts.py b/lib/ansible/modules/cloud/openstack/os_project_facts.py index b1cc30a5fec..a417bcea962 100644 --- a/lib/ansible/modules/cloud/openstack/os_project_facts.py +++ b/lib/ansible/modules/cloud/openstack/os_project_facts.py @@ -63,16 +63,15 @@ EXAMPLES = ''' var: openstack_projects # Gather facts about a previously created project in a specific domain -- os_project_facts +- os_project_facts: cloud: awesomecloud name: demoproject domain: admindomain - debug: var: openstack_projects -# Gather facts about a previously created project in a specific domain - with filter -- os_project_facts +# Gather facts about a previously created project in a specific domain with filter +- os_project_facts: cloud: awesomecloud name: demoproject domain: admindomain diff --git a/lib/ansible/modules/cloud/openstack/os_server.py b/lib/ansible/modules/cloud/openstack/os_server.py index 5857de0ee66..72ea9bbaa98 100644 --- a/lib/ansible/modules/cloud/openstack/os_server.py +++ b/lib/ansible/modules/cloud/openstack/os_server.py @@ -298,12 +298,12 @@ EXAMPLES = ''' 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: 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: @@ -336,7 +336,7 @@ EXAMPLES = ''' key_name: ansible_key timeout: 200 flavor: 4 - network: another_network + network: another_network # Create a new instance with 4G of RAM on a 75G Ubuntu Trusty volume - name: launch a compute instance diff --git a/lib/ansible/modules/cloud/openstack/os_stack.py b/lib/ansible/modules/cloud/openstack/os_stack.py index b3fb625bd32..907f4725e54 100644 --- a/lib/ansible/modules/cloud/openstack/os_stack.py +++ b/lib/ansible/modules/cloud/openstack/os_stack.py @@ -86,12 +86,12 @@ EXAMPLES = ''' bmc_flavor: m1.medium bmc_image: CentOS key_name: default - private_net: {{ private_net_param }} + private_net: "{{ private_net_param }}" node_count: 2 name: undercloud image: CentOS my_flavor: m1.large - external_net: {{ external_net_param }} + external_net: "{{ external_net_param }}" ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/openstack/os_user_facts.py b/lib/ansible/modules/cloud/openstack/os_user_facts.py index ac40625105d..6d9d145bf97 100644 --- a/lib/ansible/modules/cloud/openstack/os_user_facts.py +++ b/lib/ansible/modules/cloud/openstack/os_user_facts.py @@ -63,16 +63,15 @@ EXAMPLES = ''' var: openstack_users # Gather facts about a previously created user in a specific domain -- os_user_facts +- os_user_facts: cloud: awesomecloud name: demouser domain: admindomain - debug: var: openstack_users -# Gather facts about a previously created user in a specific domain - with filter -- os_user_facts +# Gather facts about a previously created user in a specific domain with filter +- os_user_facts: cloud: awesomecloud name: demouser domain: admindomain diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_auth.py b/lib/ansible/modules/cloud/ovirt/ovirt_auth.py index e7fc8290176..70cc10b6db4 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_auth.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_auth.py @@ -102,7 +102,7 @@ tasks: # oVirt user's password, and include that yaml file with variable: - include_vars: ovirt_password.yml - - name: Obtain SSO token with using username/password credentials: + - name: Obtain SSO token with using username/password credentials ovirt_auth: url: https://ovirt.example.com/ovirt-engine/api username: admin@internal @@ -116,11 +116,11 @@ tasks: state: absent name: myvm - always: - - name: Always revoke the SSO token - ovirt_auth: - state: absent - ovirt_auth: "{{ ovirt_auth }}" + always: + - name: Always revoke the SSO token + ovirt_auth: + state: absent + ovirt_auth: "{{ ovirt_auth }}" ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_snapshots.py b/lib/ansible/modules/cloud/ovirt/ovirt_snapshots.py index f98118fc110..0ed5bd91fe6 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_snapshots.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_snapshots.py @@ -73,14 +73,14 @@ EXAMPLES = ''' - ovirt_snapshots: vm_name: rhel7 description: MySnapshot -register: snapshot + register: snapshot # Create snapshot and save memory: - ovirt_snapshots: vm_name: rhel7 description: SnapWithMem use_memory: true -register: snapshot + register: snapshot # Restore snapshot: - ovirt_snapshots: diff --git a/lib/ansible/modules/cloud/vmware/vca_vapp.py b/lib/ansible/modules/cloud/vmware/vca_vapp.py index 4ebdda24d6c..9a8883e1627 100644 --- a/lib/ansible/modules/cloud/vmware/vca_vapp.py +++ b/lib/ansible/modules/cloud/vmware/vca_vapp.py @@ -137,12 +137,12 @@ EXAMPLES = ''' - name: Creates a new vApp in a VCA instance vca_vapp: vapp_name: tower - state=present - template_name='Ubuntu Server 12.04 LTS (amd64 20150127)' - vdc_name=VDC1 - instance_id= - username= - password= + state: present + template_name: 'Ubuntu Server 12.04 LTS (amd64 20150127)' + vdc_name: VDC1 + instance_id: '' + username: '' + password: '' ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_cluster.py b/lib/ansible/modules/cloud/vmware/vmware_cluster.py index 5fd986d52b0..b02e8740aff 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_cluster.py +++ b/lib/ansible/modules/cloud/vmware/vmware_cluster.py @@ -64,14 +64,16 @@ extends_documentation_fragment: vmware.documentation EXAMPLES = ''' # Example vmware_cluster command from Ansible Playbooks - name: Create Cluster - local_action: > - vmware_cluster - hostname="{{ ansible_ssh_host }}" username=root password=vmware - datacenter_name="datacenter" - cluster_name="cluster" - enable_ha=True - enable_drs=True - enable_vsan=True + local_action: + module: vmware_cluster + hostname: "{{ ansible_ssh_host }}" + username: root + password: vmware + datacenter_name: "datacenter" + cluster_name: "cluster" + enable_ha: True + enable_drs: True + enable_vsan: True ''' try: diff --git a/lib/ansible/modules/cloud/vmware/vmware_datacenter.py b/lib/ansible/modules/cloud/vmware/vmware_datacenter.py index fb60f2c9f5c..670f454b974 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_datacenter.py +++ b/lib/ansible/modules/cloud/vmware/vmware_datacenter.py @@ -65,10 +65,13 @@ extends_documentation_fragment: vmware.documentation EXAMPLES = ''' # Example vmware_datacenter command from Ansible Playbooks - name: Create Datacenter - local_action: > - vmware_datacenter - hostname="{{ ansible_ssh_host }}" username=root password=vmware - datacenter_name="datacenter" state=present + local_action: + module: vmware_datacenter + hostname: "{{ ansible_ssh_host }}" + username: root + password: vmware + datacenter_name: "datacenter" + state: present ''' try: diff --git a/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py b/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py index 58b4cff67c7..5ee8b3365e2 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py +++ b/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py @@ -65,7 +65,7 @@ extends_documentation_fragment: vmware.documentation EXAMPLES = ''' - name: Create Management portgroup - local_action: + local_action: module: vmware_dvs_portgroup hostname: vcenter_ip_or_hostname username: vcenter_username diff --git a/lib/ansible/modules/cloud/vmware/vmware_host.py b/lib/ansible/modules/cloud/vmware/vmware_host.py index 22cb82d55db..0e10f3f65cd 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host.py @@ -68,7 +68,7 @@ extends_documentation_fragment: vmware.documentation ''' EXAMPLES = ''' -Example from Ansible playbook +# Example from Ansible playbook - name: Add ESXi Host to VCSA local_action: diff --git a/lib/ansible/modules/cloud/vmware/vmware_migrate_vmk.py b/lib/ansible/modules/cloud/vmware/vmware_migrate_vmk.py index 730102c2049..d98986be350 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_migrate_vmk.py +++ b/lib/ansible/modules/cloud/vmware/vmware_migrate_vmk.py @@ -64,7 +64,7 @@ extends_documentation_fragment: vmware.documentation ''' EXAMPLES = ''' -Example from Ansible playbook +# Example from Ansible playbook - name: Migrate Management vmk local_action: diff --git a/lib/ansible/modules/cloud/vmware/vmware_portgroup.py b/lib/ansible/modules/cloud/vmware/vmware_portgroup.py index 089d584d039..dee8a0c6d11 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_portgroup.py +++ b/lib/ansible/modules/cloud/vmware/vmware_portgroup.py @@ -60,7 +60,7 @@ extends_documentation_fragment: vmware.documentation ''' EXAMPLES = ''' -Example from Ansible playbook +# Example from Ansible playbook - name: Add Management Network VM Portgroup local_action: diff --git a/lib/ansible/modules/cloud/vmware/vmware_target_canonical_facts.py b/lib/ansible/modules/cloud/vmware/vmware_target_canonical_facts.py index 817d736d3ae..c1051675baf 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_target_canonical_facts.py +++ b/lib/ansible/modules/cloud/vmware/vmware_target_canonical_facts.py @@ -45,10 +45,12 @@ extends_documentation_fragment: vmware.documentation EXAMPLES = ''' # Example vmware_target_canonical_facts command from Ansible Playbooks - name: Get Canonical name - local_action: > - vmware_target_canonical_facts - hostname="{{ ansible_ssh_host }}" username=root password=vmware - target_id=7 + local_action: + module: vmware_target_canonical_facts + hostname: "{{ ansible_ssh_host }}" + username: root + password: vmware + target_id: 7 ''' try: diff --git a/lib/ansible/modules/cloud/vmware/vmware_vmotion.py b/lib/ansible/modules/cloud/vmware/vmware_vmotion.py index 0ceaf597879..fed94611af2 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vmotion.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vmotion.py @@ -51,7 +51,7 @@ extends_documentation_fragment: vmware.documentation ''' EXAMPLES = ''' -Example from Ansible playbook +# Example from Ansible playbook - name: Perform vMotion of VM local_action: diff --git a/lib/ansible/modules/cloud/vmware/vmware_vswitch.py b/lib/ansible/modules/cloud/vmware/vmware_vswitch.py index bae7eba97b9..0b39a03dcde 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vswitch.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vswitch.py @@ -65,7 +65,7 @@ extends_documentation_fragment: vmware.documentation ''' EXAMPLES = ''' -Example from Ansible playbook +# Example from Ansible playbook - name: Add a VMware vSwitch local_action: diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py index 3c119c3fcb7..e444b361dd9 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py @@ -153,6 +153,7 @@ requirements: EXAMPLES = ''' +--- # Create a new VM on an ESX server # Returns changed = False when the VM already exists # Returns changed = True and a adds ansible_facts from the new VM @@ -258,7 +259,7 @@ EXAMPLES = ''' guest: newvm001 vmware_guest_facts: yes - +--- # Typical output of a vsphere_facts run on a guest # If vmware tools is not installed, ipadresses with return None @@ -277,22 +278,22 @@ EXAMPLES = ''' hw_processor_count: 2 hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac" -hw_power_status will be one of the following values: - - POWERED ON - - POWERED OFF - - SUSPENDED - - POWERING ON - - POWERING OFF - - SUSPENDING - - RESETTING - - BLOCKED ON MSG - - REVERTING TO SNAPSHOT - - UNKNOWN -as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq +# hw_power_status will be one of the following values: +# - POWERED ON +# - POWERED OFF +# - SUSPENDED +# - POWERING ON +# - POWERING OFF +# - SUSPENDING +# - RESETTING +# - BLOCKED ON MSG +# - REVERTING TO SNAPSHOT +# - UNKNOWN +# as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq +--- # Remove a vm from vSphere # The VM must be powered_off or you need to use force to force a shutdown - - vsphere_guest: vcenter_hostname: vcenter.mydomain.local username: myuser diff --git a/lib/ansible/modules/commands/raw.py b/lib/ansible/modules/commands/raw.py index 041d89b99c5..0e9991196b2 100644 --- a/lib/ansible/modules/commands/raw.py +++ b/lib/ansible/modules/commands/raw.py @@ -76,5 +76,5 @@ EXAMPLES = ''' executable: /bin/bash - name: safely use templated variables. Always use quote filter to avoid injection issues. - raw: {{package_mgr|quote}} {{pkg_flags|quote}} install {{python_simplejson|quote}} + raw: "{{package_mgr|quote}} {{pkg_flags|quote}} install {{python_simplejson|quote}}" ''' diff --git a/lib/ansible/modules/database/influxdb/influxdb_database.py b/lib/ansible/modules/database/influxdb/influxdb_database.py index 2e1245850da..0030694a23c 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_database.py +++ b/lib/ansible/modules/database/influxdb/influxdb_database.py @@ -67,19 +67,19 @@ options: EXAMPLES = ''' # Example influxdb_database command from Ansible Playbooks - name: Create database - influxdb_database: + influxdb_database: hostname: "{{influxdb_ip_address}}" database_name: "{{influxdb_database_name}}" state: present - name: Destroy database - influxdb_database: + influxdb_database: hostname: "{{influxdb_ip_address}}" database_name: "{{influxdb_database_name}}" state: absent - name: Create database using custom credentials - influxdb_database: + influxdb_database: hostname: "{{influxdb_ip_address}}" username: "{{influxdb_username}}" password: "{{influxdb_password}}" diff --git a/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py b/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py index 7541b3dfd0d..68b8c9188cb 100644 --- a/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py +++ b/lib/ansible/modules/database/influxdb/influxdb_retention_policy.py @@ -77,7 +77,7 @@ options: EXAMPLES = ''' # Example influxdb_retention_policy command from Ansible Playbooks - name: create 1 hour retention policy - influxdb_retention_policy: + influxdb_retention_policy: hostname: "{{influxdb_ip_address}}" database_name: "{{influxdb_database_name}}" policy_name: test @@ -85,7 +85,7 @@ EXAMPLES = ''' replication: 1 - name: create 1 day retention policy - influxdb_retention_policy: + influxdb_retention_policy: hostname: "{{influxdb_ip_address}}" database_name: "{{influxdb_database_name}}" policy_name: test @@ -93,7 +93,7 @@ EXAMPLES = ''' replication: 1 - name: create 1 week retention policy - influxdb_retention_policy: + influxdb_retention_policy: hostname: "{{influxdb_ip_address}}" database_name: "{{influxdb_database_name}}" policy_name: test @@ -101,7 +101,7 @@ EXAMPLES = ''' replication: 1 - name: create infinite retention policy - influxdb_retention_policy: + influxdb_retention_policy: hostname: "{{influxdb_ip_address}}" database_name: "{{influxdb_database_name}}" policy_name: test diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py index 20f76757535..f4db31162b7 100644 --- a/lib/ansible/modules/database/mysql/mysql_user.py +++ b/lib/ansible/modules/database/mysql/mysql_user.py @@ -183,7 +183,7 @@ EXAMPLES = """ state: present # Example privileges string format -mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL +# mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL # Example using login_unix_socket to connect to server - mysql_user: @@ -200,10 +200,9 @@ mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL sql_log_bin: no # Example .my.cnf file for setting the root password - -[client] -user=root -password=n<_665{vS43y +# [client] +# user=root +# password=n<_665{vS43y """ import getpass diff --git a/lib/ansible/modules/database/postgresql/postgresql_user.py b/lib/ansible/modules/database/postgresql/postgresql_user.py index 9b166fd5b69..13b6c6b9df4 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_user.py +++ b/lib/ansible/modules/database/postgresql/postgresql_user.py @@ -189,7 +189,7 @@ EXAMPLES = ''' state: absent # Example privileges string format -INSERT,UPDATE/table:SELECT/anothertable:ALL +# INSERT,UPDATE/table:SELECT/anothertable:ALL # Remove an existing user's password - postgresql_user: diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index ce2585c8888..f814f2e396f 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -244,7 +244,7 @@ EXAMPLES = ''' links: yes # Synchronization of two paths both on the control machine -- synchronize +- synchronize: src: some/relative/path dest: /some/absolute/path delegate_to: localhost @@ -282,9 +282,9 @@ EXAMPLES = ''' rsync_path: "su -c rsync" # Example .rsync-filter file in the source directory -- var # exclude any path whose last part is 'var' -- /var # exclude any path starting with 'var' starting at the source directory -+ /var/conf # include /var/conf even though it was previously excluded +# - var # exclude any path whose last part is 'var' +# - /var # exclude any path starting with 'var' starting at the source directory +# + /var/conf # include /var/conf even though it was previously excluded # Synchronize passing in extra rsync options - synchronize: diff --git a/lib/ansible/modules/monitoring/bigpanda.py b/lib/ansible/modules/monitoring/bigpanda.py index 90b37841526..cf67e535ce1 100644 --- a/lib/ansible/modules/monitoring/bigpanda.py +++ b/lib/ansible/modules/monitoring/bigpanda.py @@ -88,7 +88,7 @@ EXAMPLES = ''' version: '1.3' token: '{{ bigpanda_token }}' state: started -... + - bigpanda: component: myapp version: '1.3' @@ -104,7 +104,7 @@ EXAMPLES = ''' state: started delegate_to: localhost register: deployment -... + - bigpanda: component: '{{ deployment.component }}' version: '{{ deployment.version }}' diff --git a/lib/ansible/modules/monitoring/datadog_monitor.py b/lib/ansible/modules/monitoring/datadog_monitor.py index 2c3c3bd9af5..35882f1c9cd 100644 --- a/lib/ansible/modules/monitoring/datadog_monitor.py +++ b/lib/ansible/modules/monitoring/datadog_monitor.py @@ -122,7 +122,7 @@ datadog_monitor: type: "metric alert" name: "Test monitor" state: "present" - query: "datadog.agent.up".over("host:host1").last(2).count_by_status()" + query: "datadog.agent.up.over('host:host1').last(2).count_by_status()" message: "Host [[host.name]] with IP [[host.ip]] is failing to report to datadog." api_key: "9775a026f1ca7d1c6c5af9d94d9595a4" app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff" diff --git a/lib/ansible/modules/monitoring/logicmonitor.py b/lib/ansible/modules/monitoring/logicmonitor.py index cd0e6f824b9..2507da59971 100644 --- a/lib/ansible/modules/monitoring/logicmonitor.py +++ b/lib/ansible/modules/monitoring/logicmonitor.py @@ -230,7 +230,7 @@ EXAMPLES = ''' tasks: - name: Create a host group # All tasks except for target=collector should use delegate_to: localhost - logicmonitor + logicmonitor: target: hostgroup action: add fullpath: /servers/development diff --git a/lib/ansible/modules/network/asa/asa_acl.py b/lib/ansible/modules/network/asa/asa_acl.py index de00ad43f04..cdb4bd63520 100644 --- a/lib/ansible/modules/network/asa/asa_acl.py +++ b/lib/ansible/modules/network/asa/asa_acl.py @@ -102,6 +102,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -111,6 +112,7 @@ vars: authorize: yes auth_pass: cisco +--- - asa_acl: lines: - access-list ACL-ANSIBLE extended permit tcp any any eq 82 @@ -127,7 +129,7 @@ vars: lines: - access-list ACL-OUTSIDE extended permit tcp any any eq www - access-list ACL-OUTSIDE extended permit tcp any any eq https - context: customer_a + context: customer_a provider: "{{ cli }}" """ diff --git a/lib/ansible/modules/network/asa/asa_command.py b/lib/ansible/modules/network/asa/asa_command.py index 0dbecf946db..df55ccdc75d 100644 --- a/lib/ansible/modules/network/asa/asa_command.py +++ b/lib/ansible/modules/network/asa/asa_command.py @@ -84,6 +84,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -93,7 +94,7 @@ vars: auth_pass: cisco transport: cli - +--- - asa_command: commands: - show version diff --git a/lib/ansible/modules/network/asa/asa_config.py b/lib/ansible/modules/network/asa/asa_config.py index ffd082684ec..b308bd4eb29 100644 --- a/lib/ansible/modules/network/asa/asa_config.py +++ b/lib/ansible/modules/network/asa/asa_config.py @@ -172,6 +172,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -181,6 +182,7 @@ vars: auth_pass: cisco transport: cli +--- - asa_config: lines: - network-object host 10.80.30.18 diff --git a/lib/ansible/modules/network/bigswitch/bigmon_chain.py b/lib/ansible/modules/network/bigswitch/bigmon_chain.py index 35c7b897d77..8b28d142677 100755 --- a/lib/ansible/modules/network/bigswitch/bigmon_chain.py +++ b/lib/ansible/modules/network/bigswitch/bigmon_chain.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Ansible module to manage Big Monitoring Fabric service chains -# (c) 2016, Ted Elhourani +# (c) 2016, Ted Elhourani , # # This file is part of Ansible # @@ -59,11 +59,11 @@ options: EXAMPLES = ''' - name: bigmon inline service chain - bigmon_chain: - name: MyChain - controller: '{{ inventory_hostname }}' - state: present - validate_certs: false + bigmon_chain: + name: MyChain + controller: '{{ inventory_hostname }}' + state: present + validate_certs: false ''' diff --git a/lib/ansible/modules/network/bigswitch/bigmon_policy.py b/lib/ansible/modules/network/bigswitch/bigmon_policy.py index 15fad032c15..dcf38777a11 100755 --- a/lib/ansible/modules/network/bigswitch/bigmon_policy.py +++ b/lib/ansible/modules/network/bigswitch/bigmon_policy.py @@ -84,13 +84,13 @@ options: EXAMPLES = ''' - name: policy to aggregate filter and deliver data center (DC) 1 traffic - bigmon_policy: - name: policy1 - policy_description: DC 1 traffic policy - action: drop - controller: '{{ inventory_hostname }}' - state: present - validate_certs: false + bigmon_policy: + name: policy1 + policy_description: DC 1 traffic policy + action: drop + controller: '{{ inventory_hostname }}' + state: present + validate_certs: false ''' RETURN = ''' diff --git a/lib/ansible/modules/network/cloudengine/ce_command.py b/lib/ansible/modules/network/cloudengine/ce_command.py index 367913b5068..699ca205873 100644 --- a/lib/ansible/modules/network/cloudengine/ce_command.py +++ b/lib/ansible/modules/network/cloudengine/ce_command.py @@ -84,6 +84,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -91,6 +92,7 @@ vars: password: admin transport: cli +--- - name: run display version on remote devices ce_command: commands: display version diff --git a/lib/ansible/modules/network/cumulus/cl_bond.py b/lib/ansible/modules/network/cumulus/cl_bond.py index 60b26665616..a27be0eabf9 100644 --- a/lib/ansible/modules/network/cumulus/cl_bond.py +++ b/lib/ansible/modules/network/cumulus/cl_bond.py @@ -186,6 +186,7 @@ EXAMPLES = ''' # In vars file # ============ +--- cl_bonds: bond0: alias_name: uplink to isp diff --git a/lib/ansible/modules/network/cumulus/cl_bridge.py b/lib/ansible/modules/network/cumulus/cl_bridge.py index 642b78db624..0b635fb10f5 100644 --- a/lib/ansible/modules/network/cumulus/cl_bridge.py +++ b/lib/ansible/modules/network/cumulus/cl_bridge.py @@ -140,6 +140,7 @@ EXAMPLES = ''' # In vars file # ============ +--- cl_bridge: br0: alias_name: 'vlan aware bridge' diff --git a/lib/ansible/modules/network/cumulus/cl_interface.py b/lib/ansible/modules/network/cumulus/cl_interface.py index eb5304ed092..fcacd9bbeef 100644 --- a/lib/ansible/modules/network/cumulus/cl_interface.py +++ b/lib/ansible/modules/network/cumulus/cl_interface.py @@ -146,8 +146,8 @@ EXAMPLES = ''' # define cl_interfaces once in tasks # then write interfaces in variables file # with just the options you want. - - name: Create interfaces - cl_interface: +- name: Create interfaces + cl_interface: name: '{{ item.key }}' ipv4: '{{ item.value.ipv4 | default(omit) }}' ipv6: '{{ item.value.ipv6 | default(omit) }}' @@ -165,11 +165,12 @@ EXAMPLES = ''' 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 + with_dict: '{{ cl_interfaces }}' + notify: reload networking # In vars file # ============ +--- cl_interfaces: swp1: alias_name: uplink to isp diff --git a/lib/ansible/modules/network/cumulus/cl_interface_policy.py b/lib/ansible/modules/network/cumulus/cl_interface_policy.py index 597f11a3fc3..2c4211e4436 100644 --- a/lib/ansible/modules/network/cumulus/cl_interface_policy.py +++ b/lib/ansible/modules/network/cumulus/cl_interface_policy.py @@ -49,7 +49,7 @@ options: ''' EXAMPLES = ''' -Example playbook entries using the cl_interface_policy module. +# Example playbook entries using the cl_interface_policy module. - name: shows types of interface ranges supported cl_interface_policy: diff --git a/lib/ansible/modules/network/cumulus/cl_license.py b/lib/ansible/modules/network/cumulus/cl_license.py index 9316b580abe..fbad6a15621 100644 --- a/lib/ansible/modules/network/cumulus/cl_license.py +++ b/lib/ansible/modules/network/cumulus/cl_license.py @@ -78,7 +78,7 @@ EXAMPLES = ''' dest: /etc/network/interfaces notify: restart networking - handlers: + handlers: - name: restart switchd service: name: switchd @@ -89,10 +89,7 @@ EXAMPLES = ''' 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 ''' RETURN = ''' diff --git a/lib/ansible/modules/network/dellos10/dellos10_command.py b/lib/ansible/modules/network/dellos10/dellos10_command.py index 77e381c9117..64bfbe50b3a 100644 --- a/lib/ansible/modules/network/dellos10/dellos10_command.py +++ b/lib/ansible/modules/network/dellos10/dellos10_command.py @@ -97,7 +97,7 @@ tasks: provider: "{{ cli }}" - name: run multiple commands on remote nodes - dellos10_command: + dellos10_command: commands: - show version - show interface diff --git a/lib/ansible/modules/network/dellos6/dellos6_command.py b/lib/ansible/modules/network/dellos6/dellos6_command.py index dc7e56c51c5..6aa601af49d 100644 --- a/lib/ansible/modules/network/dellos6/dellos6_command.py +++ b/lib/ansible/modules/network/dellos6/dellos6_command.py @@ -87,20 +87,20 @@ tasks: - name: run show version on remote devices dellos6_command: commands: show version - provider "{{ cli }}" + provider: "{{ cli }}" - name: run show version and check to see if output contains Dell dellos6_command: commands: show version wait_for: result[0] contains Dell - provider "{{ cli }}" + provider: "{{ cli }}" - name: run multiple commands on remote nodes dellos6_command: commands: - show version - show interfaces - provider "{{ cli }}" + provider: "{{ cli }}" - name: run multiple commands and evaluate the output dellos6_command: @@ -110,7 +110,7 @@ tasks: wait_for: - result[0] contains Dell - result[1] contains Access - provider "{{ cli }}" + provider: "{{ cli }}" """ RETURN = """ diff --git a/lib/ansible/modules/network/dnsimple.py b/lib/ansible/modules/network/dnsimple.py index bb874303197..eeff2d0d387 100644 --- a/lib/ansible/modules/network/dnsimple.py +++ b/lib/ansible/modules/network/dnsimple.py @@ -136,7 +136,7 @@ EXAMPLES = ''' delegate_to: localhost # create a my.com CNAME record to example.com -- dnsimple +- dnsimple: domain: my.com record: '' type: CNAME diff --git a/lib/ansible/modules/network/eos/eos_command.py b/lib/ansible/modules/network/eos/eos_command.py index ecce61c8c41..b17514c1d0a 100644 --- a/lib/ansible/modules/network/eos/eos_command.py +++ b/lib/ansible/modules/network/eos/eos_command.py @@ -94,7 +94,7 @@ EXAMPLES = """ wait_for: result[0] contains Arista - name: run multiple commands on remote nodes - eos_command: + eos_command: commands: - show version - show interfaces diff --git a/lib/ansible/modules/network/eos/eos_system.py b/lib/ansible/modules/network/eos/eos_system.py index bd4d48be3ad..3f9cd04667a 100644 --- a/lib/ansible/modules/network/eos/eos_system.py +++ b/lib/ansible/modules/network/eos/eos_system.py @@ -104,7 +104,7 @@ EXAMPLES = """ lookup_source: Management1 - name: configure DNS lookup sources with VRF support - eos_system: + eos_system: lookup_source: - interface: Management1 vrf: mgmt diff --git a/lib/ansible/modules/network/f5/bigip_pool.py b/lib/ansible/modules/network/f5/bigip_pool.py index 58925640636..6a88aef7606 100644 --- a/lib/ansible/modules/network/f5/bigip_pool.py +++ b/lib/ansible/modules/network/f5/bigip_pool.py @@ -199,7 +199,7 @@ EXAMPLES = ''' state: "present" name: "my-pool" partition: "Common" - host: "{{ ansible_default_ipv4["address"] }}" + host: "{{ ansible_default_ipv4['address'] }}" port: 80 - name: Remove pool member from pool @@ -210,7 +210,7 @@ EXAMPLES = ''' state: "absent" name: "my-pool" partition: "Common" - host: "{{ ansible_default_ipv4["address"] }}" + host: "{{ ansible_default_ipv4['address'] }}" port: 80 - name: Delete pool diff --git a/lib/ansible/modules/network/f5/bigip_pool_member.py b/lib/ansible/modules/network/f5/bigip_pool_member.py index dcdf548df23..1d63592f3f6 100644 --- a/lib/ansible/modules/network/f5/bigip_pool_member.py +++ b/lib/ansible/modules/network/f5/bigip_pool_member.py @@ -132,7 +132,7 @@ EXAMPLES = ''' state: "present" pool: "my-pool" partition: "Common" - host: "{{ ansible_default_ipv4["address"] }}" + host: "{{ ansible_default_ipv4['address'] }}" port: 80 description: "web server" connection_limit: 100 @@ -148,7 +148,7 @@ EXAMPLES = ''' state: "present" pool: "my-pool" partition: "Common" - host: "{{ ansible_default_ipv4["address"] }}" + host: "{{ ansible_default_ipv4['address'] }}" port: 80 ratio: 1 description: "nginx server" @@ -162,7 +162,7 @@ EXAMPLES = ''' state: "absent" pool: "my-pool" partition: "Common" - host: "{{ ansible_default_ipv4["address"] }}" + host: "{{ ansible_default_ipv4['address'] }}" port: 80 delegate_to: localhost @@ -190,7 +190,7 @@ EXAMPLES = ''' monitor_state: "disabled" pool: "my-pool" partition: "Common" - host: "{{ ansible_default_ipv4["address"] }}" + host: "{{ ansible_default_ipv4['address'] }}" port: 80 delegate_to: localhost ''' diff --git a/lib/ansible/modules/network/ios/ios_facts.py b/lib/ansible/modules/network/ios/ios_facts.py index 28bea3e2e49..e0ce15c5638 100644 --- a/lib/ansible/modules/network/ios/ios_facts.py +++ b/lib/ansible/modules/network/ios/ios_facts.py @@ -49,6 +49,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -56,6 +57,7 @@ vars: password: cisco transport: cli +--- # Collect all facts from the device - ios_facts: gather_subset: all diff --git a/lib/ansible/modules/network/iosxr/iosxr_command.py b/lib/ansible/modules/network/iosxr/iosxr_command.py index e1248d68602..ce21df20955 100644 --- a/lib/ansible/modules/network/iosxr/iosxr_command.py +++ b/lib/ansible/modules/network/iosxr/iosxr_command.py @@ -95,7 +95,7 @@ tasks: wait_for: result[0] contains IOS-XR - name: run multiple commands on remote nodes - iosxr_command: + iosxr_command: commands: - show version - show interfaces diff --git a/lib/ansible/modules/network/junos/_junos_template.py b/lib/ansible/modules/network/junos/_junos_template.py index 448eabe45d3..923ed915d78 100644 --- a/lib/ansible/modules/network/junos/_junos_template.py +++ b/lib/ansible/modules/network/junos/_junos_template.py @@ -99,10 +99,12 @@ EXAMPLES = """ comment: update system config - name: replace config hierarchy + junos_template: src: config.j2 action: replace - name: overwrite the config + junos_template: src: config.j2 action: overwrite """ diff --git a/lib/ansible/modules/network/junos/junos_command.py b/lib/ansible/modules/network/junos/junos_command.py index eb681d3919e..ebe3dbbcb1c 100644 --- a/lib/ansible/modules/network/junos/junos_command.py +++ b/lib/ansible/modules/network/junos/junos_command.py @@ -110,12 +110,14 @@ notes: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: netconf: host: "{{ inventory_hostname }}" username: ansible password: Ansible +--- - name: run a set of commands junos_command: commands: ['show version', 'show ip route'] diff --git a/lib/ansible/modules/network/junos/junos_config.py b/lib/ansible/modules/network/junos/junos_config.py index b44f1c012c6..e3a3175c3b1 100644 --- a/lib/ansible/modules/network/junos/junos_config.py +++ b/lib/ansible/modules/network/junos/junos_config.py @@ -146,12 +146,14 @@ notes: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: netconf: host: "{{ inventory_hostname }}" username: ansible password: Ansible +--- - name: load configure file into device junos_config: src: srx.cfg diff --git a/lib/ansible/modules/network/junos/junos_netconf.py b/lib/ansible/modules/network/junos/junos_netconf.py index 11005bdd11d..f41cdccba05 100644 --- a/lib/ansible/modules/network/junos/junos_netconf.py +++ b/lib/ansible/modules/network/junos/junos_netconf.py @@ -58,6 +58,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -65,6 +66,7 @@ vars: password: Ansible transport: cli +--- - name: enable netconf service on port 830 junos_netconf: listens_on: 830 diff --git a/lib/ansible/modules/network/nmcli.py b/lib/ansible/modules/network/nmcli.py index 7e43c8ecc07..ac935460ed7 100644 --- a/lib/ansible/modules/network/nmcli.py +++ b/lib/ansible/modules/network/nmcli.py @@ -361,26 +361,26 @@ EXAMPLES=''' - '{{ nmcli_team_slave }}' ###### Working with all cloud nodes - Bonding - - name: try nmcli add bond - conn_name only & ip4 gw4 mode - nmcli: - type: bond - conn_name: '{{ item.conn_name }}' - ip4: '{{ item.ip4 }}' - gw4: '{{ item.gw4 }}' - mode: '{{ item.mode }}' - state: present - with_items: - - '{{ nmcli_bond }}' + - name: try nmcli add bond - conn_name only & ip4 gw4 mode + nmcli: + type: bond + conn_name: '{{ item.conn_name }}' + ip4: '{{ item.ip4 }}' + gw4: '{{ item.gw4 }}' + mode: '{{ item.mode }}' + state: present + with_items: + - '{{ nmcli_bond }}' - - name: try nmcli add bond-slave - nmcli: - type: bond-slave - conn_name: '{{ item.conn_name }}' - ifname: '{{ item.ifname }}' - master: '{{ item.master }}' - state: present - with_items: - - '{{ nmcli_bond_slave }}' + - name: try nmcli add bond-slave + nmcli: + type: bond-slave + conn_name: '{{ item.conn_name }}' + ifname: '{{ item.ifname }}' + master: '{{ item.master }}' + state: present + with_items: + - '{{ nmcli_bond_slave }}' ##### Working with all cloud nodes - Ethernet - name: nmcli add Ethernet - conn_name only & ip4 gw4 @@ -394,8 +394,6 @@ EXAMPLES=''' - '{{ nmcli_ethernet }}' ## playbook-del.yml example - ---- - hosts: openstack-stage remote_user: root tasks: diff --git a/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py b/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py index f18a3f9daa2..8639e20bda9 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py @@ -259,8 +259,8 @@ options: choices: ['present','absent'] ''' EXAMPLES = ''' -configure RR client -- nxos_bgp_neighbor_af: +- name: configure RR client + nxos_bgp_neighbor_af: asn: 65535 neighbor: '3.3.3.3' afi: ipv4 diff --git a/lib/ansible/modules/network/nxos/nxos_command.py b/lib/ansible/modules/network/nxos/nxos_command.py index 5daeb442fb3..7d0a9ea8c4a 100644 --- a/lib/ansible/modules/network/nxos/nxos_command.py +++ b/lib/ansible/modules/network/nxos/nxos_command.py @@ -91,6 +91,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -98,6 +99,7 @@ vars: password: admin transport: cli +--- - name: run show version on remote devices nxos_command: commands: show version @@ -110,7 +112,7 @@ vars: provider: "{{ cli }}" - name: run multiple commands on remote nodes - nxos_command: + nxos_command: commands: - show version - show interfaces diff --git a/lib/ansible/modules/network/nxos/nxos_config.py b/lib/ansible/modules/network/nxos/nxos_config.py index fbb3ed7751a..5987e33d329 100644 --- a/lib/ansible/modules/network/nxos/nxos_config.py +++ b/lib/ansible/modules/network/nxos/nxos_config.py @@ -164,6 +164,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -171,6 +172,7 @@ vars: password: admin transport: cli +--- - name: configure top level configuration and save it nxos_config: lines: hostname {{ inventory_hostname }} diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index 4e1d4f1ebb8..b9a7dc51120 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -53,6 +53,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -60,6 +61,7 @@ vars: password: admin transport: cli +--- - nxos_facts: gather_subset: all diff --git a/lib/ansible/modules/network/nxos/nxos_install_os.py b/lib/ansible/modules/network/nxos/nxos_install_os.py index 59640dc8df9..8f489e1b458 100644 --- a/lib/ansible/modules/network/nxos/nxos_install_os.py +++ b/lib/ansible/modules/network/nxos/nxos_install_os.py @@ -68,33 +68,33 @@ EXAMPLES = ''' username: "{{ un }}" password: "{{ pwd }}" transport: nxapi - rescue: - - name: Wait for device to perform checks - wait_for: - port: 22 - state: stopped - timeout: 300 - delay: 60 - host: "{{ inventory_hostname }}" - - name: Wait for device to come back up - wait_for: - port: 22 - state: started - timeout: 300 - delay: 60 - host: "{{ inventory_hostname }}" - - name: Check installed OS - nxos_command: - commands: - - show version - username: "{{ un }}" - password: "{{ pwd }}" - host: "{{ inventory_hostname }}" - transport: nxapi - register: output - - assert: - that: - - output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I4(1)' + rescue: + - name: Wait for device to perform checks + wait_for: + port: 22 + state: stopped + timeout: 300 + delay: 60 + host: "{{ inventory_hostname }}" + - name: Wait for device to come back up + wait_for: + port: 22 + state: started + timeout: 300 + delay: 60 + host: "{{ inventory_hostname }}" + - name: Check installed OS + nxos_command: + commands: + - show version + username: "{{ un }}" + password: "{{ pwd }}" + host: "{{ inventory_hostname }}" + transport: nxapi + register: output + - assert: + that: + - output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I4(1)' ''' RETURN = ''' diff --git a/lib/ansible/modules/network/nxos/nxos_interface.py b/lib/ansible/modules/network/nxos/nxos_interface.py index 93532df3fca..bd20190c162 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_interface.py @@ -89,48 +89,49 @@ options: ''' EXAMPLES = ''' -- name Ensure an interface is a Layer 3 port and that it has the proper description +- name: Ensure an interface is a Layer 3 port and that it has the proper description nxos_interface: interface: Ethernet1/1 description: 'Configured by Ansible' mode: layer3 host: 68.170.147.165 -- name Admin down an interface +- name: Admin down an interface nxos_interface: interface: Ethernet2/1 host: 68.170.147.165 admin_state: down -- name Remove all loopback interfaces +- name: Remove all loopback interfaces nxos_interface: interface: loopback state: absent host: 68.170.147.165 -- name Remove all logical interfaces +- name: Remove all logical interfaces nxos_interface: interface_type: "{{ item }} " state: absent host: "{{ inventory_hostname }}" - with_items: - loopback - portchannel - svi - nve -- name Admin up all ethernet interfaces + +- name: Admin up all ethernet interfaces nxos_interface: interface: ethernet host: 68.170.147.165 admin_state: up -- name Admin down ALL interfaces (physical and logical) +- name: Admin down ALL interfaces (physical and logical) nxos_interface: interface: all host: 68.170.147.165 admin_state: down ''' + RETURN = ''' proposed: description: k/v pairs of parameters passed into module diff --git a/lib/ansible/modules/network/openswitch/_ops_template.py b/lib/ansible/modules/network/openswitch/_ops_template.py index b6675980b94..2b826cc5c61 100644 --- a/lib/ansible/modules/network/openswitch/_ops_template.py +++ b/lib/ansible/modules/network/openswitch/_ops_template.py @@ -76,14 +76,14 @@ options: EXAMPLES = """ - name: set hostname with file lookup - ops_template: + ops_template: src: ./hostname.json backup: yes remote_user: admin become: yes - name: set hostname with var - ops_template: + ops_template: src: "{{ config }}" remote_user: admin become: yes diff --git a/lib/ansible/modules/network/openswitch/ops_command.py b/lib/ansible/modules/network/openswitch/ops_command.py index 78bae0a48d5..903a691273b 100644 --- a/lib/ansible/modules/network/openswitch/ops_command.py +++ b/lib/ansible/modules/network/openswitch/ops_command.py @@ -85,6 +85,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -92,6 +93,7 @@ vars: password: netop transport: cli +--- - ops_command: commands: - show version diff --git a/lib/ansible/modules/network/openswitch/ops_config.py b/lib/ansible/modules/network/openswitch/ops_config.py index 64d67c53994..7431be34b93 100644 --- a/lib/ansible/modules/network/openswitch/ops_config.py +++ b/lib/ansible/modules/network/openswitch/ops_config.py @@ -139,12 +139,14 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" username: netop password: netop +--- - name: configure hostname over cli ops_config: lines: diff --git a/lib/ansible/modules/network/openswitch/ops_facts.py b/lib/ansible/modules/network/openswitch/ops_facts.py index cbf31bc87e7..37e753d8f32 100644 --- a/lib/ansible/modules/network/openswitch/ops_facts.py +++ b/lib/ansible/modules/network/openswitch/ops_facts.py @@ -73,6 +73,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -85,6 +86,7 @@ vars: password: netop transport: rest +--- - ops_facts: gather_subset: all provider: "{{ rest }}" diff --git a/lib/ansible/modules/network/sros/sros_command.py b/lib/ansible/modules/network/sros/sros_command.py index 3c7dd21e203..c91fff360e9 100644 --- a/lib/ansible/modules/network/sros/sros_command.py +++ b/lib/ansible/modules/network/sros/sros_command.py @@ -85,6 +85,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -92,6 +93,7 @@ vars: password: admin transport: cli +--- tasks: - name: run show version on remote devices sros_command: @@ -105,7 +107,7 @@ tasks: provider: "{{ cli }}" - name: run multiple commands on remote nodes - sros_command: + sros_command: commands: - show version - show port detail diff --git a/lib/ansible/modules/network/sros/sros_config.py b/lib/ansible/modules/network/sros/sros_config.py index 2efca84dc12..8631e66130a 100644 --- a/lib/ansible/modules/network/sros/sros_config.py +++ b/lib/ansible/modules/network/sros/sros_config.py @@ -160,6 +160,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -167,19 +168,20 @@ vars: password: admin transport: cli +--- - name: enable rollback location - sros_config: + sros_config: lines: configure system rollback rollback-location "cf3:/ansible" provider: "{{ cli }}" - name: set system name to {{ inventory_hostname }} using one line - sros_config: + sros_config: lines: - configure system name "{{ inventory_hostname }}" provider: "{{ cli }}" - name: set system name to {{ inventory_hostname }} using parents - sros_config: + sros_config: lines: - 'name "{{ inventory_hostname }}"' parents: @@ -189,7 +191,7 @@ vars: backup: yes - name: load config from file - sros_config: + sros_config: src: "{{ inventory_hostname }}.cfg" provider: "{{ cli }}" save: yes diff --git a/lib/ansible/modules/network/sros/sros_rollback.py b/lib/ansible/modules/network/sros/sros_rollback.py index bcb4832618d..843021bb5ee 100644 --- a/lib/ansible/modules/network/sros/sros_rollback.py +++ b/lib/ansible/modules/network/sros/sros_rollback.py @@ -79,6 +79,7 @@ options: EXAMPLES = """ # Note: examples below use the following provider dict to handle # transport and authentication to the node. +--- vars: cli: host: "{{ inventory_hostname }}" @@ -86,6 +87,7 @@ vars: password: admin transport: cli +--- - name: configure rollback location sros_rollback: rollback_location: "cb3:/ansible" diff --git a/lib/ansible/modules/notification/jabber.py b/lib/ansible/modules/notification/jabber.py index f68790fb296..8c374faf9cd 100644 --- a/lib/ansible/modules/notification/jabber.py +++ b/lib/ansible/modules/notification/jabber.py @@ -84,7 +84,7 @@ EXAMPLES = ''' msg: Ansible task finished # send a message, specifying the host and port -- jabber +- jabber: user: mybot@example.net host: talk.example.net port: 5223 diff --git a/lib/ansible/modules/notification/mqtt.py b/lib/ansible/modules/notification/mqtt.py index 78b0b6e921f..201834fbf65 100644 --- a/lib/ansible/modules/notification/mqtt.py +++ b/lib/ansible/modules/notification/mqtt.py @@ -119,7 +119,7 @@ author: "Jan-Piet Mens (@jpmens)" ''' EXAMPLES = ''' -- mqtt: +- mqtt: topic: 'service/ansible/{{ ansible_hostname }}' payload: 'Hello at {{ ansible_date_time.iso8601 }}' qos: 0 diff --git a/lib/ansible/modules/notification/sendgrid.py b/lib/ansible/modules/notification/sendgrid.py index 63da5a7fcdc..260a351d14d 100644 --- a/lib/ansible/modules/notification/sendgrid.py +++ b/lib/ansible/modules/notification/sendgrid.py @@ -124,7 +124,7 @@ EXAMPLES = ''' delegate_to: localhost # send an email to more than one recipient that the build failed -- sendgrid +- sendgrid: username: "{{ sendgrid_username }}" password: "{{ sendgrid_password }}" from_address: "build@mycompany.com" diff --git a/lib/ansible/modules/notification/slack.py b/lib/ansible/modules/notification/slack.py index d004c48e400..1a59f65bb09 100644 --- a/lib/ansible/modules/notification/slack.py +++ b/lib/ansible/modules/notification/slack.py @@ -162,7 +162,7 @@ EXAMPLES = """ title: System load fields: - title: System A - value: load average: 0,74, 0,66, 0,63" + value: "load average: 0,74, 0,66, 0,63" short: True - title: System B value: 'load average: 5,16, 4,64, 2,43' diff --git a/lib/ansible/modules/notification/telegram.py b/lib/ansible/modules/notification/telegram.py index 57746cf06ae..d940b8166f9 100644 --- a/lib/ansible/modules/notification/telegram.py +++ b/lib/ansible/modules/notification/telegram.py @@ -54,8 +54,8 @@ options: EXAMPLES = """ -send a message to chat in playbook -- telegram: +- name: send a message to chat in playbook + telegram: token: 'bot9999999:XXXXXXXXXXXXXXXXXXXXXXX' chat_id: 000000 msg: Ansible task finished diff --git a/lib/ansible/modules/packaging/language/bower.py b/lib/ansible/modules/packaging/language/bower.py index b9c57f2bdac..5ae6b251069 100644 --- a/lib/ansible/modules/packaging/language/bower.py +++ b/lib/ansible/modules/packaging/language/bower.py @@ -76,7 +76,7 @@ EXAMPLES = ''' name: bootstrap - name: Install "bootstrap" bower package on version 3.1.1. - bower: + bower: name: bootstrap version: '3.1.1' diff --git a/lib/ansible/modules/packaging/language/npm.py b/lib/ansible/modules/packaging/language/npm.py index b1df88e60a2..16a87a34dda 100644 --- a/lib/ansible/modules/packaging/language/npm.py +++ b/lib/ansible/modules/packaging/language/npm.py @@ -81,44 +81,44 @@ options: ''' EXAMPLES = ''' -description: Install "coffee-script" node.js package. -- npm: +- name: Install "coffee-script" node.js package. + npm: name: coffee-script path: /app/location -description: Install "coffee-script" node.js package on version 1.6.1. -- npm: +- name: Install "coffee-script" node.js package on version 1.6.1. + npm: name: coffee-script version: '1.6.1' path: /app/location -description: Install "coffee-script" node.js package globally. -- npm: +- name: Install "coffee-script" node.js package globally. + npm: name: coffee-script global: yes -description: Remove the globally package "coffee-script". -- npm: +- name: Remove the globally package "coffee-script". + npm: name: coffee-script global: yes state: absent -description: Install "coffee-script" node.js package from custom registry. -- npm: +- name: Install "coffee-script" node.js package from custom registry. + npm: name: coffee-script registry: 'http://registry.mysite.com' -description: Install packages based on package.json. -- npm: +- name: Install packages based on package.json. + npm: path: /app/location -description: Update packages based on package.json to their latest version. -- npm: +- name: Update packages based on package.json to their latest version. + npm: path: /app/location state: latest -description: Install packages based on package.json using the npm installed with nvm v0.10.1. -- npm: +- name: Install packages based on package.json using the npm installed with nvm v0.10.1. + npm: path: /app/location executable: /opt/nvm/v0.10.1/bin/npm state: present diff --git a/lib/ansible/modules/packaging/os/sorcery.py b/lib/ansible/modules/packaging/os/sorcery.py index 5b31e78d8cc..8e23d861e42 100644 --- a/lib/ansible/modules/packaging/os/sorcery.py +++ b/lib/ansible/modules/packaging/os/sorcery.py @@ -128,8 +128,8 @@ EXAMPLES = ''' # Playbook: make sure spells with/without required dependencies (if any) are installed - sorcery: - name: {{ item.spell }} - depends: {{ item.depends | default(None) }} + name: "{{ item.spell }}" + depends: "{{ item.depends | default(None) }}" state: present with_items: - { spell: 'vifm', depends: '+file,-gtk+2' } diff --git a/lib/ansible/modules/packaging/os/zypper_repository.py b/lib/ansible/modules/packaging/os/zypper_repository.py index 879d9807c2f..185272b74bb 100644 --- a/lib/ansible/modules/packaging/os/zypper_repository.py +++ b/lib/ansible/modules/packaging/os/zypper_repository.py @@ -145,7 +145,7 @@ EXAMPLES = ''' # Force refresh of a repository - zypper_repository: - repo: 'http://my_internal_ci_repo/repo + repo: 'http://my_internal_ci_repo/repo' name: my_ci_repo state: present runrefresh: yes diff --git a/lib/ansible/modules/remote_management/foreman/katello.py b/lib/ansible/modules/remote_management/foreman/katello.py index 4926e73a055..8725982d393 100644 --- a/lib/ansible/modules/remote_management/foreman/katello.py +++ b/lib/ansible/modules/remote_management/foreman/katello.py @@ -57,7 +57,8 @@ options: ''' EXAMPLES = ''' -Simple Example: +--- +# Simple Example: - name: "Create Product" local_action: @@ -69,9 +70,8 @@ Simple Example: params: name: "Centos 7" -Abstraction Example: - -katello.yml +# Abstraction Example: +# katello.yml --- - name: "{{ name }}" local_action: @@ -82,7 +82,7 @@ katello.yml entity: "{{ entity }}" params: "{{ params }}" -tasks.yml +# tasks.yml --- - include: katello.yml vars: diff --git a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py index afc6e340aaf..87e08fb5af7 100644 --- a/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py +++ b/lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py @@ -96,7 +96,7 @@ EXAMPLES = """ - name: Snapshot volume netapp_e_snapshot_volume: ssid: "{{ ssid }}" - api_url: "{{ netapp_api_url }}"/ + api_url: "{{ netapp_api_url }}/" api_username: "{{ netapp_api_username }}" api_password: "{{ netapp_api_password }}" state: present diff --git a/lib/ansible/modules/storage/zfs/zfs_facts.py b/lib/ansible/modules/storage/zfs/zfs_facts.py index 162b727beee..178273ce5d0 100644 --- a/lib/ansible/modules/storage/zfs/zfs_facts.py +++ b/lib/ansible/modules/storage/zfs/zfs_facts.py @@ -78,13 +78,19 @@ options: ''' EXAMPLES = ''' -name: Gather facts about ZFS dataset rpool/export/home -zfs_facts: dataset=rpool/export/home +- name: Gather facts about ZFS dataset rpool/export/home + zfs_facts: + dataset: rpool/export/home -name: Report space usage on ZFS filesystems under data/home -zfs_facts: name=data/home recurse=yes type=filesystem -debug: msg='ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.' -with_items: '{{ ansible_zfs_datasets }} +- name: Report space usage on ZFS filesystems under data/home + zfs_facts: + name: data/home + recurse: yes + type: filesystem + +- debug: + msg: 'ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.' + with_items: '{{ ansible_zfs_datasets }}' ''' RETURN = ''' diff --git a/lib/ansible/modules/system/crypttab.py b/lib/ansible/modules/system/crypttab.py index f957a51293a..a354a63bef4 100644 --- a/lib/ansible/modules/system/crypttab.py +++ b/lib/ansible/modules/system/crypttab.py @@ -91,7 +91,7 @@ EXAMPLES = ''' state: opts_present opts: discard with_items: '{{ ansible_mounts }}' - when: '/dev/mapper/luks-' in {{ item.device }} + when: "'/dev/mapper/luks-' in {{ item.device }}" ''' from ansible.module_utils.basic import * diff --git a/lib/ansible/modules/system/pamd.py b/lib/ansible/modules/system/pamd.py index dac74b34469..c115c3f6a35 100644 --- a/lib/ansible/modules/system/pamd.py +++ b/lib/ansible/modules/system/pamd.py @@ -136,7 +136,7 @@ EXAMPLES = """ control: required module_path: pam_faillock.so new_type: auth - new_control=sufficient + new_control: sufficient new_module_path: pam_faillock.so state: after diff --git a/lib/ansible/modules/system/setup.py b/lib/ansible/modules/system/setup.py index 5fa8c321e3d..28b7d8fcdda 100644 --- a/lib/ansible/modules/system/setup.py +++ b/lib/ansible/modules/system/setup.py @@ -92,28 +92,28 @@ author: EXAMPLES = """ # Display facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts). -ansible all -m setup --tree /tmp/facts +# ansible all -m setup --tree /tmp/facts # Display only facts regarding memory found by ansible on all hosts and output them. -ansible all -m setup -a 'filter=ansible_*_mb' +# ansible all -m setup -a 'filter=ansible_*_mb' # Display only facts returned by facter. -ansible all -m setup -a 'filter=facter_*' +# ansible all -m setup -a 'filter=facter_*' # Display only facts about certain interfaces. -ansible all -m setup -a 'filter=ansible_eth[0-2]' +# ansible all -m setup -a 'filter=ansible_eth[0-2]' # Restrict additional gathered facts to network and virtual. -ansible all -m setup -a 'gather_subset=network,virtual' +# ansible all -m setup -a 'gather_subset=network,virtual' # Do not call puppet facter or ohai even if present. -ansible all -m setup -a 'gather_subset=!facter,!ohai' +# ansible all -m setup -a 'gather_subset=!facter,!ohai' # Only collect the minimum amount of facts: -ansible all -m setup -a 'gather_subset=!all' +# ansible all -m setup -a 'gather_subset=!all' # Display facts from Windows hosts with custom facts stored in C(C:\\custom_facts). -ansible windows -m setup -a "fact_path='c:\\custom_facts'" +# ansible windows -m setup -a "fact_path='c:\\custom_facts'" """ diff --git a/lib/ansible/modules/web_infrastructure/deploy_helper.py b/lib/ansible/modules/web_infrastructure/deploy_helper.py index b70b30bf0e3..6e48ba32c61 100644 --- a/lib/ansible/modules/web_infrastructure/deploy_helper.py +++ b/lib/ansible/modules/web_infrastructure/deploy_helper.py @@ -130,42 +130,42 @@ EXAMPLES = ''' # General explanation, starting with an example folder structure for a project: -root: - releases: - - 20140415234508 - - 20140415235146 - - 20140416082818 - - shared: - - sessions - - uploads - - current: -> releases/20140416082818 +# root: +# releases: +# - 20140415234508 +# - 20140415235146 +# - 20140416082818 +# +# shared: +# - sessions +# - uploads +# +# current: releases/20140416082818 -The 'releases' folder holds all the available releases. A release is a complete build of the application being -deployed. This can be a clone of a repository for example, or a sync of a local folder on your filesystem. -Having timestamped folders is one way of having distinct releases, but you could choose your own strategy like -git tags or commit hashes. - -During a deploy, a new folder should be created in the releases folder and any build steps required should be -performed. Once the new build is ready, the deploy procedure is 'finalized' by replacing the 'current' symlink -with a link to this build. - -The 'shared' folder holds any resource that is shared between releases. Examples of this are web-server -session files, or files uploaded by users of your application. It's quite common to have symlinks from a release -folder pointing to a shared/subfolder, and creating these links would be automated as part of the build steps. - -The 'current' symlink points to one of the releases. Probably the latest one, unless a deploy is in progress. -The web-server's root for the project will go through this symlink, so the 'downtime' when switching to a new -release is reduced to the time it takes to switch the link. - -To distinguish between successful builds and unfinished ones, a file can be placed in the folder of the release -that is currently in progress. The existence of this file will mark it as unfinished, and allow an automated -procedure to remove it during cleanup. +# The 'releases' folder holds all the available releases. A release is a complete build of the application being +# deployed. This can be a clone of a repository for example, or a sync of a local folder on your filesystem. +# Having timestamped folders is one way of having distinct releases, but you could choose your own strategy like +# git tags or commit hashes. +# +# During a deploy, a new folder should be created in the releases folder and any build steps required should be +# performed. Once the new build is ready, the deploy procedure is 'finalized' by replacing the 'current' symlink +# with a link to this build. +# +# The 'shared' folder holds any resource that is shared between releases. Examples of this are web-server +# session files, or files uploaded by users of your application. It's quite common to have symlinks from a release +# folder pointing to a shared/subfolder, and creating these links would be automated as part of the build steps. +# +# The 'current' symlink points to one of the releases. Probably the latest one, unless a deploy is in progress. +# The web-server's root for the project will go through this symlink, so the 'downtime' when switching to a new +# release is reduced to the time it takes to switch the link. +# +# To distinguish between successful builds and unfinished ones, a file can be placed in the folder of the release +# that is currently in progress. The existence of this file will mark it as unfinished, and allow an automated +# procedure to remove it during cleanup. -# Typical usage: +# Typical usage - name: Initialize the deploy root and gather facts deploy_helper: path: /path/to/root diff --git a/lib/ansible/modules/web_infrastructure/ejabberd_user.py b/lib/ansible/modules/web_infrastructure/ejabberd_user.py index 1568c7b1ded..3ce126c0a51 100644 --- a/lib/ansible/modules/web_infrastructure/ejabberd_user.py +++ b/lib/ansible/modules/web_infrastructure/ejabberd_user.py @@ -61,7 +61,7 @@ notes: - The ejabberd configuration file must include mod_admin_extra as a module. ''' EXAMPLES = ''' -Example playbook entries using the ejabberd_user module to manage users state. +# Example playbook entries using the ejabberd_user module to manage users state. - name: create a user if it does not exists ejabberd_user: diff --git a/lib/ansible/modules/windows/win_acl.py b/lib/ansible/modules/windows/win_acl.py index 4c86c0a387d..be42f964fa5 100644 --- a/lib/ansible/modules/windows/win_acl.py +++ b/lib/ansible/modules/windows/win_acl.py @@ -129,6 +129,7 @@ EXAMPLES = r''' # Remove previously added rule for IIS_IUSRS - name: Remove FullControl AccessRule for IIS_IUSRS + win_acl: path: C:\inetpub\wwwroot\MySite user: IIS_IUSRS rights: FullControl @@ -139,6 +140,7 @@ EXAMPLES = r''' # Deny Intern - name: Deny Deny + win_acl: path: C:\Administrator\Documents user: Intern rights: Read,Write,Modify,FullControl,Delete diff --git a/lib/ansible/modules/windows/win_find.py b/lib/ansible/modules/windows/win_find.py index 194621c7301..1aa6e93ed7e 100644 --- a/lib/ansible/modules/windows/win_find.py +++ b/lib/ansible/modules/windows/win_find.py @@ -149,7 +149,7 @@ EXAMPLES = r''' # Find files in path based on regex pattern - win_find: paths: D:\temp - patterns: "out_\d{8}-\d{6}.log" + patterns: 'out_\d{8}-\d{6}.log' # Find files older than 1 day - win_find: diff --git a/lib/ansible/modules/windows/win_package.py b/lib/ansible/modules/windows/win_package.py index 5bcbc88417b..0c2f8ec597c 100644 --- a/lib/ansible/modules/windows/win_package.py +++ b/lib/ansible/modules/windows/win_package.py @@ -104,20 +104,20 @@ EXAMPLES = r''' # Specify the expected non-zero return code when successful # In this case 3010 indicates 'reboot required' - name: 'Microsoft .NET Framework 4.5.1' - win_package: - path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe - productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}' - arguments: '/q /norestart' - ensure: present - expected_return_code: 3010 + win_package: + path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe + productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}' + arguments: '/q /norestart' + ensure: present + expected_return_code: 3010 # Specify multiple non-zero return codes when successful # In this case we can say that both 0 (SUCCESSFUL) and 3010 (REBOOT REQUIRED) codes are acceptable - - name: 'Microsoft .NET Framework 4.5.1' - win_package: - path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe - productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}' - arguments: '/q /norestart' - ensure: present - expected_return_code: [0,3010] +- name: 'Microsoft .NET Framework 4.5.1' + win_package: + path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe + productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}' + arguments: '/q /norestart' + ensure: present + expected_return_code: [0,3010] ''' diff --git a/lib/ansible/modules/windows/win_path.py b/lib/ansible/modules/windows/win_path.py index d775f5e5277..734dcc89ab7 100644 --- a/lib/ansible/modules/windows/win_path.py +++ b/lib/ansible/modules/windows/win_path.py @@ -75,11 +75,11 @@ EXAMPLES = r''' - name: Ensure that system32 and Powershell are present on the global system path, and in the specified order win_path: elements: - - %SystemRoot%\system32 - - %SystemRoot%\system32\WindowsPowerShell\v1.0 + - '%SystemRoot%\system32' + - '%SystemRoot%\system32\WindowsPowerShell\v1.0' - name: Ensure that C:\Program Files\MyJavaThing is not on the current user's CLASSPATH - win_path + win_path: name: CLASSPATH elements: C:\Program Files\MyJavaThing scope: user diff --git a/lib/ansible/modules/windows/win_ping.py b/lib/ansible/modules/windows/win_ping.py index 744553b56c9..629d7f32c2c 100644 --- a/lib/ansible/modules/windows/win_ping.py +++ b/lib/ansible/modules/windows/win_ping.py @@ -42,7 +42,7 @@ author: "Chris Church (@cchurch)" EXAMPLES = r''' # Test connectivity to a windows host -ansible winserver -m win_ping +# ansible winserver -m win_ping # Example from an Ansible Playbook - win_ping: diff --git a/lib/ansible/modules/windows/win_unzip.py b/lib/ansible/modules/windows/win_unzip.py index 3b7163c031b..1525db07db7 100644 --- a/lib/ansible/modules/windows/win_unzip.py +++ b/lib/ansible/modules/windows/win_unzip.py @@ -89,7 +89,6 @@ EXAMPLES = r''' creates: C:\Users\Phil\OldLogs # This playbook example unzips a .zip file and recursively decompresses the contained .gz files and removes all unneeded compressed files after completion. ---- - name: Unzip ApplicationLogs.zip and decompress all GZipped log files hosts: all gather_facts: false @@ -102,15 +101,15 @@ EXAMPLES = r''' rm: true # Install PSCX to use for extracting a gz file - - name: Grab PSCX msi - win_get_url: - url: http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=pscx&DownloadId=923562&FileTime=130585918034470000&Build=20959 - dest: C:\pscx.msi - - name: Install PSCX - win_msi: - path: C:\pscx.msi - - name: Unzip gz log - win_unzip: - src: C:\Logs\application-error-logs.gz - dest: C:\ExtractedLogs\application-error-logs +- name: Grab PSCX msi + win_get_url: + url: http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=pscx&DownloadId=923562&FileTime=130585918034470000&Build=20959 + dest: C:\pscx.msi +- name: Install PSCX + win_msi: + path: C:\pscx.msi +- name: Unzip gz log + win_unzip: + src: C:\Logs\application-error-logs.gz + dest: C:\ExtractedLogs\application-error-logs ''' diff --git a/test/sanity/validate-modules/utils.py b/test/sanity/validate-modules/utils.py index 32a7fbb06ca..dbda4938c7a 100644 --- a/test/sanity/validate-modules/utils.py +++ b/test/sanity/validate-modules/utils.py @@ -71,12 +71,20 @@ class CaptureStd(): return self.stdout.getvalue(), self.stderr.getvalue() -def parse_yaml(value, lineno, module, name): +def parse_yaml(value, lineno, module, name, load_all=False): traces = [] errors = [] data = None + + if load_all: + loader = yaml.safe_load_all + else: + loader = yaml.safe_load + try: - data = yaml.safe_load(value) + data = loader(value) + if load_all: + data = list(data) except yaml.MarkedYAMLError as e: e.problem_mark.line += lineno - 1 e.problem_mark.name = '%s.%s' % (module, name) diff --git a/test/sanity/validate-modules/validate-modules b/test/sanity/validate-modules/validate-modules index e60c36a0f6f..df01233b388 100755 --- a/test/sanity/validate-modules/validate-modules +++ b/test/sanity/validate-modules/validate-modules @@ -471,6 +471,12 @@ class ModuleValidator(Validator): if not bool(doc_info['EXAMPLES']['value']): self.errors.append('No EXAMPLES provided') + else: + _, errors, traces = parse_yaml(doc_info['EXAMPLES']['value'], + doc_info['EXAMPLES']['lineno'], + self.name, 'EXAMPLES', load_all=True) + self.errors.extend(errors) + self.traces.extend(traces) if not bool(doc_info['RETURN']['value']): if self._is_new_module():