blob: 995d21f6a1783ef6fb701356d9e04c5786cefc32 [file] [log] [blame]
Dennis Dmitriev67aea4a2018-03-14 14:20:20 +02001{% from 'cookied-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
3# Install docker swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02004- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02005 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 +02006 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 10}
8 skip_fail: false
9
10- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020011 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 +020012 node_name: {{ HOSTNAME_CFG01 }}
13 retry: {count: 1, delay: 10}
14 skip_fail: false
15
16- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020017 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 +020018 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 1, delay: 10}
20 skip_fail: false
21
22- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020023 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020024 node_name: {{ HOSTNAME_CFG01 }}
25 retry: {count: 1, delay: 10}
26 skip_fail: false
27
28- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020029 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 +020030 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
Dennis Dmitriev281221b2018-02-13 16:40:48 +020035 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 +020036 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
40- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020041 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 +020042 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
46- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020047 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 +020048 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 Leontovichb0b68d92018-01-11 13:27:08 +020068# Install slv2 infra
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040069# 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
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040073 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.server
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030074 fi
75 node_name: {{ HOSTNAME_CFG01 }}
76 retry: {count: 1, delay: 10}
77 skip_fail: false
78
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040079# Create MongoDB cluster
80- description: Install Mongo if target matches
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030081 cmd: |
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040082 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
83 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.cluster
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030084 fi
85 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040086 retry: {count: 5, delay: 20}
Tatyana Leontovichd0333462018-03-16 12:40:44 +020087 skip_fail: false
88
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020089- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020090 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 +020091 node_name: {{ HOSTNAME_CFG01 }}
92 retry: {count: 2, delay: 10}
93 skip_fail: false
94
95- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
96 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020097 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
98 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020099 fi
100 node_name: {{ HOSTNAME_CFG01 }}
101 retry: {count: 1, delay: 10}
102 skip_fail: false
103
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200104- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200105 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 +0200106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 1, delay: 10}
108 skip_fail: false
109
110- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200111 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 +0200112 node_name: {{ HOSTNAME_CFG01 }}
113 retry: {count: 1, delay: 10}
114 skip_fail: false
115
116- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200117 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 +0200118 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300119 retry: {count: 2, delay: 30}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200120 skip_fail: false
121
122- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200123 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 +0200124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 1, delay: 10}
126 skip_fail: false
127
128- description: Check influix db
129 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200130 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 +0200131 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
132 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200133 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200134 fi
135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 5}
137 skip_fail: true
138
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200139# Install Prometheus LTS(optional if set in model)
140- description: Prometheus LTS(optional if set in model)
141 cmd: |
142 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
143 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
144 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
145 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
146 fi
147 node_name: {{ HOSTNAME_CFG01 }}
148 retry: {count: 1, delay: 5}
149 skip_fail: true
150
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200151# Install service for the log collection
152- description: Configure fluentd
153 cmd: |
154 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
155 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200156 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200157 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
158 else
159 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
160 fi
161 node_name: {{ HOSTNAME_CFG01 }}
162 retry: {count: 1, delay: 10}
163 skip_fail: false
164
165#Install heka ceilometer collector
166- description: Install heka ceilometer if they exists
167 cmd: |
168 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`;
169 echo "Ceilometer service presence: ${CEILO}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200170 if [[ "$CEILO" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200171 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 +0200172 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 +0200173 fi
174 node_name: {{ HOSTNAME_CFG01 }}
175 retry: {count: 1, delay: 10}
176 skip_fail: false
177
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200178# Collect grains needed to configure the services
179
180- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200181 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 +0200182 node_name: {{ HOSTNAME_CFG01 }}
183 retry: {count: 1, delay: 10}
184 skip_fail: false
185
186- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200187 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200188 node_name: {{ HOSTNAME_CFG01 }}
189 retry: {count: 1, delay: 10}
190 skip_fail: false
191
192- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200193 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 +0200194 node_name: {{ HOSTNAME_CFG01 }}
195 retry: {count: 5, delay: 15}
196 skip_fail: false
197
198# Configure the services running in Docker Swarm
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200199- description: Configure prometheus in docker swarm
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400200 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 +0200201 node_name: {{ HOSTNAME_CFG01 }}
202 retry: {count: 1, delay: 10}
203 skip_fail: false
204
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400205#Launch containers
206- description: launch prometheus containers
207 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 +0200208 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400209 retry: {count: 2, delay: 10}
210 skip_fail: false
211
212- description: Check docker ps
213 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
214 node_name: {{ HOSTNAME_CFG01 }}
215 retry: {count: 2, delay: 10}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200216 skip_fail: false
217
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200218- description: Install sphinx
219 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200220 node_name: {{ HOSTNAME_CFG01 }}
221 retry: {count: 1, delay: 10}
222 skip_fail: false
223
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200224
225#- description: Install prometheus alertmanager
226# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
227# node_name: {{ HOSTNAME_CFG01 }}
228# retry: {count: 1, delay: 10}
229# skip_fail: false
230
231#- description: run docker state
232# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
233# node_name: {{ HOSTNAME_CFG01 }}
234# retry: {count: 1, delay: 10}
235# skip_fail: false
236#
237#- description: docker ps
238# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
239# node_name: {{ HOSTNAME_CFG01 }}
240# retry: {count: 1, delay: 10}
241# skip_fail: false
242
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200243- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200244 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 +0200245 node_name: {{ HOSTNAME_CFG01 }}
246 retry: {count: 2, delay: 10}
247 skip_fail: false
248
249- description: Run salt minion to create cert files
250 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
251 node_name: {{ HOSTNAME_CFG01 }}
252 retry: {count: 1, delay: 10}
253 skip_fail: false
254
255{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
256{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}