main.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ---
  2. - name: restart master api
  3. systemd:
  4. name: "{{ openshift.common.service_type }}-master-api"
  5. state: restarted
  6. when:
  7. - not (master_api_service_status_changed | default(false) | bool)
  8. - openshift.master.cluster_method == 'native'
  9. notify:
  10. - Verify API Server
  11. # We retry the controllers because the API may not be 100% initialized yet.
  12. - name: restart master controllers
  13. command: "systemctl restart {{ openshift.common.service_type }}-master-controllers"
  14. retries: 3
  15. delay: 5
  16. register: result
  17. until: result.rc == 0
  18. when:
  19. - not (master_controllers_service_status_changed | default(false) | bool)
  20. - openshift.master.cluster_method == 'native'
  21. - name: Verify API Server
  22. # Using curl here since the uri module requires python-httplib2 and
  23. # wait_for port doesn't provide health information.
  24. command: >
  25. curl --silent --tlsv1.2
  26. {% if openshift.common.version_gte_3_2_or_1_2 | bool %}
  27. --cacert {{ openshift.common.config_base }}/master/ca-bundle.crt
  28. {% else %}
  29. --cacert {{ openshift.common.config_base }}/master/ca.crt
  30. {% endif %}
  31. {{ openshift.master.api_url }}/healthz/ready
  32. args:
  33. # Disables the following warning:
  34. # Consider using get_url or uri module rather than running curl
  35. warn: no
  36. register: l_api_available_output
  37. until: l_api_available_output.stdout == 'ok'
  38. retries: 120
  39. delay: 1
  40. changed_when: false