blob: b3818b7b37c005b7bf962f65f2a0be3aca31c2f0 [file] [log] [blame]
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +02001{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
3# Install docker swarm
4- description: Install keepalived on mon nodes
5 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
6 -C 'mon*' state.sls keepalived
7 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
9 skip_fail: false
10
11- description: Check the VIP on mon nodes
12 cmd: |
13 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
14 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
15 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
16 node_name: {{ HOSTNAME_CFG01 }}
17 retry: {count: 1, delay: 5}
18 skip_fail: false
19
20- description: Configure docker service
21 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
22 node_name: {{ HOSTNAME_CFG01 }}
23 retry: {count: 1, delay: 10}
24 skip_fail: false
25
26- description: Install docker swarm on master node
27 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
28 node_name: {{ HOSTNAME_CFG01 }}
29 retry: {count: 1, delay: 10}
30 skip_fail: false
31
32- description: Send grains to the swarm slave nodes
33 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
34 node_name: {{ HOSTNAME_CFG01 }}
35 retry: {count: 1, delay: 10}
36 skip_fail: false
37
38- description: Update mine
39 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
40 node_name: {{ HOSTNAME_CFG01 }}
41 retry: {count: 1, delay: 10}
42 skip_fail: false
43
44- description: Refresh modules
45 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
46 node_name: {{ HOSTNAME_CFG01 }}
47 retry: {count: 1, delay: 10}
48 skip_fail: false
49
50- description: Rerun swarm on slaves to proper token population
51 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
52 node_name: {{ HOSTNAME_CFG01 }}
53 retry: {count: 1, delay: 10}
54 skip_fail: false
55
56- description: Configure slave nodes
57 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
58 node_name: {{ HOSTNAME_CFG01 }}
59 retry: {count: 1, delay: 10}
60 skip_fail: false
61
62- description: List registered Docker swarm nodes
63 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
64 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 10}
66 skip_fail: false
67
68# Install slv2 infra
69- description: Install telegraf
70 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
71 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: |
77 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
79 fi
80 node_name: {{ HOSTNAME_CFG01 }}
81 retry: {count: 1, delay: 10}
82 skip_fail: false
83
84- description: Configure fluentd
85 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
86 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 1, delay: 10}
88 skip_fail: false
89
90- description: Install elasticsearch server
91 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
92 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 1, delay: 10}
94 skip_fail: false
95
96- description: Install kibana server
97 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 1, delay: 10}
100 skip_fail: false
101
102- description: Install elasticsearch client
103 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
108- description: Install kibana client
109 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
114- description: Check influix db
115 cmd: |
116 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
117 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
118 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
119 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
120 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
128 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
133- description: Sync modules
134 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 10}
137 skip_fail: false
138
139- description: Update mine
140 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
141 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
147 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
148 node_name: {{ HOSTNAME_CFG01 }}
149 retry: {count: 1, delay: 10}
150 skip_fail: false
151
152- description: run docker state
153 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 1, delay: 10}
156 skip_fail: false
157
158- description: docker ps
159 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 1, delay: 10}
162 skip_fail: false
163
164- description: Configure Grafana dashboards and datasources
165 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
166 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() }}