blob: 18521fd1934c9ab65971863f76c362162fb5d64c [file] [log] [blame]
sgudzb5d72e62018-05-31 12:20:51 +03001{% from 'cookied-bm-contrail-nfv-maas/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
3
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
69# Install slv2 infra
70#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
83- description: Install telegraf
84 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
85 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: |
91 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
93 fi
94 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 1, delay: 10}
96 skip_fail: false
97
98- description: Install elasticsearch server
99 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
100 node_name: {{ HOSTNAME_CFG01 }}
101 retry: {count: 1, delay: 10}
102 skip_fail: false
103
104- description: Install kibana server
105 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 1, delay: 10}
108 skip_fail: false
109
110- description: Install elasticsearch client
111 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
112 node_name: {{ HOSTNAME_CFG01 }}
113 retry: {count: 2, delay: 30}
114 skip_fail: false
115
116- description: Install kibana client
117 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 10}
120 skip_fail: false
121
122- description: Check influix db
123 cmd: |
124 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
125 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
126 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
127 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
128 fi
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 5}
131 skip_fail: true
132
133# 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}";
150 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
151 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}";
164 if [[ "$CEILO" == "true" ]]; then
165 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 'I@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
172# Collect grains needed to configure the services
173
174- description: Get grains
175 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
176 node_name: {{ HOSTNAME_CFG01 }}
177 retry: {count: 1, delay: 10}
178 skip_fail: false
179
180- description: Sync modules
181 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
182 node_name: {{ HOSTNAME_CFG01 }}
183 retry: {count: 1, delay: 10}
184 skip_fail: false
185
186- description: Update mine
187 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
188 node_name: {{ HOSTNAME_CFG01 }}
189 retry: {count: 5, delay: 15}
190 skip_fail: false
191
192# Configure the services running in Docker Swarm
193- 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
195 node_name: {{ HOSTNAME_CFG01 }}
196 retry: {count: 1, delay: 10}
197 skip_fail: false
198
199- 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
201 node_name: {{ HOSTNAME_CFG01 }}
202 retry: {count: 1, delay: 10}
203 skip_fail: false
204
205- description: Install sphinx
206 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
207 node_name: {{ HOSTNAME_CFG01 }}
208 retry: {count: 1, delay: 10}
209 skip_fail: false
210
211
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
230- description: Configure Grafana dashboards and datasources
231 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
232 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
242{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
243{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}