blob: 5a62809c5ae212aa5c2995ffe1779effbea55ccb [file] [log] [blame]
Dennis Dmitriev47433912018-03-25 04:24:59 +03001{% from 'cookied-mcp-pike-dvr-ssl/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovichc447b122018-02-22 12:30:42 +02002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
3# Install docker swarm
Tatyana Leontovichc447b122018-02-22 12:30:42 +02004- description: Configure docker service
5 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
6 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 10}
8 skip_fail: false
9
10- description: Install docker swarm on master node
11 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
12 node_name: {{ HOSTNAME_CFG01 }}
13 retry: {count: 1, delay: 10}
14 skip_fail: false
15
16- description: Send grains to the swarm slave nodes
17 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
18 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 1, delay: 10}
20 skip_fail: false
21
22- description: Update mine
23 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
24 node_name: {{ HOSTNAME_CFG01 }}
25 retry: {count: 1, delay: 10}
26 skip_fail: false
27
28- description: Refresh modules
29 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
30 node_name: {{ HOSTNAME_CFG01 }}
31 retry: {count: 1, delay: 10}
32 skip_fail: false
33
34- description: Rerun swarm on slaves to proper token population
35 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
36 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
40- description: Configure slave nodes
41 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
42 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
46- description: List registered Docker swarm nodes
47 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
48 node_name: {{ HOSTNAME_CFG01 }}
49 retry: {count: 1, delay: 10}
50 skip_fail: false
51
Dennis Dmitriev002c2672018-03-06 18:43:27 +020052- description: Install keepalived on mon nodes
53 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
54 -C 'mon*' state.sls keepalived
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
59- description: Check the VIP on mon nodes
60 cmd: |
61 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
62 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
63 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
64 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 5}
66 skip_fail: false
67
Tatyana Leontovichc447b122018-02-22 12:30:42 +020068# Install slv2 infra
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000069# Install MongoDB for alerta
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030070- description: Install Mongo if target matches
71 cmd: |
72 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
73 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb
74 fi
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000075 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030076 retry: {count: 1, delay: 10}
77 skip_fail: false
78
79- description: Configure Alerta if it is exists
80 cmd: |
81 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:alerta' match.pillar 'prometheus:alerta' ; then
82 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:alerta' state.sls prometheus.alerta
83 fi
84 node_name: {{ HOSTNAME_CFG01 }}
85 retry: {count: 1, delay: 10}
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000086 skip_fail: false
87
Tatyana Leontovichc447b122018-02-22 12:30:42 +020088- description: Install telegraf
89 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
90 node_name: {{ HOSTNAME_CFG01 }}
91 retry: {count: 2, delay: 10}
92 skip_fail: false
93
94- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
95 cmd: |
96 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
97 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
98 fi
99 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 10}
101 skip_fail: false
102
103- description: Configure fluentd
104 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 10}
107 skip_fail: false
108
109- description: Install elasticsearch server
110 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 10}
113 skip_fail: false
114
115- description: Install kibana server
116 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
117 node_name: {{ HOSTNAME_CFG01 }}
118 retry: {count: 1, delay: 10}
119 skip_fail: false
120
121- description: Install elasticsearch client
122 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
123 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300124 retry: {count: 2, delay: 30}
Tatyana Leontovichc447b122018-02-22 12:30:42 +0200125 skip_fail: false
126
127- description: Install kibana client
128 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
133- description: Check influix db
134 cmd: |
135 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
136 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
137 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
138 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
139 fi
140 node_name: {{ HOSTNAME_CFG01 }}
141 retry: {count: 1, delay: 5}
142 skip_fail: true
143
144# Collect grains needed to configure the services
145
146- description: Get grains
147 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
148 node_name: {{ HOSTNAME_CFG01 }}
149 retry: {count: 1, delay: 10}
150 skip_fail: false
151
152- description: Sync modules
153 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 1, delay: 10}
156 skip_fail: false
157
158- description: Update mine
159 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 5, delay: 15}
162 skip_fail: false
163
164# Configure the services running in Docker Swarm
165- description: Install prometheus alertmanager
166 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
167 node_name: {{ HOSTNAME_CFG01 }}
168 retry: {count: 1, delay: 10}
169 skip_fail: false
170
171- description: run docker state
172 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
173 node_name: {{ HOSTNAME_CFG01 }}
174 retry: {count: 1, delay: 10}
175 skip_fail: false
176
177- description: docker ps
178 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
179 node_name: {{ HOSTNAME_CFG01 }}
180 retry: {count: 1, delay: 10}
181 skip_fail: false
182
183- description: Configure Grafana dashboards and datasources
184 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
185 node_name: {{ HOSTNAME_CFG01 }}
186 retry: {count: 2, delay: 10}
187 skip_fail: false
188
189- description: Run salt minion to create cert files
190 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
191 node_name: {{ HOSTNAME_CFG01 }}
192 retry: {count: 1, delay: 10}
193 skip_fail: false
194
195{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
196{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}