setup_scale_group_facts.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ---
  2. - name: Add masters to requisite groups
  3. add_host:
  4. name: "{{ hostvars[item].gce_name }}"
  5. groups: masters, etcd
  6. openshift_node_labels:
  7. node-role.kubernetes.io/master: "true"
  8. with_items: "{{ groups['tag_ocp-master'] }}"
  9. - name: Add a master to the primary masters group
  10. add_host:
  11. name: "{{ hostvars[item].gce_name }}"
  12. groups: primary_master
  13. with_items: "{{ groups['tag_ocp-master'].0 }}"
  14. - name: Add non-bootstrapping master node instances to node group
  15. add_host:
  16. name: "{{ hostvars[item].gce_name }}"
  17. groups: nodes
  18. with_items: "{{ groups['tag_ocp-master'] | default([]) | difference(groups['tag_ocp-bootstrap'] | default([])) }}"
  19. - name: Add infra node instances to node group
  20. add_host:
  21. name: "{{ hostvars[item].gce_name }}"
  22. groups: nodes, new_nodes
  23. openshift_node_labels:
  24. node-role.kubernetes.io/infra: "true"
  25. with_items: "{{ groups['tag_ocp-infra-node'] | default([]) | difference(groups['tag_ocp-bootstrap'] | default([])) }}"
  26. - name: Add node instances to node group
  27. add_host:
  28. name: "{{ hostvars[item].gce_name }}"
  29. groups: nodes, new_nodes
  30. openshift_node_bootstrap: "{{ openshift_node_bootstrap | default(True) }}"
  31. with_items: "{{ groups['tag_ocp-node'] | default([]) | difference(groups['tag_ocp-bootstrap'] | default([])) }}"
  32. - name: Add bootstrap node instances
  33. add_host:
  34. name: "{{ hostvars[item].gce_name }}"
  35. groups: bootstrap_nodes
  36. openshift_node_bootstrap: True
  37. openshift_is_bootstrapped: True
  38. with_items: "{{ groups['tag_ocp-node'] | default([]) | intersect(groups['tag_ocp-bootstrap'] | default([])) }}"
  39. - name: Add bootstrap node instances as nodes
  40. add_host:
  41. name: "{{ item }}"
  42. groups: nodes, new_nodes
  43. openshift_node_bootstrap: True
  44. openshift_is_bootstrapped: True
  45. with_items: "{{ groups['tag_ocp-bootstrap'] | default([]) }}"
  46. when: all_nodes | default(False)