blob: 83f70e5faa67443f5c35655f6d9155b1561cd96b [file] [log] [blame]
Dennis Dmitriev67aea4a2018-03-14 14:20:20 +02001{% from 'cookied-mcp-pike-ovs/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02002
3{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
4
5# Install docker swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02006- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02007 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02008 node_name: {{ HOSTNAME_CFG01 }}
9 retry: {count: 1, delay: 10}
10 skip_fail: false
11
12- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020013 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020014 node_name: {{ HOSTNAME_CFG01 }}
15 retry: {count: 1, delay: 10}
16 skip_fail: false
17
18- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020019 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020020 node_name: {{ HOSTNAME_CFG01 }}
21 retry: {count: 1, delay: 10}
22 skip_fail: false
23
24- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020025 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020026 node_name: {{ HOSTNAME_CFG01 }}
27 retry: {count: 1, delay: 10}
28 skip_fail: false
29
30- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020031 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020032 node_name: {{ HOSTNAME_CFG01 }}
33 retry: {count: 1, delay: 10}
34 skip_fail: false
35
36- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020037 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020038 node_name: {{ HOSTNAME_CFG01 }}
39 retry: {count: 1, delay: 10}
40 skip_fail: false
41
42- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020043 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020044 node_name: {{ HOSTNAME_CFG01 }}
45 retry: {count: 1, delay: 10}
46 skip_fail: false
47
48- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020049 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020050 node_name: {{ HOSTNAME_CFG01 }}
51 retry: {count: 1, delay: 10}
52 skip_fail: false
53
Dennis Dmitriev002c2672018-03-06 18:43:27 +020054- description: Install keepalived on mon nodes
55 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
56 -C 'mon*' state.sls keepalived
57 node_name: {{ HOSTNAME_CFG01 }}
58 retry: {count: 1, delay: 10}
59 skip_fail: false
60
61- description: Check the VIP on mon nodes
62 cmd: |
63 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
64 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
65 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
66 node_name: {{ HOSTNAME_CFG01 }}
67 retry: {count: 1, delay: 5}
68 skip_fail: false
69
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020070# Install slv2 infra
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000071# Install MongoDB for alerta
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030072- description: Install Mongo if target matches
73 cmd: |
74 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040075 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.server
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030076 fi
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000077 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030078 retry: {count: 1, delay: 10}
79 skip_fail: false
80
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040081# Create MongoDB cluster
82- description: Install Mongo if target matches
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030083 cmd: |
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040084 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
85 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.cluster
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030086 fi
87 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040088 retry: {count: 5, delay: 20}
Tatyana Leontovichd0333462018-03-16 12:40:44 +020089 skip_fail: false
90
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020091- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020092 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020093 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 2, delay: 10}
95 skip_fail: false
96
Tatyana Leontovichd0333462018-03-16 12:40:44 +020097- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
98 cmd: |
99 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
100 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
101 fi
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 1, delay: 10}
104 skip_fail: false
105
106- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200107 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200108 node_name: {{ HOSTNAME_CFG01 }}
109 retry: {count: 1, delay: 10}
110 skip_fail: false
111
112- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200113 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200114 node_name: {{ HOSTNAME_CFG01 }}
115 retry: {count: 1, delay: 10}
116 skip_fail: false
117
118- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200119 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200120 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300121 retry: {count: 2, delay: 30}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200122 skip_fail: false
123
124- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200125 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200126 node_name: {{ HOSTNAME_CFG01 }}
127 retry: {count: 1, delay: 10}
128 skip_fail: false
129
130- description: Check influix db
131 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200132 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200133 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
134 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200135 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200136 fi
137 node_name: {{ HOSTNAME_CFG01 }}
138 retry: {count: 1, delay: 5}
139 skip_fail: true
140
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200141# Install Prometheus LTS(optional if set in model)
142- description: Prometheus LTS(optional if set in model)
143 cmd: |
144 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
145 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
146 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
147 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
148 fi
149 node_name: {{ HOSTNAME_CFG01 }}
150 retry: {count: 1, delay: 5}
151 skip_fail: true
152
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200153# Install service for the log collection
154- description: Configure fluentd
155 cmd: |
156 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
157 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200158 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200159 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
160 else
161 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
162 fi
163 node_name: {{ HOSTNAME_CFG01 }}
164 retry: {count: 1, delay: 10}
165 skip_fail: false
166
167#Install heka ceilometer collector
168- description: Install heka ceilometer if they exists
169 cmd: |
170 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`;
171 echo "Ceilometer service presence: ${CEILO}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200172 if [[ "$CEILO" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200173 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
Dennis Dmitrievd7ebbaf2018-03-20 05:44:30 +0200174 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200175 fi
176 node_name: {{ HOSTNAME_CFG01 }}
177 retry: {count: 1, delay: 10}
178 skip_fail: false
179
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200180# Collect grains needed to configure the services
181
182- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200183 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200184 node_name: {{ HOSTNAME_CFG01 }}
185 retry: {count: 1, delay: 10}
186 skip_fail: false
187
188- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200189 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200190 node_name: {{ HOSTNAME_CFG01 }}
191 retry: {count: 1, delay: 10}
192 skip_fail: false
193
194- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200195 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200196 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200197 retry: {count: 5, delay: 15}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200198 skip_fail: false
199
200# Configure the services running in Docker Swarm
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200201- description: Configure prometheus in docker swarm
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400202 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus,heka.remote_collector
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200203 node_name: {{ HOSTNAME_CFG01 }}
204 retry: {count: 1, delay: 10}
205 skip_fail: false
206
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400207#Launch containers
208- description: launch prometheus containers
209 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200210 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400211 retry: {count: 2, delay: 10}
212 skip_fail: false
213
214- description: Check docker ps
215 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
216 node_name: {{ HOSTNAME_CFG01 }}
217 retry: {count: 2, delay: 10}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200218 skip_fail: false
219
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200220- description: Install sphinx
221 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200222 node_name: {{ HOSTNAME_CFG01 }}
223 retry: {count: 1, delay: 10}
224 skip_fail: false
225
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200226
227#- description: Install prometheus alertmanager
228# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
229# node_name: {{ HOSTNAME_CFG01 }}
230# retry: {count: 1, delay: 10}
231# skip_fail: false
232
233#- description: run docker state
234# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
235# node_name: {{ HOSTNAME_CFG01 }}
236# retry: {count: 1, delay: 10}
237# skip_fail: false
238#
239#- description: docker ps
240# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
241# node_name: {{ HOSTNAME_CFG01 }}
242# retry: {count: 1, delay: 10}
243# skip_fail: false
244
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200245- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200246 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200247 node_name: {{ HOSTNAME_CFG01 }}
248 retry: {count: 2, delay: 10}
249 skip_fail: false
250
251- description: Run salt minion to create cert files
252 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
253 node_name: {{ HOSTNAME_CFG01 }}
254 retry: {count: 1, delay: 10}
255 skip_fail: false
256
257{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
258{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}