blob: edb149dde60d3790ee5db9ed1585ea498127383e [file] [log] [blame]
Dennis Dmitriev411dd102017-09-15 16:04:47 +03001{% from 'cookied-mcp-ocata-dop-sl2/underlay.yaml' import HOSTNAME_CFG01 with context %}
Dennis Dmitriev386845b2017-11-21 13:11:12 +02002{% from 'cookied-mcp-ocata-dop-sl2/salt.yaml' import ENVIRONMENT_MODEL_INVENTORY_NAME with context %}
Dennis Dmitriev411dd102017-09-15 16:04:47 +03003
4# Install docker swarm
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +03007 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
9 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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;
Dennis Dmitriev411dd102017-09-15 16:04:47 +030031 node_name: {{ HOSTNAME_CFG01 }}
32 retry: {count: 1, delay: 10}
33 skip_fail: false
34
35- 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +030037 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 10}
39 skip_fail: false
40
41- 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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'
Dennis Dmitriev411dd102017-09-15 16:04:47 +030049 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
51 skip_fail: false
52
Dennis Dmitriev002c2672018-03-06 18:43:27 +020053- 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
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +020060- description: Check the VIP on mon nodes
Dennis Dmitriev002c2672018-03-06 18:43:27 +020061 cmd: |
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +020062 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
63 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
Dennis Dmitriev002c2672018-03-06 18:43:27 +020064 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +030069# Install slv2 infra
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +020070#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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +030085 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 2, delay: 10}
87 skip_fail: false
88
89- 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 Dmitriev411dd102017-09-15 16:04:47 +030093 fi
94 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 1, delay: 10}
96 skip_fail: false
97
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300100 node_name: {{ HOSTNAME_CFG01 }}
101 retry: {count: 1, delay: 10}
102 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 1, delay: 10}
108 skip_fail: false
109
110- 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300112 node_name: {{ HOSTNAME_CFG01 }}
113 retry: {count: 1, delay: 10}
114 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 10}
120 skip_fail: false
121
122- 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`;
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300128 fi
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 5}
131 skip_fail: true
132
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200133# 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}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200150 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200151 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}";
Tatyana Leontovich88cd51b2018-03-17 00:05:14 +0200164 if [[ "$CEILO" == "true" ]]; then
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200165 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 '@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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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
Dennis Dmitriev411dd102017-09-15 16:04:47 +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;
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300188 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200189 retry: {count: 5, delay: 15}
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300190 skip_fail: false
191
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300192# Configure the services running in Docker Swarm
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200193- 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
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300195 node_name: {{ HOSTNAME_CFG01 }}
196 retry: {count: 1, delay: 10}
197 skip_fail: false
198
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200199- description: Configure Remote Collector in Docker Swarm for Openstack deployments
200 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300201 node_name: {{ HOSTNAME_CFG01 }}
202 retry: {count: 1, delay: 10}
203 skip_fail: false
204
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200205- description: Install sphinx
206 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300207 node_name: {{ HOSTNAME_CFG01 }}
208 retry: {count: 1, delay: 10}
209 skip_fail: false
210
Tatyana Leontovichcdca5d92018-03-16 18:31:50 +0200211
212#- description: Install prometheus alertmanager
213# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
214# node_name: {{ HOSTNAME_CFG01 }}
215# retry: {count: 1, delay: 10}
216# skip_fail: false
217
218#- description: run docker state
219# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
220# node_name: {{ HOSTNAME_CFG01 }}
221# retry: {count: 1, delay: 10}
222# skip_fail: false
223#
224#- description: docker ps
225# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
226# node_name: {{ HOSTNAME_CFG01 }}
227# retry: {count: 1, delay: 10}
228# skip_fail: false
229
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300230- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200231 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300232 node_name: {{ HOSTNAME_CFG01 }}
233 retry: {count: 2, delay: 10}
234 skip_fail: false
235
236- description: Run salt minion to create cert files
237 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
238 node_name: {{ HOSTNAME_CFG01 }}
239 retry: {count: 1, delay: 10}
240 skip_fail: false
241