blob: 43d6ad8670b07fbd2e98c35762bbd666bb24956a [file] [log] [blame]
Tatyana Leontovich09b7b012017-07-10 12:53:45 +03001{% from 'virtual-mcp11-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovich9bd9c102017-09-28 12:49:38 +03002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +02003
4# Install docker swarm
Tatyana Leontovichde25aa42017-09-27 14:28:57 +03005- description: sync time
6 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
7 'service ntp stop; ntpd -gq; service ntp start'
8 node_name: {{ HOSTNAME_CFG01 }}
9 retry: {count: 1, delay: 30}
10 skip_fail: false
11
12- description: Restart keepalived service
Dennis Dmitriev281221b2018-02-13 16:40:48 +020013 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "systemctl restart keepalived"
Tatyana Leontovichde25aa42017-09-27 14:28:57 +030014 node_name: {{ HOSTNAME_CFG01 }}
15 retry: {count: 1, delay: 10}
16 skip_fail: false
17
18- description: Check the VIP
19 cmd: |
20 SL_MONITOR_ADDRESS=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
21 echo "_param:stacklight_monitor_address (vip): ${SL_MONITOR_ADDRESS}";
22 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_MONITOR_ADDRESS}" | grep -B1 ${SL_MONITOR_ADDRESS}
23 node_name: {{ HOSTNAME_CFG01 }}
24 retry: {count: 1, delay: 5}
25 skip_fail: false
26
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020027- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +020028 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 +020029 node_name: {{ HOSTNAME_CFG01 }}
30 retry: {count: 1, delay: 10}
31 skip_fail: false
32
33- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020034 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 +020035 node_name: {{ HOSTNAME_CFG01 }}
36 retry: {count: 1, delay: 10}
37 skip_fail: false
38
39- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020040 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 +020041 node_name: {{ HOSTNAME_CFG01 }}
42 retry: {count: 1, delay: 10}
43 skip_fail: false
44
45- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020046 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020047 node_name: {{ HOSTNAME_CFG01 }}
48 retry: {count: 1, delay: 10}
49 skip_fail: false
50
51- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020052 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 +020053 node_name: {{ HOSTNAME_CFG01 }}
54 retry: {count: 1, delay: 10}
55 skip_fail: false
56
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030057- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020058 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 +030059 node_name: {{ HOSTNAME_CFG01 }}
60 retry: {count: 1, delay: 10}
61 skip_fail: false
62
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020063- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020064 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 +020065 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 1, delay: 10}
67 skip_fail: false
68
69- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020070 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 +020071 node_name: {{ HOSTNAME_CFG01 }}
72 retry: {count: 1, delay: 10}
73 skip_fail: false
74
75# Install slv2 infra
76- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020077 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 +030078 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030079 retry: {count: 2, delay: 10}
80 skip_fail: false
81
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030082- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
83 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020084 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
85 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030086 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030087 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich09b7b012017-07-10 12:53:45 +030088 retry: {count: 1, delay: 10}
89 skip_fail: false
90
91- description: Configure collector
Dennis Dmitriev281221b2018-02-13 16:40:48 +020092 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020093 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 1, delay: 10}
95 skip_fail: false
96
97- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020098 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 +020099 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 10}
101 skip_fail: false
102
103- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200104 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 +0200105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 10}
107 skip_fail: false
108
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200109- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200110 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 +0200111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 10}
113 skip_fail: false
114
115- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200116 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 +0200117 node_name: {{ HOSTNAME_CFG01 }}
118 retry: {count: 1, delay: 10}
119 skip_fail: false
120
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300121- description: Check influix db
122 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200123 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 +0300124 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
125 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200126 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300127 fi
128 node_name: {{ HOSTNAME_CFG01 }}
129 retry: {count: 1, delay: 5}
130 skip_fail: true
131
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200132# Collect grains needed to configure the services
133
134- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200135 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 +0200136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 1, delay: 10}
138 skip_fail: false
139
140- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200141 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 10}
144 skip_fail: false
145
146- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200147 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 +0200148 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich063d0ff2017-09-05 18:11:55 +0300149 retry: {count: 3, delay: 10}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200150 skip_fail: false
151
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300152# Configure the services running in Docker Swarm
153- description: Install prometheus alertmanager
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200154 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 10}
157 skip_fail: false
158
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200159- description: run docker state
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200160 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200161 node_name: {{ HOSTNAME_CFG01 }}
162 retry: {count: 1, delay: 10}
163 skip_fail: false
164
165- description: docker ps
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200166 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200167 node_name: {{ HOSTNAME_CFG01 }}
168 retry: {count: 1, delay: 10}
169 skip_fail: false
170
171- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200172 cmd: sleep 60; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200173 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300174 retry: {count: 2, delay: 10}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200175 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300176
177- description: Run salt minion to create cert files
178 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
179 node_name: {{ HOSTNAME_CFG01 }}
180 retry: {count: 1, delay: 10}
181 skip_fail: false
Tatyana Leontovich9bd9c102017-09-28 12:49:38 +0300182
183{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
184{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}