blob: 831cded7511a9f8d84607f8d5b1cb16411349364 [file] [log] [blame]
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03001{% from 'virtual-mcp11-k8s-calico/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 %}
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03003
4# Install docker swarm
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +03005- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02006 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03007 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +03009 skip_fail: false
10
11- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020012 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030013 node_name: {{ HOSTNAME_CFG01 }}
14 retry: {count: 1, delay: 10}
15 skip_fail: false
16
17- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020018 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030019 node_name: {{ HOSTNAME_CFG01 }}
20 retry: {count: 1, delay: 10}
21 skip_fail: false
22
23- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020024 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030025 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 1, delay: 10}
27 skip_fail: false
28
29- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020030 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030031 node_name: {{ HOSTNAME_CFG01 }}
32 retry: {count: 1, delay: 10}
33 skip_fail: false
34
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030035- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020036 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 +030037 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 10}
39 skip_fail: false
40
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030041- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020042 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030043 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 1, delay: 10}
45 skip_fail: false
46
47- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020048 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030049 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
51 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030052
53# Install slv2 infra
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030054- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020055 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030056 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030057 retry: {count: 2, delay: 10}
58 skip_fail: false
59
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030060- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
61 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020062 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
63 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030064 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030065 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030066 retry: {count: 1, delay: 10}
67 skip_fail: false
68
Dennis Dmitriev4c86ed52018-02-06 10:49:36 +020069- description: Configure fluentd
Dennis Dmitriev281221b2018-02-13 16:40:48 +020070 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030071 node_name: {{ HOSTNAME_CFG01 }}
72 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030073 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030074
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030075- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020076 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030077 node_name: {{ HOSTNAME_CFG01 }}
78 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030079 skip_fail: false
80
81- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020082 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030083 node_name: {{ HOSTNAME_CFG01 }}
84 retry: {count: 1, delay: 10}
85 skip_fail: false
86
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030087- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +020088 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030089 node_name: {{ HOSTNAME_CFG01 }}
90 retry: {count: 1, delay: 10}
91 skip_fail: false
92
93- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +020094 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030095 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 1, delay: 10}
97 skip_fail: false
98
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +030099- description: Check influix db
100 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200101 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 Leontovich3645d2b2017-06-13 16:51:23 +0300102 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
103 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200104 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +0300105 fi
106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 1, delay: 5}
108 skip_fail: true
109
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300110# Collect grains needed to configure the services
111
112- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200113 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300114 node_name: {{ HOSTNAME_CFG01 }}
115 retry: {count: 1, delay: 10}
116 skip_fail: false
117
118- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200119 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 10}
122 skip_fail: false
123
124- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200125 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300126 node_name: {{ HOSTNAME_CFG01 }}
127 retry: {count: 1, delay: 10}
128 skip_fail: false
129
130# Configure the services running in Docker Swarm
131- description: Install prometheus alertmanager
Dmitry Kalashnik81444d92018-02-15 17:42:15 +0400132 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:server' state.sls prometheus -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300133 node_name: {{ HOSTNAME_CFG01 }}
134 retry: {count: 1, delay: 10}
135 skip_fail: false
136
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300137- description: run docker state
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200138 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300139 node_name: {{ HOSTNAME_CFG01 }}
140 retry: {count: 1, delay: 10}
141 skip_fail: false
142
143- description: docker ps
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200144 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300145 node_name: {{ HOSTNAME_CFG01 }}
146 retry: {count: 1, delay: 10}
147 skip_fail: false
148
149- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200150 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300151 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300152 retry: {count: 2, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300153 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300154
155- description: Run salt minion to create cert files
156 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 1, delay: 10}
159 skip_fail: false
160
Tatyana Leontovich9bd9c102017-09-28 12:49:38 +0300161{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
162{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}