setup_master_group.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ---
  2. - name: Alert user to variables needed - clusterid
  3. debug:
  4. msg: "openshift_aws_clusterid={{ openshift_aws_clusterid }}"
  5. - name: Alert user to variables needed - region
  6. debug:
  7. msg: "openshift_aws_region={{ openshift_aws_region }}"
  8. - name: fetch newly created instances
  9. ec2_instance_facts:
  10. region: "{{ openshift_aws_region }}"
  11. filters:
  12. "tag:clusterid": "{{ openshift_aws_clusterid }}"
  13. "tag:host-type": master
  14. instance-state-name: running
  15. register: instancesout
  16. retries: 20
  17. delay: 3
  18. until: instancesout.instances|length > 0
  19. - debug: var=instancesout
  20. - name: add new master to masters group
  21. add_host:
  22. groups: "{{ openshift_aws_masters_groups }}"
  23. name: "{{ item.public_dns_name }}"
  24. hostname: "{{ openshift_aws_clusterid }}-master-{{ item.instance_id[:-5] }}"
  25. with_items: "{{ instancesout.instances }}"
  26. - name: wait for ssh to become available
  27. wait_for:
  28. port: 22
  29. host: "{{ item.public_dns_name }}"
  30. timeout: 300
  31. search_regex: OpenSSH
  32. with_items: "{{ instancesout.instances }}"