blob: d8ad417978b202bf215547b81ba8093d38322ef0 [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
Tatyana Leontovichd0333462018-03-16 12:40:44 +020069#Launch containers
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
75 node_name: {{ HOSTNAME_CFG01 }}
76 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}
86 skip_fail: false
87
Tatyana Leontovichd0333462018-03-16 12:40:44 +020088- description: launch prometheus containers
89 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
90 node_name: {{ HOSTNAME_CFG01 }}
91 retry: {count: 2, delay: 10}
92 skip_fail: false
93
94- description: Check docker ps
95 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
96 node_name: {{ HOSTNAME_CFG01 }}
97 retry: {count: 2, delay: 10}
98 skip_fail: false
99
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200100- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200101 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 +0200102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 2, delay: 10}
104 skip_fail: false
105
106- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
107 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200108 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
109 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200110 fi
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 10}
113 skip_fail: false
114
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200115- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200116 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 +0200117 node_name: {{ HOSTNAME_CFG01 }}
118 retry: {count: 1, delay: 10}
119 skip_fail: false
120
121- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200122 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 +0200123 node_name: {{ HOSTNAME_CFG01 }}
124 retry: {count: 1, delay: 10}
125 skip_fail: false
126
127- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200128 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 +0200129 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300130 retry: {count: 2, delay: 30}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200131 skip_fail: false
132
133- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200134 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 +0200135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 10}
137 skip_fail: false
138
139- description: Check influix db
140 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200141 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 +0200142 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
143 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200144 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200145 fi
146 node_name: {{ HOSTNAME_CFG01 }}
147 retry: {count: 1, delay: 5}
148 skip_fail: true
149
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200150# Install Prometheus LTS(optional if set in model)
151- description: Prometheus LTS(optional if set in model)
152 cmd: |
153 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
154 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
155 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
156 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
157 fi
158 node_name: {{ HOSTNAME_CFG01 }}
159 retry: {count: 1, delay: 5}
160 skip_fail: true
161
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200162# Install service for the log collection
163- description: Configure fluentd
164 cmd: |
165 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
166 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200167 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200168 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
169 else
170 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
171 fi
172 node_name: {{ HOSTNAME_CFG01 }}
173 retry: {count: 1, delay: 10}
174 skip_fail: false
175
176#Install heka ceilometer collector
177- description: Install heka ceilometer if they exists
178 cmd: |
179 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`;
180 echo "Ceilometer service presence: ${CEILO}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200181 if [[ "$CEILO" == "true" ]]; then
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200182 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 +0200183 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 +0200184 fi
185 node_name: {{ HOSTNAME_CFG01 }}
186 retry: {count: 1, delay: 10}
187 skip_fail: false
188
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200189# Collect grains needed to configure the services
190
191- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200192 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 +0200193 node_name: {{ HOSTNAME_CFG01 }}
194 retry: {count: 1, delay: 10}
195 skip_fail: false
196
197- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200198 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200199 node_name: {{ HOSTNAME_CFG01 }}
200 retry: {count: 1, delay: 10}
201 skip_fail: false
202
203- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200204 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 +0200205 node_name: {{ HOSTNAME_CFG01 }}
206 retry: {count: 5, delay: 15}
207 skip_fail: false
208
209# Configure the services running in Docker Swarm
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200210- description: Configure prometheus in docker swarm
211 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 +0200212 node_name: {{ HOSTNAME_CFG01 }}
213 retry: {count: 1, delay: 10}
214 skip_fail: false
215
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200216- description: Configure Remote Collector in Docker Swarm for Openstack deployments
217 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 +0200218 node_name: {{ HOSTNAME_CFG01 }}
219 retry: {count: 1, delay: 10}
220 skip_fail: false
221
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200222- description: Install sphinx
223 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200224 node_name: {{ HOSTNAME_CFG01 }}
225 retry: {count: 1, delay: 10}
226 skip_fail: false
227
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200228
229#- description: Install prometheus alertmanager
230# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
231# node_name: {{ HOSTNAME_CFG01 }}
232# retry: {count: 1, delay: 10}
233# skip_fail: false
234
235#- description: run docker state
236# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
237# node_name: {{ HOSTNAME_CFG01 }}
238# retry: {count: 1, delay: 10}
239# skip_fail: false
240#
241#- description: docker ps
242# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
243# node_name: {{ HOSTNAME_CFG01 }}
244# retry: {count: 1, delay: 10}
245# skip_fail: false
246
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200247- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200248 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 +0200249 node_name: {{ HOSTNAME_CFG01 }}
250 retry: {count: 2, delay: 10}
251 skip_fail: false
252
253- description: Run salt minion to create cert files
254 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
255 node_name: {{ HOSTNAME_CFG01 }}
256 retry: {count: 1, delay: 10}
257 skip_fail: false
258
259{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
260{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}