restart.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. - name: Restart nodes
  3. hosts: oo_nodes_to_config
  4. serial: "{{ openshift_restart_nodes_serial | default(1) }}"
  5. tasks:
  6. - name: Restart docker
  7. service: name=docker state=restarted
  8. - name: Update docker facts
  9. openshift_facts:
  10. role: docker
  11. - name: Restart containerized services
  12. service: name={{ item }} state=started
  13. with_items:
  14. - etcd_container
  15. - openvswitch
  16. - "{{ openshift.common.service_type }}-master"
  17. - "{{ openshift.common.service_type }}-master-api"
  18. - "{{ openshift.common.service_type }}-master-controllers"
  19. - "{{ openshift.common.service_type }}-node"
  20. failed_when: false
  21. when: openshift.common.is_containerized | bool
  22. - name: Wait for master API to come back online
  23. wait_for:
  24. host: "{{ openshift.common.hostname }}"
  25. state: started
  26. delay: 10
  27. port: "{{ openshift.master.api_port }}"
  28. when: inventory_hostname in groups.oo_masters_to_config
  29. - name: restart node
  30. service:
  31. name: "{{ openshift.common.service_type }}-node"
  32. state: restarted
  33. - name: Wait for node to be ready
  34. command: >
  35. {{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} get node {{ openshift.common.hostname | lower }} --no-headers
  36. register: node_output
  37. delegate_to: "{{ groups.oo_first_master.0 }}"
  38. when: inventory_hostname in groups.oo_nodes_to_config
  39. until: "{{ node_output.stdout.split()[1].startswith('Ready')}}"
  40. # Give the node two minutes to come back online.
  41. retries: 24
  42. delay: 5