blob: 5795a2542f4235c046fe15c378c0f80b77dd001f [file] [log] [blame]
Tatyana Leontovichd85357d2017-08-02 15:28:37 +03001{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
Tatyana Leontovich063d0ff2017-09-05 18:11:55 +03002{% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +03003# 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
Tatyana Leontovichd85357d2017-08-02 15:28:37 +03007 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 10}
9 skip_fail: false
10
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030011- 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
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030020- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +020021 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030022 node_name: {{ HOSTNAME_CFG01 }}
23 retry: {count: 1, delay: 10}
24 skip_fail: false
25
26- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020027 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030028 node_name: {{ HOSTNAME_CFG01 }}
29 retry: {count: 1, delay: 10}
30 skip_fail: false
31
32- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020033 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030034 node_name: {{ HOSTNAME_CFG01 }}
35 retry: {count: 1, delay: 10}
36 skip_fail: false
37
38- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020039 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030040 node_name: {{ HOSTNAME_CFG01 }}
41 retry: {count: 1, delay: 10}
42 skip_fail: false
43
44- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020045 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030046 node_name: {{ HOSTNAME_CFG01 }}
47 retry: {count: 1, delay: 10}
48 skip_fail: false
49
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030050- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020051 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 +030052 node_name: {{ HOSTNAME_CFG01 }}
53 retry: {count: 1, delay: 10}
54 skip_fail: false
55
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030056- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020057 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030058 node_name: {{ HOSTNAME_CFG01 }}
59 retry: {count: 1, delay: 10}
60 skip_fail: false
61
62- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020063 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030064 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 10}
66 skip_fail: false
67
68# 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 Leontovichd85357d2017-08-02 15:28:37 +030071 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030072 retry: {count: 2, delay: 10}
73 skip_fail: false
74
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030075- 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
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030079 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030080 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030081 retry: {count: 1, delay: 10}
82 skip_fail: false
83
84- description: Configure collector
Dennis Dmitriev281221b2018-02-13 16:40:48 +020085 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030086 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 Leontovichd85357d2017-08-02 15:28:37 +030092 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 Leontovichd85357d2017-08-02 15:28:37 +030098 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 Leontovichd85357d2017-08-02 15:28:37 +0300104 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 Leontovichd85357d2017-08-02 15:28:37 +0300110 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 Leontovichd85357d2017-08-02 15:28:37 +0300117 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 Leontovichd85357d2017-08-02 15:28:37 +0300120 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 Leontovichd85357d2017-08-02 15:28:37 +0300129 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 Leontovichd85357d2017-08-02 15:28:37 +0300135 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 Leontovichd85357d2017-08-02 15:28:37 +0300141 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich063d0ff2017-09-05 18:11:55 +0300142 retry: {count: 5, delay: 15}
Tatyana Leontovichd85357d2017-08-02 15:28:37 +0300143 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 Leontovichd85357d2017-08-02 15:28:37 +0300148 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 Leontovichd85357d2017-08-02 15:28:37 +0300154 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 Leontovichd85357d2017-08-02 15:28:37 +0300160 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 Leontovichd85357d2017-08-02 15:28:37 +0300166 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
Tatyana Leontovich063d0ff2017-09-05 18:11:55 +0300176{{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
177{{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}