oo-sdn-restart.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/ansible-playbook
  2. ---
  3. #example run:
  4. # ansible-playbook -e "host=ops-node-compute-abcde" oo-sdn-restart.yml
  5. #
  6. - name: Check vars
  7. hosts: localhost
  8. gather_facts: false
  9. pre_tasks:
  10. - fail:
  11. msg: "Playbook requires host to be set"
  12. when: host is not defined or host == ''
  13. - name: Restart openshift/docker (and monitoring containers)
  14. hosts: oo_version_3:&oo_name_{{ host }}
  15. gather_facts: false
  16. user: root
  17. tasks:
  18. - name: stop openshift/docker
  19. service:
  20. name: "{{ item }}"
  21. state: stopped
  22. with_items:
  23. - atomic-openshift-node
  24. - docker
  25. - name: restart openvswitch
  26. service:
  27. name: openvswitch
  28. state: restarted
  29. - name: wait 5 sec
  30. pause:
  31. seconds: 5
  32. - name: start openshift/docker
  33. service:
  34. name: "{{ item }}"
  35. state: started
  36. with_items:
  37. - atomic-openshift-node
  38. - docker
  39. - name: start monitoring containers
  40. service:
  41. name: "{{ item }}"
  42. state: restarted
  43. with_items:
  44. - oso-rhel7-host-monitoring