blob: 7a31cee8c4c2bd569d9b553ccf5f8fb53b9051f5 [file] [log] [blame]
Dennis Dmitriev67aea4a2018-03-14 14:20:20 +02001{% from 'cookied-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
3# Install docker swarm
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02004- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02005 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 +02006 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 10}
8 skip_fail: false
9
10- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020011 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 +020012 node_name: {{ HOSTNAME_CFG01 }}
13 retry: {count: 1, delay: 10}
14 skip_fail: false
15
16- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020017 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 +020018 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 1, delay: 10}
20 skip_fail: false
21
22- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020023 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020024 node_name: {{ HOSTNAME_CFG01 }}
25 retry: {count: 1, delay: 10}
26 skip_fail: false
27
28- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020029 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 +020030 node_name: {{ HOSTNAME_CFG01 }}
31 retry: {count: 1, delay: 10}
32 skip_fail: false
33
34- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020035 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 +020036 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
40- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020041 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 +020042 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
46- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020047 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 +020048 node_name: {{ HOSTNAME_CFG01 }}
49 retry: {count: 1, delay: 10}
50 skip_fail: false
51
Dennis Dmitriev002c2672018-03-06 18:43:27 +020052- description: Install keepalived on mon nodes
53 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
54 -C 'mon*' state.sls keepalived
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
59- description: Check the VIP on mon nodes
60 cmd: |
61 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
62 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
63 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
64 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 5}
66 skip_fail: false
67
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020068# Install slv2 infra
69- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020070 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 +020071 node_name: {{ HOSTNAME_CFG01 }}
72 retry: {count: 2, delay: 10}
73 skip_fail: false
74
75- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
76 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020077 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
78 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020079 fi
80 node_name: {{ HOSTNAME_CFG01 }}
81 retry: {count: 1, delay: 10}
82 skip_fail: false
83
Tatyana Leontovich52307aa2018-02-20 15:18:19 +020084- description: Configure fluentd
85 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020086 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 1, delay: 10}
88 skip_fail: false
89
90- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020091 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 +020092 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 1, delay: 10}
94 skip_fail: false
95
96- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020097 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 +020098 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 1, delay: 10}
100 skip_fail: false
101
102- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200103 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 +0200104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
108- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200109 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 +0200110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
114- description: Check influix db
115 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200116 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 +0200117 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
118 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200119 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200120 fi
121 node_name: {{ HOSTNAME_CFG01 }}
122 retry: {count: 1, delay: 5}
123 skip_fail: true
124
125# Collect grains needed to configure the services
126
127- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200128 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 +0200129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
133- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200134 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 10}
137 skip_fail: false
138
139- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200140 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 +0200141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 5, delay: 15}
143 skip_fail: false
144
145# Configure the services running in Docker Swarm
146- description: Install prometheus alertmanager
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200147 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200148 node_name: {{ HOSTNAME_CFG01 }}
149 retry: {count: 1, delay: 10}
150 skip_fail: false
151
152- description: run docker state
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200153 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 1, delay: 10}
156 skip_fail: false
157
158- description: docker ps
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200159 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 1, delay: 10}
162 skip_fail: false
163
164- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200165 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 +0200166 node_name: {{ HOSTNAME_CFG01 }}
167 retry: {count: 2, delay: 10}
168 skip_fail: false
169
170- description: Run salt minion to create cert files
171 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
172 node_name: {{ HOSTNAME_CFG01 }}
173 retry: {count: 1, delay: 10}
174 skip_fail: false
175
176{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
177{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}