summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml
blob: ae7d01730d7655beefb8a455923575f14f108393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/ansible-playbook
---
#example run:
# ansible-playbook -e "host=ops-node-compute-abcde" oo-sdn-restart.yml
#

- name: Check vars
  hosts: localhost
  gather_facts: false

  pre_tasks:
  - fail:
      msg: "Playbook requires host to be set"
    when: host is not defined or host == ''

- name: Restart openshift/docker (and monitoring containers)
  hosts: oo_version_3:&oo_name_{{ host }}
  gather_facts: false
  user: root

  tasks:
  - name: stop openshift/docker
    service:
      name: "{{ item }}"
      state: stopped
    with_items:
    - atomic-openshift-node
    - docker

  - name: restart openvswitch
    service:
      name: openvswitch
      state: restarted

  - name: wait 5 sec
    pause:
      seconds: 5

  - name: start openshift/docker
    service:
      name: "{{ item }}"
      state: started
    with_items:
    - atomic-openshift-node
    - docker

  - name: start monitoring containers
    service:
      name: "{{ item }}"
      state: restarted
    with_items:
    - oso-rhel7-host-monitoring