provision_nodes.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ---
  2. # Get bootstrap config token
  3. # bootstrap should be created on first master
  4. # need to fetch it and shove it into cloud data
  5. - name: fetch master instances
  6. ec2_remote_facts:
  7. region: "{{ openshift_aws_region }}"
  8. filters:
  9. "tag:clusterid": "{{ openshift_aws_clusterid }}"
  10. "tag:host-type": master
  11. instance-state-name: running
  12. register: instancesout
  13. retries: 20
  14. delay: 3
  15. until: instancesout.instances|length > 0
  16. - name: slurp down the bootstrap.kubeconfig
  17. slurp:
  18. src: /etc/origin/master/bootstrap.kubeconfig
  19. delegate_to: "{{ instancesout.instances[0].public_ip_address }}"
  20. remote_user: root
  21. register: bootstrap
  22. - name: set_fact for kubeconfig token
  23. set_fact:
  24. openshift_aws_launch_config_bootstrap_token: "{{ bootstrap['content'] | b64decode }}"
  25. - name: include build node group for infra
  26. include: build_node_group.yml
  27. vars:
  28. openshift_aws_node_group_type: infra
  29. openshift_aws_scale_group_name: "{{ openshift_aws_clusterid }} openshift infra"
  30. openshift_aws_launch_config_name: "{{ openshift_aws_clusterid }}-infra-{{ ansible_date_time.epoch }}"
  31. - name: include build node group for compute
  32. include: build_node_group.yml
  33. vars:
  34. openshift_aws_node_group_type: compute
  35. openshift_aws_scale_group_name: "{{ openshift_aws_clusterid }} openshift compute"
  36. openshift_aws_launch_config_name: "{{ openshift_aws_clusterid }}-compute-{{ ansible_date_time.epoch }}"
  37. - when: openshift_aws_wait_for_ssh | bool
  38. block:
  39. - name: pause and allow for instances to scale before we query them
  40. pause:
  41. seconds: 10
  42. - name: fetch newly created instances
  43. ec2_remote_facts:
  44. region: "{{ openshift_aws_region }}"
  45. filters:
  46. "tag:clusterid": "{{ openshift_aws_clusterid }}"
  47. "tag:host-type": node
  48. instance-state-name: running
  49. register: instancesout
  50. retries: 20
  51. delay: 3
  52. until: instancesout.instances|length > 0
  53. - name: wait for ssh to become available
  54. wait_for:
  55. port: 22
  56. host: "{{ item.public_ip_address }}"
  57. timeout: 300
  58. search_regex: OpenSSH
  59. with_items: "{{ instancesout.instances }}"