When launching AWS instances wait for the one we just launched

because the ec2.instances variable will return all that are
currently running
This commit is contained in:
Alexander Todorov 2019-08-19 15:33:13 +03:00 committed by Lars Karlitski
parent 421cc9c22f
commit ea98969014
2 changed files with 3 additions and 1 deletions

View File

@ -22,11 +22,14 @@
port: 22
state: started
with_items: "{{ ec2.instances }}"
when: item.image_id == ami_id
- name: Save instance ID
local_action: copy content={{ item.instance_id }} dest={{ tmp_dir }}/instance_id
with_items: "{{ ec2.instances }}"
when: item.image_id == ami_id
- name: Save public IP
local_action: copy content={{ item.public_ip_address }} dest={{ tmp_dir }}/public_ip
with_items: "{{ ec2.instances }}"
when: item.image_id == ami_id

View File

@ -162,7 +162,6 @@ __EOF__
'key_name=$KEY_NAME \
ssh_key_dir=$SSH_KEY_DIR \
ami_id=$AMI_ID \
key_name=$KEY_NAME \
tmp_dir=$TMP_DIR' \
$PLAYBOOKS_DIR/instance.yml"