restart.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ---
  2. # input variables:
  3. # - openshift_service_type
  4. # - openshift.common.hostname
  5. # - openshift_master_api_port
  6. # NOTE: This is needed to make sure we are using the correct set
  7. # of systemd unit files. The RPMs lay down defaults but
  8. # the install/upgrade may override them in /etc/systemd/system/.
  9. # NOTE: We don't use the systemd module as some versions of the module
  10. # require a service to be part of the call.
  11. - name: Reload systemd to ensure latest unit files
  12. command: systemctl daemon-reload
  13. - name: Restart support services
  14. service:
  15. name: "{{ item }}"
  16. state: started
  17. enabled: True
  18. with_items:
  19. - NetworkManager
  20. - dnsmasq
  21. - name: Restart container runtime
  22. service:
  23. name: "{{ openshift_docker_service_name }}"
  24. state: started
  25. register: docker_start_result
  26. until: not (docker_start_result is failed)
  27. retries: 3
  28. delay: 30
  29. - name: Restart cri-o
  30. service:
  31. name: cri-o
  32. state: started
  33. when: openshift_use_crio | default(False)
  34. - name: Start node service
  35. service:
  36. name: "{{ openshift_service_type }}-node"
  37. state: started
  38. async: 300
  39. poll: 0
  40. register: node_service
  41. failed_when: false
  42. - name: Approve the node
  43. oc_adm_csr:
  44. nodes: ["{{ openshift.node.nodename }}"]
  45. timeout: 60
  46. fail_on_timeout: true
  47. delegate_to: "{{ groups.oo_first_master.0 }}"
  48. - name: Check status of node service
  49. async_status:
  50. jid: "{{ node_service.ansible_job_id }}"
  51. register: job_result
  52. until: job_result.finished
  53. retries: 30
  54. delay: 10
  55. - name: Wait for master API to come back online
  56. wait_for:
  57. host: "{{ openshift.common.hostname }}"
  58. state: started
  59. delay: 10
  60. port: "{{ openshift_master_api_port }}"
  61. timeout: 600
  62. when: inventory_hostname in groups.oo_masters_to_config