blob: cb929e406aa71ce4169743680f7e1c713199768d [file] [log] [blame]
sgudz33280bd2018-11-01 14:32:05 +02001{% from 'cookied-bm-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
sgudzfc5b22f2018-08-23 17:45:04 +03002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +03003
4# Install docker swarm
5- description: Configure docker service
6 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
7 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
9 skip_fail: false
10
11- description: Install docker swarm on master node
12 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
13 node_name: {{ HOSTNAME_CFG01 }}
14 retry: {count: 1, delay: 10}
15 skip_fail: false
16
17- description: Send grains to the swarm slave nodes
18 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
19 node_name: {{ HOSTNAME_CFG01 }}
20 retry: {count: 1, delay: 10}
21 skip_fail: false
22
23- description: Update mine
24 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
25 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 1, delay: 10}
27 skip_fail: false
28
29- description: Refresh modules
30 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
31 node_name: {{ HOSTNAME_CFG01 }}
32 retry: {count: 1, delay: 10}
33 skip_fail: false
34
35- description: Rerun swarm on slaves to proper token population
36 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
37 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 10}
39 skip_fail: false
40
41- description: Configure slave nodes
42 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
43 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 1, delay: 10}
45 skip_fail: false
46
47- description: List registered Docker swarm nodes
48 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
49 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
51 skip_fail: false
52
53- description: Install keepalived on mon nodes
54 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
55 -C 'mon*' state.sls keepalived
56 node_name: {{ HOSTNAME_CFG01 }}
57 retry: {count: 1, delay: 10}
58 skip_fail: false
59
60- description: Check the VIP on mon nodes
61 cmd: |
62 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
63 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
64 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
65 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 1, delay: 5}
67 skip_fail: false
68
sgudzfc5b22f2018-08-23 17:45:04 +030069- description: Install keepalived on mon nodes
70 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
71 -C 'I@glusterfs:client' state.sls glusterfs.client
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 2, delay: 15}
74 skip_fail: false
75
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030076# Install slv2 infra
77#Launch containers
78- description: Install Mongo if target matches
79 cmd: |
80 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
sgudzfc5b22f2018-08-23 17:45:04 +030081 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.server
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030082 fi
83 node_name: {{ HOSTNAME_CFG01 }}
84 retry: {count: 1, delay: 10}
85 skip_fail: false
86
sgudzfc5b22f2018-08-23 17:45:04 +030087- description: Install Mongo if target matches
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030088 cmd: |
sgudzfc5b22f2018-08-23 17:45:04 +030089 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
90 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.cluster
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030091 fi
92 node_name: {{ HOSTNAME_CFG01 }}
sgudzfc5b22f2018-08-23 17:45:04 +030093 retry: {count: 5, delay: 20}
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030094 skip_fail: false
95
96- description: Install telegraf
97 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 2, delay: 10}
100 skip_fail: false
101
102- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
103 cmd: |
104 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
105 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
106 fi
107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 10}
109 skip_fail: false
110
111- description: Install elasticsearch server
sgudzfc5b22f2018-08-23 17:45:04 +0300112 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true and *01*' state.sls elasticsearch.server
113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 10}
115 skip_fail: false
116
117- description: Install elasticsearch server
118 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true' state.sls elasticsearch.server
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300119 node_name: {{ HOSTNAME_CFG01 }}
120 retry: {count: 1, delay: 10}
121 skip_fail: false
122
123- description: Install kibana server
sgudzfc5b22f2018-08-23 17:45:04 +0300124 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true and *01*' state.sls kibana.server
125 node_name: {{ HOSTNAME_CFG01 }}
126 retry: {count: 1, delay: 10}
127 skip_fail: false
128
129- description: Install kibana server
130 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true' state.sls kibana.server
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300131 node_name: {{ HOSTNAME_CFG01 }}
132 retry: {count: 1, delay: 10}
133 skip_fail: false
134
135- description: Install elasticsearch client
sgudzfc5b22f2018-08-23 17:45:04 +0300136 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300137 node_name: {{ HOSTNAME_CFG01 }}
138 retry: {count: 2, delay: 30}
139 skip_fail: false
140
141- description: Install kibana client
142 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 10}
145 skip_fail: false
146
147- description: Check influix db
148 cmd: |
149 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
150 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
151 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
sgudzfc5b22f2018-08-23 17:45:04 +0300152 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server and *01*' state.sls influxdb;
153 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb;
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300154 fi
155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 5}
sgudzfc5b22f2018-08-23 17:45:04 +0300157 skip_fail: false
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300158
159# Install service for the log collection
160- description: Configure fluentd
161 cmd: |
162 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
163 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
164 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
165 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
166 else
167 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
168 fi
169 node_name: {{ HOSTNAME_CFG01 }}
170 retry: {count: 1, delay: 10}
171 skip_fail: false
172
173#Install heka ceilometer collector
174- description: Install heka ceilometer if they exists
175 cmd: |
176 CEILO=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' test.ping 1>/dev/null 2>&1 && echo true`;
177 echo "Ceilometer service presence: ${CEILO}";
178 if [[ "$CEILO" == "true" ]]; then
179 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
180 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
181 fi
182 node_name: {{ HOSTNAME_CFG01 }}
183 retry: {count: 1, delay: 10}
184 skip_fail: false
185
sgudzfc5b22f2018-08-23 17:45:04 +0300186 ######################################
187 ######################################
188 ######################################
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300189
sgudzfc5b22f2018-08-23 17:45:04 +0300190- description: Install Galera on first server
191 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
192 -C 'I@galera:master' state.sls galera
193 node_name: {{ HOSTNAME_CFG01 }}
194 retry: {count: 2, delay: 5}
195 skip_fail: false
196
197- description: Install Galera on other servers
198 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
199 -C 'I@galera:slave' state.sls galera -b 1
200 node_name: {{ HOSTNAME_CFG01 }}
201 retry: {count: 2, delay: 5}
202 skip_fail: false
203
204- description: Check Galera on first server
205 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
206 -C 'I@galera:master' mysql.status
207 node_name: {{ HOSTNAME_CFG01 }}
208 retry: {count: 1, delay: 5}
209 skip_fail: true
210
211- description: Check Galera on other servers
212 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
213 -C 'I@galera:slave' mysql.status
214 node_name: {{ HOSTNAME_CFG01 }}
215 retry: {count: 1, delay: 5}
216 skip_fail: true
217
218- description: Collect Grains
219 cmd: |
220 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains;
221 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules;
222 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300223 node_name: {{ HOSTNAME_CFG01 }}
224 retry: {count: 1, delay: 10}
225 skip_fail: false
226
sgudzfc5b22f2018-08-23 17:45:04 +0300227- description: Check docker ps
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300228 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
229 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300230 retry: {count: 2, delay: 10}
231 skip_fail: false
232
sgudzfc5b22f2018-08-23 17:45:04 +0300233- description: launch prometheus containers
234 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
235 node_name: {{ HOSTNAME_CFG01 }}
236 retry: {count: 2, delay: 10}
237 skip_fail: false
238
239- description: Check docker ps
240 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +0300241 node_name: {{ HOSTNAME_CFG01 }}
242 retry: {count: 1, delay: 10}
243 skip_fail: false
sgudzfc5b22f2018-08-23 17:45:04 +0300244
245- description: Configure Grafana dashboards and datasources
246 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
247 node_name: {{ HOSTNAME_CFG01 }}
248 retry: {count: 5, delay: 60}
249 skip_fail: false
250
251- description: Configure Alerta if it is exists
252 cmd: |
253 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:alerta' match.pillar 'prometheus:alerta' ; then
254 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:alerta' state.sls prometheus.alerta
255 fi
256 node_name: {{ HOSTNAME_CFG01 }}
257 retry: {count: 1, delay: 10}
258 skip_fail: false
259
260- description: Run salt minion to create cert files
261 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion.cert
262 node_name: {{ HOSTNAME_CFG01 }}
263 retry: {count: 1, delay: 10}
264 skip_fail: true
265
266{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
267{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}