restart.yml 1.7 KB

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