restart.yml 1.6 KB

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