blob: aaaa2960ab67a70708b9490acae8235006bbe50f [file] [log] [blame]
sgudz8c888ec2017-10-02 15:29:23 +03001{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
2
sgudzddca7322018-04-20 12:56:10 +03003# Install docker swarm
sgudz8c888ec2017-10-02 15:29:23 +03004- 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
sgudz8c888ec2017-10-02 15:29:23 +03006 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
sgudz8c888ec2017-10-02 15:29:23 +030012 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
sgudz8c888ec2017-10-02 15:29:23 +030018 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
sgudz8c888ec2017-10-02 15:29:23 +030024 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;
sgudz8c888ec2017-10-02 15:29:23 +030030 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
sgudz8c888ec2017-10-02 15:29:23 +030036 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
sgudz8c888ec2017-10-02 15:29:23 +030042 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'
sgudz8c888ec2017-10-02 15:29:23 +030048 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
sgudzddca7322018-04-20 12:56:10 +030059- description: Check the VIP on mon nodes
Dennis Dmitriev002c2672018-03-06 18:43:27 +020060 cmd: |
sgudzddca7322018-04-20 12:56:10 +030061 SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
62 echo "_param:stacklight_monitor_address (vip): ${SL_VIP}";
Dennis Dmitriev002c2672018-03-06 18:43:27 +020063 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
sgudz8c888ec2017-10-02 15:29:23 +030068# Install slv2 infra
sgudzddca7322018-04-20 12:56:10 +030069#Launch containers
70- description: launch prometheus containers
71 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
72 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 2, delay: 10}
74 skip_fail: false
75
76- description: Check docker ps
77 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
78 node_name: {{ HOSTNAME_CFG01 }}
79 retry: {count: 2, delay: 10}
80 skip_fail: false
81
sgudz8c888ec2017-10-02 15:29:23 +030082- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020083 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
sgudz8c888ec2017-10-02 15:29:23 +030084 node_name: {{ HOSTNAME_CFG01 }}
85 retry: {count: 2, delay: 10}
86 skip_fail: false
87
88- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
89 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020090 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
91 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
sgudz8c888ec2017-10-02 15:29:23 +030092 fi
93 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 1, delay: 10}
95 skip_fail: false
96
sgudz8c888ec2017-10-02 15:29:23 +030097- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020098 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
sgudz8c888ec2017-10-02 15:29:23 +030099 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 10}
101 skip_fail: false
102
103- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200104 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
sgudz8c888ec2017-10-02 15:29:23 +0300105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 10}
107 skip_fail: false
108
109- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200110 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
sgudz8c888ec2017-10-02 15:29:23 +0300111 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev4ad63e42018-05-01 05:18:54 +0300112 retry: {count: 2, delay: 30}
sgudz8c888ec2017-10-02 15:29:23 +0300113 skip_fail: false
114
115- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200116 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
sgudz8c888ec2017-10-02 15:29:23 +0300117 node_name: {{ HOSTNAME_CFG01 }}
118 retry: {count: 1, delay: 10}
119 skip_fail: false
120
121- description: Check influix db
122 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200123 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
sgudz8c888ec2017-10-02 15:29:23 +0300124 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
125 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200126 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
sgudz8c888ec2017-10-02 15:29:23 +0300127 fi
128 node_name: {{ HOSTNAME_CFG01 }}
129 retry: {count: 1, delay: 5}
130 skip_fail: true
131
sgudzddca7322018-04-20 12:56:10 +0300132# Install Prometheus LTS(optional if set in model)
133- description: Prometheus LTS(optional if set in model)
134 cmd: |
135 PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
136 echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
137 if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
138 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
139 fi
140 node_name: {{ HOSTNAME_CFG01 }}
141 retry: {count: 1, delay: 5}
142 skip_fail: true
143
144# Install service for the log collection
145- description: Configure fluentd
146 cmd: |
147 FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`;
148 echo "Fluentd service presence: ${FLUENTD_SERVICE}";
149 if [[ "$FLUENTD_SERVICE" == "true" ]]; then
150 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
151 else
152 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
153 fi
154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 1, delay: 10}
156 skip_fail: false
157
158#Install heka ceilometer collector
159- description: Install heka ceilometer if they exists
160 cmd: |
161 CEILO=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' test.ping 1>/dev/null 2>&1 && echo true`;
162 echo "Ceilometer service presence: ${CEILO}";
163 if [[ "$CEILO" == "true" ]]; then
164 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector;
165 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector
166 fi
167 node_name: {{ HOSTNAME_CFG01 }}
168 retry: {count: 1, delay: 10}
169 skip_fail: false
170
sgudz8c888ec2017-10-02 15:29:23 +0300171# Collect grains needed to configure the services
172
173- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200174 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
sgudz8c888ec2017-10-02 15:29:23 +0300175 node_name: {{ HOSTNAME_CFG01 }}
176 retry: {count: 1, delay: 10}
177 skip_fail: false
178
179- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200180 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
sgudz8c888ec2017-10-02 15:29:23 +0300181 node_name: {{ HOSTNAME_CFG01 }}
182 retry: {count: 1, delay: 10}
183 skip_fail: false
184
185- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200186 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
sgudz8c888ec2017-10-02 15:29:23 +0300187 node_name: {{ HOSTNAME_CFG01 }}
sgudzddca7322018-04-20 12:56:10 +0300188 retry: {count: 5, delay: 15}
sgudz8c888ec2017-10-02 15:29:23 +0300189 skip_fail: false
190
sgudz8c888ec2017-10-02 15:29:23 +0300191# Configure the services running in Docker Swarm
sgudzddca7322018-04-20 12:56:10 +0300192- description: Configure prometheus in docker swarm
193 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
sgudz8c888ec2017-10-02 15:29:23 +0300194 node_name: {{ HOSTNAME_CFG01 }}
195 retry: {count: 1, delay: 10}
196 skip_fail: false
197
sgudzddca7322018-04-20 12:56:10 +0300198- description: Configure Remote Collector in Docker Swarm for Openstack deployments
199 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
200 node_name: {{ HOSTNAME_CFG01 }}
201 retry: {count: 1, delay: 10}
202 skip_fail: false
203
204- description: Install sphinx
205 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
206 node_name: {{ HOSTNAME_CFG01 }}
207 retry: {count: 1, delay: 10}
208 skip_fail: false
209
210
211#- description: Install prometheus alertmanager
212# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
213# node_name: {{ HOSTNAME_CFG01 }}
214# retry: {count: 1, delay: 10}
215# skip_fail: false
216
217#- description: run docker state
218# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
219# node_name: {{ HOSTNAME_CFG01 }}
220# retry: {count: 1, delay: 10}
221# skip_fail: false
222#
223#- description: docker ps
224# cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
225# node_name: {{ HOSTNAME_CFG01 }}
226# retry: {count: 1, delay: 10}
227# skip_fail: false
228
sgudz8c888ec2017-10-02 15:29:23 +0300229- description: Configure Grafana dashboards and datasources
sgudzddca7322018-04-20 12:56:10 +0300230 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
sgudz8c888ec2017-10-02 15:29:23 +0300231 node_name: {{ HOSTNAME_CFG01 }}
232 retry: {count: 2, delay: 10}
233 skip_fail: false
234
235- description: Run salt minion to create cert files
236 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
237 node_name: {{ HOSTNAME_CFG01 }}
238 retry: {count: 1, delay: 10}
239 skip_fail: false