main.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ---
  2. ######################################################################
  3. # NOTE: These are duplicated from roles/openshift_master/handlers/main.yml
  4. #
  5. # TODO: Use the consolidated 'openshift_handlers' role once it's ready
  6. # See: https://github.com/openshift/openshift-ansible/pull/4041#discussion_r118770782
  7. ######################################################################
  8. - name: restart master
  9. systemd: name={{ openshift.common.service_type }}-master state=restarted
  10. when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool))
  11. notify: Verify API Server
  12. - name: restart master api
  13. systemd: name={{ openshift.common.service_type }}-master-api state=restarted
  14. when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_api_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native'
  15. notify: Verify API Server
  16. - name: restart master controllers
  17. systemd: name={{ openshift.common.service_type }}-master-controllers state=restarted
  18. when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_controllers_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native'
  19. - name: Verify API Server
  20. # Using curl here since the uri module requires python-httplib2 and
  21. # wait_for port doesn't provide health information.
  22. command: >
  23. curl --silent --tlsv1.2
  24. {% if openshift.common.version_gte_3_2_or_1_2 | bool %}
  25. --cacert {{ openshift.common.config_base }}/master/ca-bundle.crt
  26. {% else %}
  27. --cacert {{ openshift.common.config_base }}/master/ca.crt
  28. {% endif %}
  29. {{ openshift.master.api_url }}/healthz/ready
  30. args:
  31. # Disables the following warning:
  32. # Consider using get_url or uri module rather than running curl
  33. warn: no
  34. register: api_available_output
  35. until: api_available_output.stdout == 'ok'
  36. retries: 120
  37. delay: 1
  38. changed_when: false