With Ansible, I'm stopping several RDS (it could be EC2) instances.
Then I want continue only when all of them are in the state stopped. I use the following task:
- name: Wait for RDS modify to finish
rds_instance_facts:
aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
security_token: "{{ assumed_role.sts_creds.session_token }}"
db_instance_identifier: "{{ item }}"
region: "{{ region }}"
loop: "{{ vars[ 'list_rds_resources_ids1_' ] + vars[ 'list_rds_resources_ids2_' ] }}"
register: aws_rds_facts
until: aws_rds_facts[0].db_instance_status == "stopped"
retries: 90
delay: 10
Right now, my code is testing only the first element. How to make the test on all existing elements at the same time ?