blob: 57c3eee5b6ce97660391917a295d951709f85ab6 [file] [log] [blame]
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03001{% from 'virtual-mcp11-k8s-calico/underlay.yaml' import HOSTNAME_CFG01 with context %}
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +04002{% from 'virtual-mcp11-k8s-calico/salt.yaml' import ENVIRONMENT_MODEL_INVENTORY_NAME with context %}
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03003
4# Install docker swarm
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +03005- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02006 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03007 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +03009 skip_fail: false
10
11- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020012 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030013 node_name: {{ HOSTNAME_CFG01 }}
14 retry: {count: 1, delay: 10}
15 skip_fail: false
16
17- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020018 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030019 node_name: {{ HOSTNAME_CFG01 }}
20 retry: {count: 1, delay: 10}
21 skip_fail: false
22
23- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020024 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030025 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 1, delay: 10}
27 skip_fail: false
28
29- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020030 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030031 node_name: {{ HOSTNAME_CFG01 }}
32 retry: {count: 1, delay: 10}
33 skip_fail: false
34
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030035- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020036 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030037 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 10}
39 skip_fail: false
40
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030041- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020042 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030043 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 1, delay: 10}
45 skip_fail: false
46
47- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020048 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030049 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
51 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030052
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +040053- 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
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030069# Install slv2 infra
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +040070#Launch containers
71- description: launch prometheus containers
72 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 2, delay: 10}
75 skip_fail: false
76
77- description: Check docker ps
78 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
79 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 2, delay: 10}
81 skip_fail: false
82
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030083- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020084 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030085 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030086 retry: {count: 2, delay: 10}
87 skip_fail: false
88
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030089- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
90 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020091 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
92 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030093 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030094 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030095 retry: {count: 1, delay: 10}
96 skip_fail: false
97
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030098- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020099 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300100 node_name: {{ HOSTNAME_CFG01 }}
101 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300102 skip_fail: false
103
104- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200105 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 1, delay: 10}
108 skip_fail: false
109
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300110- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200111 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300112 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300113 retry: {count: 2, delay: 30}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300114 skip_fail: false
115
116- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200117 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 10}
120 skip_fail: false
121
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +0300122- description: Check influix db
123 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200124 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 Leontovich3645d2b2017-06-13 16:51:23 +0300125 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
126 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200127 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +0300128 fi
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 5}
131 skip_fail: true
132
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400133# Install Prometheus LTS(optional if set in model)
134- description: Prometheus LTS(optional if set in model)
135 cmd: |
136 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
137 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
138 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
139 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
140 fi
141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 5}
143 skip_fail: true
144
145# Install service for the log collection
146- description: Configure fluentd
147 cmd: |
148 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
149 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
150 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
151 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
152 else
153 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
154 fi
155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 10}
157 skip_fail: false
158
159#Install heka ceilometer collector
160- description: Install heka ceilometer if they exists
161 cmd: |
162 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`;
163 echo "Ceilometer service presence: ${CEILO}";
164 if [[ "$CEILO" == "true" ]]; then
165 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
166 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
167 fi
168 node_name: {{ HOSTNAME_CFG01 }}
169 retry: {count: 1, delay: 10}
170 skip_fail: false
171
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300172# Collect grains needed to configure the services
173
174- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200175 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300176 node_name: {{ HOSTNAME_CFG01 }}
177 retry: {count: 1, delay: 10}
178 skip_fail: false
179
180- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200181 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300182 node_name: {{ HOSTNAME_CFG01 }}
183 retry: {count: 1, delay: 10}
184 skip_fail: false
185
186- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200187 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300188 node_name: {{ HOSTNAME_CFG01 }}
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400189 retry: {count: 5, delay: 15}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300190 skip_fail: false
191
192# Configure the services running in Docker Swarm
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400193- description: Configure prometheus in docker swarm
194 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300195 node_name: {{ HOSTNAME_CFG01 }}
196 retry: {count: 1, delay: 10}
197 skip_fail: false
198
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400199###
200# From pipeline-library:
201# if (!common.checkContains('STACK_INSTALL', 'k8s')) {
202# salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'heka.remote_collector', true, false)
203# }
204
205#- description: Configure Remote Collector in Docker Swarm for Openstack deployments
206# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
207# node_name: {{ HOSTNAME_CFG01 }}
208# retry: {count: 1, delay: 10}
209# skip_fail: false
210###
211
212- description: Install sphinx
213 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300214 node_name: {{ HOSTNAME_CFG01 }}
215 retry: {count: 1, delay: 10}
216 skip_fail: false
217
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400218
219#- description: Install prometheus alertmanager
220# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
221# node_name: {{ HOSTNAME_CFG01 }}
222# retry: {count: 1, delay: 10}
223# skip_fail: false
224
225#- description: run docker state
226# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
227# node_name: {{ HOSTNAME_CFG01 }}
228# retry: {count: 1, delay: 10}
229# skip_fail: false
230#
231#- description: docker ps
232# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
233# node_name: {{ HOSTNAME_CFG01 }}
234# retry: {count: 1, delay: 10}
235# skip_fail: false
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300236
237- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200238 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300239 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300240 retry: {count: 2, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300241 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300242
243- description: Run salt minion to create cert files
244 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
245 node_name: {{ HOSTNAME_CFG01 }}
246 retry: {count: 1, delay: 10}
247 skip_fail: false
248