File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
automation/roles/cloud_resources/tasks Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change 351351 register : ec2_spot_request_result
352352 when : item.instances[0] | default('') | length < 1
353353
354+ - name : " AWS: Wait for EC2 Spot instance to be created"
355+ amazon.aws.ec2_instance :
356+ access_key : " {{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY_ID') }}"
357+ secret_key : " {{ lookup('ansible.builtin.env', 'AWS_SECRET_ACCESS_KEY') }}"
358+ region : " {{ server_location }}"
359+ filters :
360+ spot-instance-request-id : " {{ item.spot_request.spot_instance_request_id }}"
361+ loop : " {{ ec2_spot_request_result.results }}"
362+ loop_control :
363+ index_var : idx
364+ label : " {{ server_name | lower }}{{ '%02d' % (idx + 1) }}"
365+ register : ec2_spot_instance_wait_result
366+ until :
367+ - ec2_spot_instance_wait_result.instances[0][ip_address_type] is defined
368+ - ec2_spot_instance_wait_result.instances[0][ip_address_type] | length > 0
369+ retries : 12
370+ delay : 10
371+ when : item.spot_request.spot_instance_request_id is defined
372+
354373 - name : " AWS: Rename the EC2 Spot instance"
355374 amazon.aws.ec2_instance :
356375 access_key : " {{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY_ID') }}"
364383 index_var : idx
365384 label : " {{ server_name | lower }}{{ '%02d' % (idx + 1) }}"
366385 register : ec2_spot_instance_result
367- until :
368- - ec2_spot_instance_result.instances[0][ip_address_type] is defined
369- - ec2_spot_instance_result.instances[0][ip_address_type] | length > 0
386+ until : ec2_spot_instance_result is success
370387 retries : 3
371388 delay : 10
372389 when : item.spot_request.spot_instance_request_id is defined
You can’t perform that action at this time.
0 commit comments