restart.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: Wait for master API to come back online
  19. wait_for:
  20. host: "{{ openshift.common.hostname }}"
  21. state: started
  22. delay: 10
  23. port: "{{ openshift_master_api_port }}"
  24. timeout: 600
  25. when: inventory_hostname in groups.oo_masters_to_config
  26. - name: restart node
  27. service:
  28. name: "{{ openshift_service_type }}-node"
  29. state: restarted
  30. - name: Wait for node to be ready
  31. oc_obj:
  32. state: list
  33. kind: node
  34. name: "{{ openshift.node.nodename | lower }}"
  35. register: node_output
  36. delegate_to: "{{ groups.oo_first_master.0 }}"
  37. when: inventory_hostname in groups.oo_nodes_to_config
  38. until:
  39. - node_output.results is defined
  40. - node_output.results.returncode is defined
  41. - node_output.results.returncode == 0
  42. - node_output.results.results is defined
  43. - node_output.results.results | length > 0
  44. - node_output.results.results[0].status is defined
  45. - node_output.results.results[0].status.conditions is defined
  46. - node_output.results.results[0].status.conditions | selectattr('type', 'match', '^Ready$') | map(attribute='status') | join | bool == True
  47. # Give the node three minutes to come back online.
  48. retries: 36
  49. delay: 5