blob: a8ca9448f520259f4cb9f35305d0a0876e683d50 [file] [log] [blame]
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02001{% from 'virtual-mcp-pike-ovs/underlay.yaml' import HOSTNAME_CFG01 with context %}
2
3{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
4
5# Install docker swarm
6- description: Install keepalived on mon nodes
7 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
8 -C 'mon*' state.sls keepalived
9 node_name: {{ HOSTNAME_CFG01 }}
10 retry: {count: 1, delay: 10}
11 skip_fail: false
12
13- description: Check the VIP on mon nodes
14 cmd: |
15 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
16 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
17 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
18 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 1, delay: 5}
20 skip_fail: false
21
22- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +020023 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 +020024 node_name: {{ HOSTNAME_CFG01 }}
25 retry: {count: 1, delay: 10}
26 skip_fail: false
27
28- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020029 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 +020030 node_name: {{ HOSTNAME_CFG01 }}
31 retry: {count: 1, delay: 10}
32 skip_fail: false
33
34- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020035 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 +020036 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
40- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020041 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
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: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020047 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 +020048 node_name: {{ HOSTNAME_CFG01 }}
49 retry: {count: 1, delay: 10}
50 skip_fail: false
51
52- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020053 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 +020054 node_name: {{ HOSTNAME_CFG01 }}
55 retry: {count: 1, delay: 10}
56 skip_fail: false
57
58- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020059 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 +020060 node_name: {{ HOSTNAME_CFG01 }}
61 retry: {count: 1, delay: 10}
62 skip_fail: false
63
64- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020065 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 +020066 node_name: {{ HOSTNAME_CFG01 }}
67 retry: {count: 1, delay: 10}
68 skip_fail: false
69
70# Install slv2 infra
71- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020072 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 +020073 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 2, delay: 10}
75 skip_fail: false
76
77- description: Configure Prometheus exporters
Dennis Dmitriev281221b2018-02-13 16:40:48 +020078 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020079 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 1, delay: 10}
81 skip_fail: false
82
83- description: Configure collector
Dennis Dmitriev281221b2018-02-13 16:40:48 +020084 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020085 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 1, delay: 10}
87 skip_fail: false
88
89- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020090 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 +020091 node_name: {{ HOSTNAME_CFG01 }}
92 retry: {count: 1, delay: 10}
93 skip_fail: false
94
95- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020096 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 +020097 node_name: {{ HOSTNAME_CFG01 }}
98 retry: {count: 1, delay: 10}
99 skip_fail: false
100
101- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200102 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 +0200103 node_name: {{ HOSTNAME_CFG01 }}
104 retry: {count: 1, delay: 10}
105 skip_fail: false
106
107- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200108 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 +0200109 node_name: {{ HOSTNAME_CFG01 }}
110 retry: {count: 1, delay: 10}
111 skip_fail: false
112
113- description: Check influix db
114 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200115 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 +0200116 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
117 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200118 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200119 fi
120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 5}
122 skip_fail: true
123
124# Collect grains needed to configure the services
125
126- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200127 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 +0200128 node_name: {{ HOSTNAME_CFG01 }}
129 retry: {count: 1, delay: 10}
130 skip_fail: false
131
132- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200133 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200134 node_name: {{ HOSTNAME_CFG01 }}
135 retry: {count: 1, delay: 10}
136 skip_fail: false
137
138- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200139 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 +0200140 node_name: {{ HOSTNAME_CFG01 }}
141 retry: {count: 1, delay: 10}
142 skip_fail: false
143
144# Configure the services running in Docker Swarm
145- description: Install prometheus alertmanager
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200146 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 +0200147 node_name: {{ HOSTNAME_CFG01 }}
148 retry: {count: 1, delay: 10}
149 skip_fail: false
150
151- description: run docker state
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200152 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 +0200153 node_name: {{ HOSTNAME_CFG01 }}
154 retry: {count: 1, delay: 10}
155 skip_fail: false
156
157- description: docker ps
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200158 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200159 node_name: {{ HOSTNAME_CFG01 }}
160 retry: {count: 1, delay: 10}
161 skip_fail: false
162
163- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200164 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 +0200165 node_name: {{ HOSTNAME_CFG01 }}
166 retry: {count: 2, delay: 10}
167 skip_fail: false
168
169- description: Run salt minion to create cert files
170 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 1, delay: 10}
173 skip_fail: false
174
175{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
176{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}