Guillaume Coré
2020-03-11 1d970fbaa4bd88c9d094d9587db59fdf9cd0239a
commit | author | age
62f0d3 1 ---
2a18ae 2 - name: wait for linux host to be available
S 3   wait_for_connection:
4     timeout: 300
5   register: rwait
6   ignore_errors: true
7
8 - name: restart instance if wait_for_connection failed
9   become: false
10   environment:
11     AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}"
12     AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}"
5c7a03 13     AWS_DEFAULT_REGION: "{{aws_region_final|d(aws_region)}}"
2a18ae 14   command: "aws ec2 reboot-instances --instance-ids '{{instance_id}}'"
S 15   delegate_to: localhost
618c1b 16   when: rwait is failed
2a18ae 17
S 18 - name: wait for linux host to be available (retry)
19   wait_for_connection:
20     delay: 60
21     timeout: 200
618c1b 22   when: rwait is failed
2a18ae 23
S 24 - ping:
25   register: rping
26   retries: 3
27   delay: 10
f1b74f 28   until: rping is succeeded
2a18ae 29   tags: must