blob: 39f23c60fefb267a6712d642beec4e9a088a1e50 [file] [log] [blame]
Dennis Dmitriev67aea4a2018-03-14 14:20:20 +02001{% from 'cookied-mcp-pike-ovs/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02002
3{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
4
5# Install docker swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02006- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02007 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02008 node_name: {{ HOSTNAME_CFG01 }}
9 retry: {count: 1, delay: 10}
10 skip_fail: false
11
12- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020013 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020014 node_name: {{ HOSTNAME_CFG01 }}
15 retry: {count: 1, delay: 10}
16 skip_fail: false
17
18- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020019 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020020 node_name: {{ HOSTNAME_CFG01 }}
21 retry: {count: 1, delay: 10}
22 skip_fail: false
23
24- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020025 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020026 node_name: {{ HOSTNAME_CFG01 }}
27 retry: {count: 1, delay: 10}
28 skip_fail: false
29
30- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020031 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020032 node_name: {{ HOSTNAME_CFG01 }}
33 retry: {count: 1, delay: 10}
34 skip_fail: false
35
36- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020037 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020038 node_name: {{ HOSTNAME_CFG01 }}
39 retry: {count: 1, delay: 10}
40 skip_fail: false
41
42- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020043 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020044 node_name: {{ HOSTNAME_CFG01 }}
45 retry: {count: 1, delay: 10}
46 skip_fail: false
47
48- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020049 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020050 node_name: {{ HOSTNAME_CFG01 }}
51 retry: {count: 1, delay: 10}
52 skip_fail: false
53
Dennis Dmitriev002c2672018-03-06 18:43:27 +020054- description: Install keepalived on mon nodes
55 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
56 -C 'mon*' state.sls keepalived
57 node_name: {{ HOSTNAME_CFG01 }}
58 retry: {count: 1, delay: 10}
59 skip_fail: false
60
61- description: Check the VIP on mon nodes
62 cmd: |
63 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
64 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
65 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
66 node_name: {{ HOSTNAME_CFG01 }}
67 retry: {count: 1, delay: 5}
68 skip_fail: false
69
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020070# Install slv2 infra
Tatyana Leontovichd0333462018-03-16 12:40:44 +020071#Launch containers
72- description: launch prometheus containers
73 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
74 node_name: {{ HOSTNAME_CFG01 }}
75 retry: {count: 2, delay: 10}
76 skip_fail: false
77
78- description: Check docker ps
79 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
80 node_name: {{ HOSTNAME_CFG01 }}
81 retry: {count: 2, delay: 10}
82 skip_fail: false
83
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020084- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020085 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020086 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 2, delay: 10}
88 skip_fail: false
89
Tatyana Leontovichd0333462018-03-16 12:40:44 +020090- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
91 cmd: |
92 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
93 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
94 fi
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020095 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 1, delay: 10}
97 skip_fail: false
98
99- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200100 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200101 node_name: {{ HOSTNAME_CFG01 }}
102 retry: {count: 1, delay: 10}
103 skip_fail: false
104
105- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200106 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 10}
109 skip_fail: false
110
111- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200112 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 10}
115 skip_fail: false
116
117- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200118 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200119 node_name: {{ HOSTNAME_CFG01 }}
120 retry: {count: 1, delay: 10}
121 skip_fail: false
122
123- description: Check influix db
124 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200125 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200126 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
127 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200128 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200129 fi
130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 5}
132 skip_fail: true
133
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200134# Install service for the log collection
135- description: Configure fluentd
136 cmd: |
137 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
138 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
139 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
140 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
141 else
142 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
143 fi
144 node_name: {{ HOSTNAME_CFG01 }}
145 retry: {count: 1, delay: 10}
146 skip_fail: false
147
148#Install heka ceilometer collector
149- description: Install heka ceilometer if they exists
150 cmd: |
151 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`;
152 echo "Ceilometer service presence: ${CEILO}";
153 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
154 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
155 salt --hard-crash --state-output=mixed --state-verbose=False -C '@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
156 fi
157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 1, delay: 10}
159 skip_fail: false
160
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200161# Collect grains needed to configure the services
162
163- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200164 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200165 node_name: {{ HOSTNAME_CFG01 }}
166 retry: {count: 1, delay: 10}
167 skip_fail: false
168
169- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200170 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 1, delay: 10}
173 skip_fail: false
174
175- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200176 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200177 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200178 retry: {count: 5, delay: 15}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200179 skip_fail: false
180
181# Configure the services running in Docker Swarm
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200182- description: Configure prometheus in docker swarm
183 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200184 node_name: {{ HOSTNAME_CFG01 }}
185 retry: {count: 1, delay: 10}
186 skip_fail: false
187
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200188- description: Configure Remote Collector in Docker Swarm for Openstack deployments
189 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200190 node_name: {{ HOSTNAME_CFG01 }}
191 retry: {count: 1, delay: 10}
192 skip_fail: false
193
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200194- description: Install sphinx
195 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200196 node_name: {{ HOSTNAME_CFG01 }}
197 retry: {count: 1, delay: 10}
198 skip_fail: false
199
Tatyana Leontovichd0333462018-03-16 12:40:44 +0200200
201#- description: Install prometheus alertmanager
202# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
203# node_name: {{ HOSTNAME_CFG01 }}
204# retry: {count: 1, delay: 10}
205# skip_fail: false
206
207#- description: run docker state
208# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
209# node_name: {{ HOSTNAME_CFG01 }}
210# retry: {count: 1, delay: 10}
211# skip_fail: false
212#
213#- description: docker ps
214# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
215# node_name: {{ HOSTNAME_CFG01 }}
216# retry: {count: 1, delay: 10}
217# skip_fail: false
218
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200219- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200220 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200221 node_name: {{ HOSTNAME_CFG01 }}
222 retry: {count: 2, delay: 10}
223 skip_fail: false
224
225- description: Run salt minion to create cert files
226 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
227 node_name: {{ HOSTNAME_CFG01 }}
228 retry: {count: 1, delay: 10}
229 skip_fail: false
230
231{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
232{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}