blob: 0a3867a65518591c71cd23bdafa80880f553b520 [file] [log] [blame]
sgudz8c888ec2017-10-02 15:29:23 +03001{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
sgudze12b5092018-09-15 00:40:10 +03002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
sgudz8c888ec2017-10-02 15:29:23 +03003
sgudzddca7322018-04-20 12:56:10 +03004# Install docker swarm
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +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;
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +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'
sgudz8c888ec2017-10-02 15:29:23 +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
sgudzddca7322018-04-20 12:56:10 +030060- description: Check the VIP on mon nodes
Dennis Dmitriev002c2672018-03-06 18:43:27 +020061 cmd: |
sgudzddca7322018-04-20 12:56:10 +030062 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
sgudze12b5092018-09-15 00:40:10 +030069- description: Install keepalived on mon nodes
70 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
71 -C 'I@glusterfs:client' state.sls glusterfs.client
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 2, delay: 15}
74 skip_fail: false
75
sgudz8c888ec2017-10-02 15:29:23 +030076# Install slv2 infra
sgudzddca7322018-04-20 12:56:10 +030077#Launch containers
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030078- description: Install Mongo if target matches
79 cmd: |
80 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
sgudze12b5092018-09-15 00:40:10 +030081 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.server
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030082 fi
83 node_name: {{ HOSTNAME_CFG01 }}
84 retry: {count: 1, delay: 10}
85 skip_fail: false
86
sgudze12b5092018-09-15 00:40:10 +030087- description: Install Mongo if target matches
88 cmd: |
89 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
90 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.cluster
91 fi
sgudzddca7322018-04-20 12:56:10 +030092 node_name: {{ HOSTNAME_CFG01 }}
sgudze12b5092018-09-15 00:40:10 +030093 retry: {count: 5, delay: 20}
sgudzddca7322018-04-20 12:56:10 +030094 skip_fail: false
95
sgudz8c888ec2017-10-02 15:29:23 +030096- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020097 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 +030098 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 2, delay: 10}
100 skip_fail: false
101
102- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
103 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200104 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
105 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
sgudz8c888ec2017-10-02 15:29:23 +0300106 fi
107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 10}
109 skip_fail: false
110
sgudze12b5092018-09-15 00:40:10 +0300111- description: Install elasticsearch server
112 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true and *01*' state.sls elasticsearch.server
sgudz468b08a2018-07-16 12:55:33 +0300113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 10}
115 skip_fail: false
116
sgudz8c888ec2017-10-02 15:29:23 +0300117- description: Install elasticsearch server
sgudze12b5092018-09-15 00:40:10 +0300118 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true' state.sls elasticsearch.server
sgudz8c888ec2017-10-02 15:29:23 +0300119 node_name: {{ HOSTNAME_CFG01 }}
120 retry: {count: 1, delay: 10}
121 skip_fail: false
122
123- description: Install kibana server
sgudze12b5092018-09-15 00:40:10 +0300124 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true and *01*' state.sls kibana.server
125 node_name: {{ HOSTNAME_CFG01 }}
126 retry: {count: 1, delay: 10}
127 skip_fail: false
128
129- description: Install kibana server
130 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true' state.sls kibana.server
sgudz8c888ec2017-10-02 15:29:23 +0300131 node_name: {{ HOSTNAME_CFG01 }}
132 retry: {count: 1, delay: 10}
133 skip_fail: false
134
135- description: Install elasticsearch client
sgudze12b5092018-09-15 00:40:10 +0300136 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
sgudz8c888ec2017-10-02 15:29:23 +0300137 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300138 retry: {count: 2, delay: 30}
sgudz8c888ec2017-10-02 15:29:23 +0300139 skip_fail: false
140
141- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200142 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
sgudz8c888ec2017-10-02 15:29:23 +0300143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 10}
145 skip_fail: false
146
147- description: Check influix db
148 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200149 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 +0300150 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
151 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
sgudze12b5092018-09-15 00:40:10 +0300152 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server and *01*' state.sls influxdb;
153 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}
sgudze12b5092018-09-15 00:40:10 +0300157 skip_fail: false
sgudzddca7322018-04-20 12:56:10 +0300158
159# Install service for the log collection
160- description: Configure fluentd
161 cmd: |
162 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
163 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
164 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
165 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
166 else
167 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
168 fi
169 node_name: {{ HOSTNAME_CFG01 }}
170 retry: {count: 1, delay: 10}
171 skip_fail: false
172
173#Install heka ceilometer collector
174- description: Install heka ceilometer if they exists
175 cmd: |
176 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`;
177 echo "Ceilometer service presence: ${CEILO}";
178 if [[ "$CEILO" == "true" ]]; then
179 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
180 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
181 fi
182 node_name: {{ HOSTNAME_CFG01 }}
183 retry: {count: 1, delay: 10}
184 skip_fail: false
185
sgudze12b5092018-09-15 00:40:10 +0300186 ######################################
187 ######################################
188 ######################################
sgudz8c888ec2017-10-02 15:29:23 +0300189
sgudze12b5092018-09-15 00:40:10 +0300190- description: Collect Grains
191 cmd: |
192 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains;
193 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules;
194 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update
sgudz8c888ec2017-10-02 15:29:23 +0300195 node_name: {{ HOSTNAME_CFG01 }}
196 retry: {count: 1, delay: 10}
197 skip_fail: false
198
sgudze12b5092018-09-15 00:40:10 +0300199- description: Check docker ps
sgudzddca7322018-04-20 12:56:10 +0300200 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 +0300201 node_name: {{ HOSTNAME_CFG01 }}
sgudze12b5092018-09-15 00:40:10 +0300202 retry: {count: 2, delay: 10}
sgudz8c888ec2017-10-02 15:29:23 +0300203 skip_fail: false
204
sgudzddca7322018-04-20 12:56:10 +0300205- 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
sgudze12b5092018-09-15 00:40:10 +0300211- description: launch prometheus containers
212 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
sgudz8c888ec2017-10-02 15:29:23 +0300213 node_name: {{ HOSTNAME_CFG01 }}
214 retry: {count: 2, delay: 10}
215 skip_fail: false
216
sgudze12b5092018-09-15 00:40:10 +0300217- description: Check docker ps
218 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
sgudz8c888ec2017-10-02 15:29:23 +0300219 node_name: {{ HOSTNAME_CFG01 }}
sgudze12b5092018-09-15 00:40:10 +0300220 retry: {count: 1, delay: 10}
sgudz8c888ec2017-10-02 15:29:23 +0300221 skip_fail: false
sgudze12b5092018-09-15 00:40:10 +0300222
223- description: Configure Grafana dashboards and datasources
224 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
225 node_name: {{ HOSTNAME_CFG01 }}
226 retry: {count: 5, delay: 60}
227 skip_fail: false
228
229- description: Configure Alerta if it is exists
230 cmd: |
231 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:alerta' match.pillar 'prometheus:alerta' ; then
232 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:alerta' state.sls prometheus.alerta
233 fi
234 node_name: {{ HOSTNAME_CFG01 }}
235 retry: {count: 1, delay: 10}
236 skip_fail: false
237
238- description: Run salt minion to create cert files
239 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion.cert
240 node_name: {{ HOSTNAME_CFG01 }}
241 retry: {count: 1, delay: 10}
242 skip_fail: true
243
244{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
245{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}