main.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ---
  2. # Necessary because when you're on a node that's also a master the master will be
  3. # restarted after the node restarts docker and it will take up to 60 seconds for
  4. # systemd to start the master again
  5. - name: Wait for master API to become available before proceeding
  6. # Using curl here since the uri module requires python-httplib2 and
  7. # wait_for port doesn't provide health information.
  8. command: >
  9. curl --silent --tlsv1.2
  10. {% if openshift.common.version_gte_3_2_or_1_2 | bool %}
  11. --cacert {{ openshift.common.config_base }}/master/ca-bundle.crt
  12. {% else %}
  13. --cacert {{ openshift.common.config_base }}/master/ca.crt
  14. {% endif %}
  15. {{ openshift_node_master_api_url }}/healthz/ready
  16. args:
  17. # Disables the following warning:
  18. # Consider using get_url or uri module rather than running curl
  19. warn: no
  20. register: api_available_output
  21. until: api_available_output.stdout == 'ok'
  22. retries: 120
  23. delay: 1
  24. changed_when: false
  25. when: openshift.common.is_containerized | bool
  26. delegate_to: "{{ openshift_master_host }}"
  27. run_once: true
  28. - name: Wait for Node Registration
  29. oc_obj:
  30. name: "{{ openshift.node.nodename }}"
  31. kind: node
  32. state: list
  33. register: get_node
  34. until: "'metadata' in get_node.results.results[0]"
  35. retries: 50
  36. delay: 5
  37. when: "'nodename' in openshift.node"
  38. delegate_to: "{{ openshift_master_host }}"
  39. - name: Set node schedulability
  40. oc_adm_manage_node:
  41. node: "{{ openshift.node.nodename | lower }}"
  42. schedulable: "{{ 'true' if openshift.node.schedulable | bool else 'false' }}"
  43. retries: 10
  44. delay: 5
  45. register: node_schedulable
  46. until: node_schedulable|succeeded
  47. when: "'nodename' in openshift.node"
  48. delegate_to: "{{ openshift_master_host }}"
  49. - name: Label nodes
  50. oc_label:
  51. name: "{{ openshift.node.nodename }}"
  52. kind: node
  53. state: add
  54. labels: "{{ openshift.node.labels | oo_dict_to_list_of_dict }}"
  55. namespace: default
  56. when:
  57. - "'nodename' in openshift.node"
  58. - "'labels' in openshift.node"
  59. - openshift.node.labels != {}
  60. delegate_to: "{{ openshift_master_host }}"