blob: 5ba2e3f392bb546a993129f04a47ca93cab2d719 [file] [log] [blame]
sgudzd7f8ec92018-04-19 16:22:47 +03001{% from 'cookied-bm-mcp-ocata-contrail-nfv/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 %}
sgudzd7f8ec92018-04-19 16:22:47 +03003
4# Install docker swarm
5- description: Configure docker service
6 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
7 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
9 skip_fail: false
10
11- description: Install docker swarm on master node
12 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
13 node_name: {{ HOSTNAME_CFG01 }}
14 retry: {count: 1, delay: 10}
15 skip_fail: false
16
17- description: Send grains to the swarm slave nodes
18 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
19 node_name: {{ HOSTNAME_CFG01 }}
20 retry: {count: 1, delay: 10}
21 skip_fail: false
22
23- description: Update mine
24 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
25 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 1, delay: 10}
27 skip_fail: false
28
29- description: Refresh modules
30 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
31 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
36 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
37 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 10}
39 skip_fail: false
40
41- description: Configure slave nodes
42 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
43 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 1, delay: 10}
45 skip_fail: false
46
47- description: List registered Docker swarm nodes
48 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
49 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
51 skip_fail: false
52
53- 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
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
sgudzd7f8ec92018-04-19 16:22:47 +030076# Install slv2 infra
77#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
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030088 cmd: |
sgudze12b5092018-09-15 00:40:10 +030089 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
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030091 fi
92 node_name: {{ HOSTNAME_CFG01 }}
sgudze12b5092018-09-15 00:40:10 +030093 retry: {count: 5, delay: 20}
sgudzd7f8ec92018-04-19 16:22:47 +030094 skip_fail: false
95
96- description: Install telegraf
97 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
98 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: |
104 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
106 fi
107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 10}
109 skip_fail: false
110
111- description: Install elasticsearch server
sgudze12b5092018-09-15 00:40:10 +0300112 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true and *01*' state.sls elasticsearch.server
113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 10}
115 skip_fail: false
116
117- description: Install elasticsearch server
118 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true' state.sls elasticsearch.server
sgudzd7f8ec92018-04-19 16:22:47 +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
sgudzd7f8ec92018-04-19 16:22:47 +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
sgudzd7f8ec92018-04-19 16:22:47 +0300137 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300138 retry: {count: 2, delay: 30}
sgudzd7f8ec92018-04-19 16:22:47 +0300139 skip_fail: false
140
141- description: Install kibana client
142 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 10}
145 skip_fail: false
146
147- description: Check influix db
148 cmd: |
149 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
150 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;
sgudzd7f8ec92018-04-19 16:22:47 +0300154 fi
155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 5}
sgudze12b5092018-09-15 00:40:10 +0300157 skip_fail: false
sgudzd7f8ec92018-04-19 16:22:47 +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 ######################################
sgudzd7f8ec92018-04-19 16:22:47 +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
sgudzd7f8ec92018-04-19 16:22:47 +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
sgudzd7f8ec92018-04-19 16:22:47 +0300200 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
201 node_name: {{ HOSTNAME_CFG01 }}
sgudze12b5092018-09-15 00:40:10 +0300202 retry: {count: 2, delay: 10}
sgudzd7f8ec92018-04-19 16:22:47 +0300203 skip_fail: false
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
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
sgudzd7f8ec92018-04-19 16:22:47 +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"
sgudzd7f8ec92018-04-19 16:22:47 +0300219 node_name: {{ HOSTNAME_CFG01 }}
220 retry: {count: 1, delay: 10}
221 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() }}