blob: 5f9f3e6d8e7c675941afff6e37aa7eed3263df72 [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
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000070# Install MongoDB for alerta
71- description: Install MongoDB
72 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 2, delay: 10}
75 skip_fail: false
76
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +040077#Launch containers
78- description: launch prometheus containers
79 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
80 node_name: {{ HOSTNAME_CFG01 }}
81 retry: {count: 2, delay: 10}
82 skip_fail: false
83
84- description: Check docker ps
85 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
86 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 2, delay: 10}
88 skip_fail: false
89
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030090- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020091 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 +030092 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030093 retry: {count: 2, delay: 10}
94 skip_fail: false
95
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030096- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
97 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020098 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
99 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +0300100 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +0300101 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300102 retry: {count: 1, delay: 10}
103 skip_fail: false
104
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300105- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200106 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 +0300107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300109 skip_fail: false
110
111- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200112 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 +0300113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 10}
115 skip_fail: false
116
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300117- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200118 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 +0300119 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300120 retry: {count: 2, delay: 30}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300121 skip_fail: false
122
123- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200124 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 +0300125 node_name: {{ HOSTNAME_CFG01 }}
126 retry: {count: 1, delay: 10}
127 skip_fail: false
128
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +0300129- description: Check influix db
130 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200131 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 +0300132 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
133 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200134 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +0300135 fi
136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 1, delay: 5}
138 skip_fail: true
139
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400140# Install Prometheus LTS(optional if set in model)
141- description: Prometheus LTS(optional if set in model)
142 cmd: |
143 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
144 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
145 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
146 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
147 fi
148 node_name: {{ HOSTNAME_CFG01 }}
149 retry: {count: 1, delay: 5}
150 skip_fail: true
151
152# Install service for the log collection
153- description: Configure fluentd
154 cmd: |
155 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
156 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
157 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
158 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
159 else
160 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
161 fi
162 node_name: {{ HOSTNAME_CFG01 }}
163 retry: {count: 1, delay: 10}
164 skip_fail: false
165
166#Install heka ceilometer collector
167- description: Install heka ceilometer if they exists
168 cmd: |
169 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`;
170 echo "Ceilometer service presence: ${CEILO}";
171 if [[ "$CEILO" == "true" ]]; then
172 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
173 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
174 fi
175 node_name: {{ HOSTNAME_CFG01 }}
176 retry: {count: 1, delay: 10}
177 skip_fail: false
178
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300179# Collect grains needed to configure the services
180
181- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200182 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 +0300183 node_name: {{ HOSTNAME_CFG01 }}
184 retry: {count: 1, delay: 10}
185 skip_fail: false
186
187- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200188 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300189 node_name: {{ HOSTNAME_CFG01 }}
190 retry: {count: 1, delay: 10}
191 skip_fail: false
192
193- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200194 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 +0300195 node_name: {{ HOSTNAME_CFG01 }}
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400196 retry: {count: 5, delay: 15}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300197 skip_fail: false
198
199# Configure the services running in Docker Swarm
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400200- description: Configure prometheus in docker swarm
201 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 +0300202 node_name: {{ HOSTNAME_CFG01 }}
203 retry: {count: 1, delay: 10}
204 skip_fail: false
205
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400206###
207# From pipeline-library:
208# if (!common.checkContains('STACK_INSTALL', 'k8s')) {
209# salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'heka.remote_collector', true, false)
210# }
211
212#- description: Configure Remote Collector in Docker Swarm for Openstack deployments
213# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
214# node_name: {{ HOSTNAME_CFG01 }}
215# retry: {count: 1, delay: 10}
216# skip_fail: false
217###
218
219- description: Install sphinx
220 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300221 node_name: {{ HOSTNAME_CFG01 }}
222 retry: {count: 1, delay: 10}
223 skip_fail: false
224
Victor Ryzhenkin2a2cd8e2018-05-07 18:38:43 +0400225
226#- description: Install prometheus alertmanager
227# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
228# node_name: {{ HOSTNAME_CFG01 }}
229# retry: {count: 1, delay: 10}
230# skip_fail: false
231
232#- description: run docker state
233# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
234# node_name: {{ HOSTNAME_CFG01 }}
235# retry: {count: 1, delay: 10}
236# skip_fail: false
237#
238#- description: docker ps
239# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
240# node_name: {{ HOSTNAME_CFG01 }}
241# retry: {count: 1, delay: 10}
242# skip_fail: false
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300243
244- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200245 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 +0300246 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300247 retry: {count: 2, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300248 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300249
250- description: Run salt minion to create cert files
251 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
252 node_name: {{ HOSTNAME_CFG01 }}
253 retry: {count: 1, delay: 10}
254 skip_fail: false
255