mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[aws][docs] Replace uses of now-obsolete with_items
with loop
(#47164)
This commit is contained in:
parent
2043aad582
commit
df57a3fc7a
14 changed files with 23 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }}"
|
||||
|
||||
'''
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -72,7 +72,7 @@ EXAMPLES = '''
|
|||
filters:
|
||||
vpc-id: vpc-abcdef00
|
||||
"tag:Name": "{{ item }}"
|
||||
with_items:
|
||||
loop:
|
||||
- publicA
|
||||
- publicB
|
||||
- publicC
|
||||
|
|
|
@ -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 }}"
|
||||
|
||||
'''
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ post_tasks:
|
|||
ec2_elbs: "{{ item }}"
|
||||
state: present
|
||||
delegate_to: localhost
|
||||
with_items: "{{ ec2_elbs }}"
|
||||
loop: "{{ ec2_elbs }}"
|
||||
"""
|
||||
|
||||
import time
|
||||
|
|
|
@ -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}}"
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue