blob: a5b37a20f6c424dee31c5f86cc0b00594d621269 [file] [log] [blame]
Tatyana Leontovich09b7b012017-07-10 12:53:45 +03001{% from 'virtual-mcp11-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
Victor Ryzhenkind93a4482018-04-09 15:20:42 +04002{% from 'virtual-mcp11-k8s-contrail/salt.yaml' import ENVIRONMENT_MODEL_INVENTORY_NAME with context %}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +02003
Tatyana Leontoviche4a28502018-06-08 13:24:56 +03004{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
5
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +02006# Install docker swarm
7- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02008 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +02009 node_name: {{ HOSTNAME_CFG01 }}
10 retry: {count: 1, delay: 10}
11 skip_fail: false
12
13- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020014 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020015 node_name: {{ HOSTNAME_CFG01 }}
16 retry: {count: 1, delay: 10}
17 skip_fail: false
18
19- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020020 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020021 node_name: {{ HOSTNAME_CFG01 }}
22 retry: {count: 1, delay: 10}
23 skip_fail: false
24
25- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020026 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020027 node_name: {{ HOSTNAME_CFG01 }}
28 retry: {count: 1, delay: 10}
29 skip_fail: false
30
31- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020032 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020033 node_name: {{ HOSTNAME_CFG01 }}
34 retry: {count: 1, delay: 10}
35 skip_fail: false
36
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030037- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020038 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030039 node_name: {{ HOSTNAME_CFG01 }}
40 retry: {count: 1, delay: 10}
41 skip_fail: false
42
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020043- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020044 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020045 node_name: {{ HOSTNAME_CFG01 }}
46 retry: {count: 1, delay: 10}
47 skip_fail: false
48
49- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020050 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020051 node_name: {{ HOSTNAME_CFG01 }}
52 retry: {count: 1, delay: 10}
53 skip_fail: false
54
Victor Ryzhenkind93a4482018-04-09 15:20:42 +040055- description: Install keepalived on mon nodes
56 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
57 -C 'mon*' state.sls keepalived
58 node_name: {{ HOSTNAME_CFG01 }}
59 retry: {count: 1, delay: 10}
60 skip_fail: false
61
62- description: Check the VIP on mon nodes
63 cmd: |
64 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
65 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
66 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
67 node_name: {{ HOSTNAME_CFG01 }}
68 retry: {count: 1, delay: 5}
69 skip_fail: false
70
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020071# Install slv2 infra
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000072# Install MongoDB for alerta
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030073- description: Install Mongo if target matches
74 cmd: |
75 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040076 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.server
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030077 fi
Dennis Dmitriev371ba5b2018-05-31 12:00:38 +000078 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030079 retry: {count: 1, delay: 10}
80 skip_fail: false
81
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040082# Create MongoDB cluster
83- description: Install Mongo if target matches
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030084 cmd: |
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040085 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then
86 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.cluster
Tatyana Leontovich48a6af92018-06-04 15:16:20 +030087 fi
88 node_name: {{ HOSTNAME_CFG01 }}
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +040089 retry: {count: 5, delay: 20}
Victor Ryzhenkind93a4482018-04-09 15:20:42 +040090 skip_fail: false
91
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020092- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020093 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Tatyana Leontovich09b7b012017-07-10 12:53:45 +030094 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030095 retry: {count: 2, delay: 10}
96 skip_fail: false
97
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030098- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
99 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200100 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
101 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +0300102 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +0300103 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300104 retry: {count: 1, delay: 10}
105 skip_fail: false
106
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200107- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200108 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200109 node_name: {{ HOSTNAME_CFG01 }}
110 retry: {count: 1, delay: 10}
111 skip_fail: false
112
113- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200114 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200115 node_name: {{ HOSTNAME_CFG01 }}
116 retry: {count: 1, delay: 10}
117 skip_fail: false
118
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200119- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200120 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200121 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300122 retry: {count: 2, delay: 30}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200123 skip_fail: false
124
125- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200126 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200127 node_name: {{ HOSTNAME_CFG01 }}
128 retry: {count: 1, delay: 10}
129 skip_fail: false
130
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300131- description: Check influix db
132 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200133 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 Leontovich09b7b012017-07-10 12:53:45 +0300134 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
135 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200136 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300137 fi
138 node_name: {{ HOSTNAME_CFG01 }}
139 retry: {count: 1, delay: 5}
140 skip_fail: true
141
Victor Ryzhenkind93a4482018-04-09 15:20:42 +0400142# Install Prometheus LTS(optional if set in model)
143- description: Prometheus LTS(optional if set in model)
144 cmd: |
145 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
146 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
147 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
148 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
149 fi
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 5}
152 skip_fail: true
153
154# Install service for the log collection
155- description: Configure fluentd
156 cmd: |
157 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
158 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
159 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
160 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
161 else
162 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
163 fi
164 node_name: {{ HOSTNAME_CFG01 }}
165 retry: {count: 1, delay: 10}
166 skip_fail: false
167
168#Install heka ceilometer collector
169- description: Install heka ceilometer if they exists
170 cmd: |
171 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`;
172 echo "Ceilometer service presence: ${CEILO}";
173 if [[ "$CEILO" == "true" ]]; then
174 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
175 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
176 fi
177 node_name: {{ HOSTNAME_CFG01 }}
178 retry: {count: 1, delay: 10}
179 skip_fail: false
180
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200181# Collect grains needed to configure the services
182
183- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200184 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200185 node_name: {{ HOSTNAME_CFG01 }}
186 retry: {count: 1, delay: 10}
187 skip_fail: false
188
189- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200190 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200191 node_name: {{ HOSTNAME_CFG01 }}
192 retry: {count: 1, delay: 10}
193 skip_fail: false
194
195- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200196 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200197 node_name: {{ HOSTNAME_CFG01 }}
Victor Ryzhenkind93a4482018-04-09 15:20:42 +0400198 retry: {count: 5, delay: 15}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200199 skip_fail: false
200
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300201# Configure the services running in Docker Swarm
Victor Ryzhenkind93a4482018-04-09 15:20:42 +0400202- description: Configure prometheus in docker swarm
203 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300204 node_name: {{ HOSTNAME_CFG01 }}
205 retry: {count: 1, delay: 10}
206 skip_fail: false
207
Dmitry Kalashnik2fffc4a2018-06-07 16:34:06 +0400208#Launch containers
209- description: launch prometheus containers
210 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
211 node_name: {{ HOSTNAME_CFG01 }}
212 retry: {count: 2, delay: 10}
213 skip_fail: false
214
215- description: Check docker ps
216 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
217 node_name: {{ HOSTNAME_CFG01 }}
218 retry: {count: 2, delay: 10}
219 skip_fail: false
220
Victor Ryzhenkind93a4482018-04-09 15:20:42 +0400221###
222# From pipeline-library:
223# if (!common.checkContains('STACK_INSTALL', 'k8s')) {
224# salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'heka.remote_collector', true, false)
225# }
226
227#- description: Configure Remote Collector in Docker Swarm for Openstack deployments
228# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
229# node_name: {{ HOSTNAME_CFG01 }}
230# retry: {count: 1, delay: 10}
231# skip_fail: false
232###
233
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200234
235- description: Configure Grafana dashboards and datasources
Victor Ryzhenkind93a4482018-04-09 15:20:42 +0400236 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200237 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300238 retry: {count: 2, delay: 10}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200239 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300240
241- description: Run salt minion to create cert files
242 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
243 node_name: {{ HOSTNAME_CFG01 }}
244 retry: {count: 1, delay: 10}
245 skip_fail: false
Tatyana Leontovich9bd9c102017-09-28 12:49:38 +0300246
Tatyana Leontoviche4a28502018-06-08 13:24:56 +0300247
248{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
249{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}