blob: bf71b5987b7fd0c271df0c291da423a20a59a8e1 [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
75 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb
76 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
81- description: Configure Alerta if it is exists
82 cmd: |
83 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:alerta' match.pillar 'prometheus:alerta' ; then
84 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:alerta' state.sls prometheus.alerta
85 fi
86 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 1, delay: 10}
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000088 skip_fail: false
89
Tatyana Leontovichd0333462018-03-16 12:40:44 +020090#Launch containers
91- description: launch prometheus containers
92 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
93 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 2, delay: 10}
95 skip_fail: false
96
97- description: Check docker ps
98 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
99 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 2, delay: 10}
101 skip_fail: false
102
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200103- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200104 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 +0200105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 2, delay: 10}
107 skip_fail: false
108
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200109- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
110 cmd: |
111 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
112 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
113 fi
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 server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200119 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 +0200120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 10}
122 skip_fail: false
123
124- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200125 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 +0200126 node_name: {{ HOSTNAME_CFG01 }}
127 retry: {count: 1, delay: 10}
128 skip_fail: false
129
130- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200131 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 +0200132 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300133 retry: {count: 2, delay: 30}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200134 skip_fail: false
135
136- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200137 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 +0200138 node_name: {{ HOSTNAME_CFG01 }}
139 retry: {count: 1, delay: 10}
140 skip_fail: false
141
142- description: Check influix db
143 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200144 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 +0200145 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
146 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200147 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200148 fi
149 node_name: {{ HOSTNAME_CFG01 }}
150 retry: {count: 1, delay: 5}
151 skip_fail: true
152
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200153# Install Prometheus LTS(optional if set in model)
154- description: Prometheus LTS(optional if set in model)
155 cmd: |
156 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
157 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
158 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
159 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
160 fi
161 node_name: {{ HOSTNAME_CFG01 }}
162 retry: {count: 1, delay: 5}
163 skip_fail: true
164
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200165# Install service for the log collection
166- description: Configure fluentd
167 cmd: |
168 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
169 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200170 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200171 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
172 else
173 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
174 fi
175 node_name: {{ HOSTNAME_CFG01 }}
176 retry: {count: 1, delay: 10}
177 skip_fail: false
178
179#Install heka ceilometer collector
180- description: Install heka ceilometer if they exists
181 cmd: |
182 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`;
183 echo "Ceilometer service presence: ${CEILO}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200184 if [[ "$CEILO" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200185 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 +0200186 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 +0200187 fi
188 node_name: {{ HOSTNAME_CFG01 }}
189 retry: {count: 1, delay: 10}
190 skip_fail: false
191
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200192# Collect grains needed to configure the services
193
194- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200195 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 +0200196 node_name: {{ HOSTNAME_CFG01 }}
197 retry: {count: 1, delay: 10}
198 skip_fail: false
199
200- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200201 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200202 node_name: {{ HOSTNAME_CFG01 }}
203 retry: {count: 1, delay: 10}
204 skip_fail: false
205
206- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200207 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 +0200208 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200209 retry: {count: 5, delay: 15}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200210 skip_fail: false
211
212# Configure the services running in Docker Swarm
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200213- description: Configure prometheus in docker swarm
214 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200215 node_name: {{ HOSTNAME_CFG01 }}
216 retry: {count: 1, delay: 10}
217 skip_fail: false
218
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200219- description: Configure Remote Collector in Docker Swarm for Openstack deployments
220 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200221 node_name: {{ HOSTNAME_CFG01 }}
222 retry: {count: 1, delay: 10}
223 skip_fail: false
224
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200225- description: Install sphinx
226 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200227 node_name: {{ HOSTNAME_CFG01 }}
228 retry: {count: 1, delay: 10}
229 skip_fail: false
230
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200231
232#- description: Install prometheus alertmanager
233# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
234# node_name: {{ HOSTNAME_CFG01 }}
235# retry: {count: 1, delay: 10}
236# skip_fail: false
237
238#- description: run docker state
239# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
240# node_name: {{ HOSTNAME_CFG01 }}
241# retry: {count: 1, delay: 10}
242# skip_fail: false
243#
244#- description: docker ps
245# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
246# node_name: {{ HOSTNAME_CFG01 }}
247# retry: {count: 1, delay: 10}
248# skip_fail: false
249
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200250- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200251 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 +0200252 node_name: {{ HOSTNAME_CFG01 }}
253 retry: {count: 2, delay: 10}
254 skip_fail: false
255
256- description: Run salt minion to create cert files
257 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
258 node_name: {{ HOSTNAME_CFG01 }}
259 retry: {count: 1, delay: 10}
260 skip_fail: false
261
262{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
263{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}