From df57a3fc7a6fac7fe74c96ac4d26c5300eb27674 Mon Sep 17 00:00:00 2001 From: Petr Ruzicka Date: Wed, 17 Oct 2018 18:35:31 +0200 Subject: [PATCH] [aws][docs] Replace uses of now-obsolete `with_items` with `loop` (#47164) --- lib/ansible/modules/cloud/amazon/ec2.py | 4 ++-- lib/ansible/modules/cloud/amazon/ec2_eip.py | 2 +- lib/ansible/modules/cloud/amazon/ec2_elb.py | 2 +- lib/ansible/modules/cloud/amazon/ec2_elb_facts.py | 4 ++-- lib/ansible/modules/cloud/amazon/ec2_tag.py | 2 +- lib/ansible/modules/cloud/amazon/ec2_vol.py | 4 ++-- lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py | 2 +- lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py | 2 +- lib/ansible/modules/cloud/amazon/elb_classic_lb_facts.py | 4 ++-- lib/ansible/modules/cloud/amazon/elb_instance.py | 2 +- lib/ansible/modules/cloud/amazon/elb_target_facts.py | 2 +- lib/ansible/modules/cloud/amazon/iam.py | 6 +++--- lib/ansible/modules/cloud/amazon/iam_policy.py | 6 +++--- lib/ansible/modules/cloud/amazon/lambda.py | 4 ++-- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index 7b8e426c52..5e31a6aeb4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -381,14 +381,14 @@ EXAMPLES = ''' add_host: hostname: "{{ item.public_ip }}" groupname: launched - with_items: "{{ ec2.instances }}" + loop: "{{ ec2.instances }}" - name: Wait for SSH to come up delegate_to: "{{ item.public_dns_name }}" wait_for_connection: delay: 60 timeout: 320 - with_items: "{{ ec2.instances }}" + loop: "{{ ec2.instances }}" - name: Configure instance(s) hosts: launched diff --git a/lib/ansible/modules/cloud/amazon/ec2_eip.py b/lib/ansible/modules/cloud/amazon/ec2_eip.py index 668b0b9313..f6f220a721 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eip.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eip.py @@ -134,7 +134,7 @@ EXAMPLES = ''' - name: associate new elastic IPs with each of the instances ec2_eip: device_id: "{{ item }}" - with_items: "{{ ec2.instance_ids }}" + loop: "{{ ec2.instance_ids }}" - name: allocate a new elastic IP inside a VPC in us-west-2 ec2_eip: diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb.py b/lib/ansible/modules/cloud/amazon/ec2_elb.py index 7acd0fc6f1..45cf9bcbbc 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_elb.py +++ b/lib/ansible/modules/cloud/amazon/ec2_elb.py @@ -83,7 +83,7 @@ post_tasks: instance_id: "{{ ansible_ec2_instance_id }}" ec2_elbs: "{{ item }}" state: present - with_items: "{{ ec2_elbs }}" + loop: "{{ ec2_elbs }}" """ import time diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py b/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py index a7f0a90d53..6d93348075 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py @@ -50,7 +50,7 @@ EXAMPLES = ''' - action: module: debug msg: "{{ item.dns_name }}" - with_items: "{{ elb_facts.elbs }}" + loop: "{{ elb_facts.elbs }}" # Gather facts about a particular ELB - action: @@ -73,7 +73,7 @@ EXAMPLES = ''' - action: module: debug msg: "{{ item.dns_name }}" - with_items: "{{ elb_facts.elbs }}" + loop: "{{ elb_facts.elbs }}" ''' diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py index 9021c5e4df..0105b7e22c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_tag.py +++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py @@ -68,7 +68,7 @@ EXAMPLES = ''' tags: Name: dbserver Env: production - with_items: '{{ ec2_vol.volumes }}' + loop: '{{ ec2_vol.volumes }}' - name: Retrieve all tags on an instance ec2_tag: diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol.py b/lib/ansible/modules/cloud/amazon/ec2_vol.py index 5066f0c32f..13c25f6cdc 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol.py @@ -124,7 +124,7 @@ EXAMPLES = ''' - ec2_vol: instance: "{{ item.id }}" volume_size: 5 - with_items: "{{ ec2.instances }}" + loop: "{{ ec2.instances }}" register: ec2_vol # Example: Launch an instance and then add a volume if not already attached @@ -145,7 +145,7 @@ EXAMPLES = ''' instance: "{{ item.id }}" name: my_existing_volume_Name_tag device_name: /dev/xvdf - with_items: "{{ ec2.instances }}" + loop: "{{ ec2.instances }}" register: ec2_vol # Remove a volume diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py index e3de4a6c2a..c6a56f3416 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py @@ -129,7 +129,7 @@ EXAMPLES = ''' nat_gateway_id: "{{ item.NatGatewayId }}" release_eip: yes register: delete_nat_gateway_result - with_items: "{{ gateways_to_remove.result }}" + loop: "{{ gateways_to_remove.result }}" - name: Delete nat gateway and wait for deleted status. ec2_vpc_nat_gateway: diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py index 509e4f0487..f8e341373e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py @@ -72,7 +72,7 @@ EXAMPLES = ''' filters: vpc-id: vpc-abcdef00 "tag:Name": "{{ item }}" - with_items: + loop: - publicA - publicB - publicC diff --git a/lib/ansible/modules/cloud/amazon/elb_classic_lb_facts.py b/lib/ansible/modules/cloud/amazon/elb_classic_lb_facts.py index 90e9a02098..3421775f0d 100644 --- a/lib/ansible/modules/cloud/amazon/elb_classic_lb_facts.py +++ b/lib/ansible/modules/cloud/amazon/elb_classic_lb_facts.py @@ -51,7 +51,7 @@ EXAMPLES = ''' - debug: msg: "{{ item.dns_name }}" - with_items: "{{ elb_facts.elbs }}" + loop: "{{ elb_facts.elbs }}" # Gather facts about a particular ELB - elb_classic_lb_facts: @@ -70,7 +70,7 @@ EXAMPLES = ''' - debug: msg: "{{ item.dns_name }}" - with_items: "{{ elb_facts.elbs }}" + loop: "{{ elb_facts.elbs }}" ''' diff --git a/lib/ansible/modules/cloud/amazon/elb_instance.py b/lib/ansible/modules/cloud/amazon/elb_instance.py index 40697935e8..cdbf9d4cb4 100644 --- a/lib/ansible/modules/cloud/amazon/elb_instance.py +++ b/lib/ansible/modules/cloud/amazon/elb_instance.py @@ -83,7 +83,7 @@ post_tasks: ec2_elbs: "{{ item }}" state: present delegate_to: localhost - with_items: "{{ ec2_elbs }}" + loop: "{{ ec2_elbs }}" """ import time diff --git a/lib/ansible/modules/cloud/amazon/elb_target_facts.py b/lib/ansible/modules/cloud/amazon/elb_target_facts.py index ad162fee31..2d66b00354 100644 --- a/lib/ansible/modules/cloud/amazon/elb_target_facts.py +++ b/lib/ansible/modules/cloud/amazon/elb_target_facts.py @@ -129,7 +129,7 @@ EXAMPLES = """ Port={{target.target_port}}{%if target.target_az%},AvailabilityZone={{target.target_az}} {%endif%} {%endfor%} - with_items: "{{target_facts.instance_target_groups}}" + loop: "{{target_facts.instance_target_groups}}" """ diff --git a/lib/ansible/modules/cloud/amazon/iam.py b/lib/ansible/modules/cloud/amazon/iam.py index 6420a54fa4..787c4125ce 100644 --- a/lib/ansible/modules/cloud/amazon/iam.py +++ b/lib/ansible/modules/cloud/amazon/iam.py @@ -94,7 +94,7 @@ tasks: state: present password: "{{ temp_pass }}" access_key_state: create - with_items: + loop: - jcleese - mpython @@ -106,7 +106,7 @@ task: iam_type: group name: "{{ item }}" state: present - with_items: + loop: - Mario - Luigi register: new_groups @@ -117,7 +117,7 @@ task: name: jdavila state: update groups: "{{ item.created_group.group_name }}" - with_items: "{{ new_groups.results }}" + loop: "{{ new_groups.results }}" # Example of role with custom trust policy for Lambda service - name: Create IAM role with custom trust relationship diff --git a/lib/ansible/modules/cloud/amazon/iam_policy.py b/lib/ansible/modules/cloud/amazon/iam_policy.py index 87f32c9838..4f616952d2 100644 --- a/lib/ansible/modules/cloud/amazon/iam_policy.py +++ b/lib/ansible/modules/cloud/amazon/iam_policy.py @@ -82,7 +82,7 @@ EXAMPLES = ''' iam_type: group name: "{{ item }}" state: present - with_items: + loop: - Mario - Luigi register: new_groups @@ -94,7 +94,7 @@ EXAMPLES = ''' policy_name: "READ-ONLY" policy_document: readonlypolicy.json state: present - with_items: "{{ new_groups.results }}" + loop: "{{ new_groups.results }}" # Create a new S3 policy with prefix per user - name: Create S3 policy from template @@ -104,7 +104,7 @@ EXAMPLES = ''' policy_name: "s3_limited_access_{{ item.prefix }}" state: present policy_json: " {{ lookup( 'template', 's3_policy.json.j2') }} " - with_items: + loop: - user: s3_user prefix: s3_user_prefix diff --git a/lib/ansible/modules/cloud/amazon/lambda.py b/lib/ansible/modules/cloud/amazon/lambda.py index 623f6545fd..32a9c068af 100644 --- a/lib/ansible/modules/cloud/amazon/lambda.py +++ b/lib/ansible/modules/cloud/amazon/lambda.py @@ -125,7 +125,7 @@ EXAMPLES = ''' environment_variables: '{{ item.env_vars }}' tags: key1: 'value1' - with_items: + loop: - name: HelloWorld zip_file: hello-code.zip env_vars: @@ -153,7 +153,7 @@ EXAMPLES = ''' lambda: name: '{{ item }}' state: absent - with_items: + loop: - HelloWorld - ByeBye '''