restart.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ---
  2. - name: Restart nodes
  3. hosts: oo_nodes_to_config
  4. serial: "{{ openshift_restart_nodes_serial | default(1) }}"
  5. roles:
  6. - lib_openshift
  7. tasks:
  8. - name: Restart docker
  9. service:
  10. name: docker
  11. state: restarted
  12. register: l_docker_restart_docker_in_node_result
  13. until: not l_docker_restart_docker_in_node_result | failed
  14. retries: 3
  15. delay: 30
  16. - name: Update docker facts
  17. openshift_facts:
  18. role: docker
  19. - name: Restart containerized services
  20. service:
  21. name: "{{ item }}"
  22. state: started
  23. with_items:
  24. - etcd_container
  25. - openvswitch
  26. - "{{ openshift.common.service_type }}-master"
  27. - "{{ openshift.common.service_type }}-master-api"
  28. - "{{ openshift.common.service_type }}-master-controllers"
  29. - "{{ openshift.common.service_type }}-node"
  30. failed_when: false
  31. when: openshift.common.is_containerized | bool
  32. - name: Wait for master API to come back online
  33. wait_for:
  34. host: "{{ openshift.common.hostname }}"
  35. state: started
  36. delay: 10
  37. port: "{{ openshift.master.api_port }}"
  38. timeout: 600
  39. when: inventory_hostname in groups.oo_masters_to_config
  40. - name: restart node
  41. service:
  42. name: "{{ openshift.common.service_type }}-node"
  43. state: restarted
  44. - name: Wait for node to be ready
  45. oc_obj:
  46. state: list
  47. kind: node
  48. name: "{{ openshift.common.hostname | lower }}"
  49. register: node_output
  50. delegate_to: "{{ groups.oo_first_master.0 }}"
  51. when: inventory_hostname in groups.oo_nodes_to_config
  52. until: node_output.results.returncode == 0 and node_output.results.results[0].status.conditions | selectattr('type', 'match', '^Ready$') | map(attribute='status') | join | bool == True
  53. # Give the node two minutes to come back online.
  54. retries: 24
  55. delay: 5