blob: 925c7950dd14299407d76d5558c9103ea64a510d [file] [log] [blame]
sgudz8c888ec2017-10-02 15:29:23 +03001{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
2
sgudzddca7322018-04-20 12:56:10 +03003# Install docker swarm
sgudz8c888ec2017-10-02 15:29:23 +03004- 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
sgudz8c888ec2017-10-02 15:29:23 +03006 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
sgudz8c888ec2017-10-02 15:29:23 +030012 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
sgudz8c888ec2017-10-02 15:29:23 +030018 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
sgudz8c888ec2017-10-02 15:29:23 +030024 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;
sgudz8c888ec2017-10-02 15:29:23 +030030 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
sgudz8c888ec2017-10-02 15:29:23 +030036 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
sgudz8c888ec2017-10-02 15:29:23 +030042 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'
sgudz8c888ec2017-10-02 15:29:23 +030048 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
sgudzddca7322018-04-20 12:56:10 +030059- description: Check the VIP on mon nodes
Dennis Dmitriev002c2672018-03-06 18:43:27 +020060 cmd: |
sgudzddca7322018-04-20 12:56:10 +030061 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
62 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
Dennis Dmitriev002c2672018-03-06 18:43:27 +020063 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
sgudz8c888ec2017-10-02 15:29:23 +030068# Install slv2 infra
sgudzddca7322018-04-20 12:56:10 +030069#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 }}
sgudz468b08a2018-07-16 12:55:33 +030076 retry: {count: 2, delay: 30}
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030077 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
sgudzddca7322018-04-20 12:56:10 +030088- 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
sgudz8c888ec2017-10-02 15:29:23 +0300100- 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
sgudz8c888ec2017-10-02 15:29:23 +0300102 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
sgudz8c888ec2017-10-02 15:29:23 +0300110 fi
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 10}
113 skip_fail: false
114
sgudz468b08a2018-07-16 12:55:33 +0300115- description: Configure Prometheus exporters, if pillar 'prometheus:collector' exists on any server
116 cmd: |
117 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:collector' match.pillar 'prometheus:collector' ; then
118 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:collector' state.sls prometheus.collector
119 fi
120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 10}
122 skip_fail: false
123
sgudz8c888ec2017-10-02 15:29:23 +0300124- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200125 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
sgudz8c888ec2017-10-02 15:29:23 +0300126 node_name: {{ HOSTNAME_CFG01 }}
127 retry: {count: 1, delay: 10}
128 skip_fail: false
129
130- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200131 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
sgudz8c888ec2017-10-02 15:29:23 +0300132 node_name: {{ HOSTNAME_CFG01 }}
133 retry: {count: 1, delay: 10}
134 skip_fail: false
135
136- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200137 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
sgudz8c888ec2017-10-02 15:29:23 +0300138 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300139 retry: {count: 2, delay: 30}
sgudz8c888ec2017-10-02 15:29:23 +0300140 skip_fail: false
141
142- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200143 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
sgudz8c888ec2017-10-02 15:29:23 +0300144 node_name: {{ HOSTNAME_CFG01 }}
145 retry: {count: 1, delay: 10}
146 skip_fail: false
147
148- description: Check influix db
149 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200150 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
sgudz8c888ec2017-10-02 15:29:23 +0300151 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
152 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200153 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
sgudz8c888ec2017-10-02 15:29:23 +0300154 fi
155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 5}
157 skip_fail: true
158
sgudzddca7322018-04-20 12:56:10 +0300159# Install Prometheus LTS(optional if set in model)
160- description: Prometheus LTS(optional if set in model)
161 cmd: |
162 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
163 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
164 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
165 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
166 fi
167 node_name: {{ HOSTNAME_CFG01 }}
168 retry: {count: 1, delay: 5}
169 skip_fail: true
170
171# Install service for the log collection
172- description: Configure fluentd
173 cmd: |
174 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
175 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
176 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
177 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
178 else
179 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
180 fi
181 node_name: {{ HOSTNAME_CFG01 }}
182 retry: {count: 1, delay: 10}
183 skip_fail: false
184
185#Install heka ceilometer collector
186- description: Install heka ceilometer if they exists
187 cmd: |
188 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`;
189 echo "Ceilometer service presence: ${CEILO}";
190 if [[ "$CEILO" == "true" ]]; then
191 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
192 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
193 fi
194 node_name: {{ HOSTNAME_CFG01 }}
195 retry: {count: 1, delay: 10}
196 skip_fail: false
197
sgudz8c888ec2017-10-02 15:29:23 +0300198# Collect grains needed to configure the services
199
200- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200201 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
sgudz8c888ec2017-10-02 15:29:23 +0300202 node_name: {{ HOSTNAME_CFG01 }}
203 retry: {count: 1, delay: 10}
204 skip_fail: false
205
206- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200207 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
sgudz8c888ec2017-10-02 15:29:23 +0300208 node_name: {{ HOSTNAME_CFG01 }}
209 retry: {count: 1, delay: 10}
210 skip_fail: false
211
212- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200213 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
sgudz8c888ec2017-10-02 15:29:23 +0300214 node_name: {{ HOSTNAME_CFG01 }}
sgudzddca7322018-04-20 12:56:10 +0300215 retry: {count: 5, delay: 15}
sgudz8c888ec2017-10-02 15:29:23 +0300216 skip_fail: false
217
sgudz8c888ec2017-10-02 15:29:23 +0300218# Configure the services running in Docker Swarm
sgudzddca7322018-04-20 12:56:10 +0300219- description: Configure prometheus in docker swarm
220 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
sgudz8c888ec2017-10-02 15:29:23 +0300221 node_name: {{ HOSTNAME_CFG01 }}
222 retry: {count: 1, delay: 10}
223 skip_fail: false
224
sgudzddca7322018-04-20 12:56:10 +0300225- description: Configure Remote Collector in Docker Swarm for Openstack deployments
226 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
227 node_name: {{ HOSTNAME_CFG01 }}
228 retry: {count: 1, delay: 10}
229 skip_fail: false
230
231- description: Install sphinx
232 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
233 node_name: {{ HOSTNAME_CFG01 }}
234 retry: {count: 1, delay: 10}
235 skip_fail: false
236
237
238#- description: Install prometheus alertmanager
239# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
240# node_name: {{ HOSTNAME_CFG01 }}
241# retry: {count: 1, delay: 10}
242# skip_fail: false
243
244#- description: run docker state
245# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
246# node_name: {{ HOSTNAME_CFG01 }}
247# retry: {count: 1, delay: 10}
248# skip_fail: false
249#
250#- description: docker ps
251# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
252# node_name: {{ HOSTNAME_CFG01 }}
253# retry: {count: 1, delay: 10}
254# skip_fail: false
255
sgudz8c888ec2017-10-02 15:29:23 +0300256- description: Configure Grafana dashboards and datasources
sgudzddca7322018-04-20 12:56:10 +0300257 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
sgudz8c888ec2017-10-02 15:29:23 +0300258 node_name: {{ HOSTNAME_CFG01 }}
259 retry: {count: 2, delay: 10}
260 skip_fail: false
261
262- description: Run salt minion to create cert files
263 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
264 node_name: {{ HOSTNAME_CFG01 }}
sgudz468b08a2018-07-16 12:55:33 +0300265 retry: {count: 3, delay: 15}
sgudz8c888ec2017-10-02 15:29:23 +0300266 skip_fail: false