reboot_instance.yml 671 B

123456789101112131415161718192021222324
  1. ---
  2. - name: fetch newly created instances
  3. ec2_instance_facts:
  4. region: "{{ openshift_aws_region }}"
  5. filters:
  6. "tag:Name": "{{ openshift_aws_base_ami_name }}"
  7. instance-state-name: running
  8. register: instancesout
  9. retries: 20
  10. delay: 3
  11. until: instancesout.instances|length > 0
  12. - name: reboot hosts
  13. shell: ( sleep 2 && reboot ) &
  14. delegate_to: "{{ item.public_dns_name }}"
  15. with_items: "{{ instancesout.instances }}"
  16. - name: wait for ssh to become available
  17. wait_for_connection:
  18. delay: 10
  19. timeout: 600
  20. delegate_to: "{{ item.public_dns_name }}"
  21. with_items: "{{ instancesout.instances }}"
  22. when: openshift_aws_wait_for_ssh | bool