setup_scale_group_facts.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. with_items: "{{ groups['tag_ocp-node'] | default([]) | difference(groups['tag_ocp-bootstrap'] | default([])) }}"
  31. - name: Add bootstrap node instances
  32. add_host:
  33. name: "{{ hostvars[item].gce_name }}"
  34. groups: bootstrap_nodes
  35. openshift_is_bootstrapped: True
  36. with_items: "{{ groups['tag_ocp-node'] | default([]) | intersect(groups['tag_ocp-bootstrap'] | default([])) }}"
  37. - name: Add bootstrap node instances as nodes
  38. add_host:
  39. name: "{{ item }}"
  40. groups: nodes, new_nodes
  41. openshift_is_bootstrapped: True
  42. with_items: "{{ groups['tag_ocp-bootstrap'] | default([]) }}"
  43. when: all_nodes | default(False)