join.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ---
  2. - name: Node Join Checkpoint Start
  3. hosts: all
  4. gather_facts: false
  5. tasks:
  6. - name: Set Node Join 'In Progress'
  7. run_once: true
  8. set_stats:
  9. data:
  10. installer_phase_node_join:
  11. title: "Node Join"
  12. playbook: "playbooks/openshift-node/join.yml"
  13. status: "In Progress"
  14. start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
  15. - name: Distribute bootstrap and start nodes
  16. hosts: oo_nodes_to_config
  17. gather_facts: no
  18. tasks:
  19. - import_role:
  20. name: openshift_node
  21. tasks_from: distribute_bootstrap.yml
  22. - name: Approve any pending CSR requests from inventory nodes
  23. hosts: oo_first_master
  24. gather_facts: no
  25. tasks:
  26. - name: Dump all candidate bootstrap hostnames
  27. debug:
  28. msg: "{{ groups['oo_nodes_to_config'] | default([]) }}"
  29. - name: Find all hostnames for bootstrapping
  30. set_fact:
  31. l_nodes_to_join: "{{ groups['oo_nodes_to_config'] | default([]) | map('extract', hostvars) | map(attribute='openshift.node.nodename') | list }}"
  32. - name: Dump the bootstrap hostnames
  33. debug:
  34. msg: "{{ l_nodes_to_join }}"
  35. - name: Approve node certificates when bootstrapping
  36. oc_csr_approve:
  37. oc_bin: "{{ openshift_client_binary }}"
  38. oc_conf: "{{ openshift.common.config_base }}/master/admin.kubeconfig"
  39. node_list: "{{ l_nodes_to_join }}"
  40. register: node_bootstrap_csr_approve
  41. retries: 30
  42. until: node_bootstrap_csr_approve is succeeded
  43. when:
  44. - l_nodes_to_join|length > 0
  45. - name: Ensure any inventory labels are applied to the nodes
  46. hosts: oo_nodes_to_config
  47. vars:
  48. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  49. roles:
  50. - role: openshift_manage_node
  51. openshift_master_host: "{{ groups.oo_first_master.0 }}"
  52. openshift_manage_node_is_master: "{{ ('oo_masters_to_config' in group_names) | bool }}"
  53. - name: Node Join Checkpoint End
  54. hosts: all
  55. gather_facts: false
  56. tasks:
  57. - name: Set Node Join 'Complete'
  58. run_once: true
  59. set_stats:
  60. data:
  61. installer_phase_node_join:
  62. status: "Complete"
  63. end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"