-
Notifications
You must be signed in to change notification settings - Fork 8
/
restart.yml
78 lines (67 loc) · 2.39 KB
/
restart.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
# Coordinate an orderly restart of the cluster if necessary.
#
# The variables in the "when:" clause are populated by the tasks in the worker role. This task
# has been split out from the main role so that it can be performed serially.
- hosts: deconst-worker
vars_files:
- vars.yml
- credentials.yml
serial: 1
tasks:
# The service module is smart: when you use it with with_nested or with_items, it consolidates
# actions into a single invocation of the underlying binary (systemctl). However, this is exactly
# what we *don't* want here, because then all of the services do the charging herd thing on their
# load balancers.
#
# Instead, manually restart each pod together by invoking systemctl directly.
- name: restart service pods
command: systemctl restart deconst-content@{{ item }}.service deconst-presenter@{{ item }}.service deconst-nginx@{{ item }}.service
with_items: pod_names
when: service_pod_restart|default(false)|bool
sudo: yes
tags: restart
- name: restart presenters only
command: systemctl restart deconst-presenter@{{ item }}.service deconst-nginx@{{ item }}.service
with_items: pod_names
when: presenter_restart|default(false)|bool
sudo: yes
tags: restart
- name: restart nginx only
command: systemctl restart deconst-nginx@{{ item }}.service
with_items: pod_names
when: nginx_restart|default(false)|bool
sudo: yes
tags: restart
- name: restart logstash-forwarder
service: name=logstash-forwarder state=restarted
when: logstash_forwarder_restart|default(false)|bool
sudo: yes
tags: restart
- hosts: deconst-staging
serial: 1
tasks:
- name: restart staging service pods
command: systemctl restart deconst-staging-content@{{ item }}.service deconst-staging-presenter@{{ item }}.service deconst-staging-nginx@{{ item }}.service
with_items: staging_pod_names
when: staging_restart|default(false)|bool
sudo: yes
tags: restart
- hosts: deconst-elastic
serial: 1
tasks:
- name: restart logstash
service: name=deconst-logstash.service state=restarted
when: logstash_restart|default(false)|bool
sudo: yes
tags: restart
- hosts: deconst-build
serial: 1
tasks:
- name: restart strider
command: |
systemctl restart
deconst-strider.service deconst-nginx-build.service
when: strider_restart|default(false)|bool
sudo: yes
tags: restart