blob: a3ddc8752c76c6d22fa6ff304e384e81cf8eb92f [file] [log] [blame]
Tatyana Leontovichd85357d2017-08-02 15:28:37 +03001{% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
2
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
21 cmd: salt -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 -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 -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 -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 -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
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030050- description: Rerun swarm on slaves to proper token population
51 cmd: salt -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
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030056- description: Configure slave nodes
57 cmd: salt -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 -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 -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
71 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030072 retry: {count: 2, delay: 10}
73 skip_fail: false
74
75- description: Configure Prometheus exporters
76 cmd: salt -C 'I@prometheus:exporters' state.sls prometheus
77 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichd85357d2017-08-02 15:28:37 +030078 retry: {count: 1, delay: 10}
79 skip_fail: false
80
81- description: Configure collector
82 cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector
83 node_name: {{ HOSTNAME_CFG01 }}
84 retry: {count: 1, delay: 10}
85 skip_fail: false
86
87- description: Install elasticsearch server
88 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
89 node_name: {{ HOSTNAME_CFG01 }}
90 retry: {count: 1, delay: 10}
91 skip_fail: false
92
93- description: Install kibana server
94 cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
95 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 1, delay: 10}
97 skip_fail: false
98
99- description: Install elasticsearch client
100 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
101 node_name: {{ HOSTNAME_CFG01 }}
102 retry: {count: 1, delay: 10}
103 skip_fail: false
104
105- description: Install kibana client
106 cmd: salt -C 'I@kibana:client' state.sls kibana.client
107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 10}
109 skip_fail: false
110
111- description: Check influix db
112 cmd: |
113 INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
114 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
115 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
116 salt -C 'I@influxdb:server' state.sls influxdb
117 fi
118 node_name: {{ HOSTNAME_CFG01 }}
119 retry: {count: 1, delay: 5}
120 skip_fail: true
121
122# Collect grains needed to configure the services
123
124- description: Get grains
125 cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains
126 node_name: {{ HOSTNAME_CFG01 }}
127 retry: {count: 1, delay: 10}
128 skip_fail: false
129
130- description: Sync modules
131 cmd: salt -C 'I@salt:minion' saltutil.refresh_modules
132 node_name: {{ HOSTNAME_CFG01 }}
133 retry: {count: 1, delay: 10}
134 skip_fail: false
135
136- description: Update mine
137 cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
138 node_name: {{ HOSTNAME_CFG01 }}
139 retry: {count: 1, delay: 10}
140 skip_fail: false
141
142# Change environment configuration before deploy
143- description: Set SL docker images deploy parameters
144 cmd: |
145 {% for sl_opt, value in config.sl_deploy.items() %}
146 {% if value|string() %}
147 salt-call reclass.cluster_meta_set {{ sl_opt }} {{ value }};
148 {% endif %}
149 {% endfor %}
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 1}
152 skip_fail: false
153
154# Configure the services running in Docker Swarm
155- description: Install prometheus alertmanager
156 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 1, delay: 10}
159 skip_fail: false
160
161- description: run docker state
162 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
163 node_name: {{ HOSTNAME_CFG01 }}
164 retry: {count: 1, delay: 10}
165 skip_fail: false
166
167- description: docker ps
168 cmd: salt -C 'I@docker:swarm' dockerng.ps
169 node_name: {{ HOSTNAME_CFG01 }}
170 retry: {count: 1, delay: 10}
171 skip_fail: false
172
173- description: Configure Grafana dashboards and datasources
174 cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client
175 node_name: {{ HOSTNAME_CFG01 }}
176 retry: {count: 2, delay: 10}
177 skip_fail: false
178
179- description: Run salt minion to create cert files
180 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
181 node_name: {{ HOSTNAME_CFG01 }}
182 retry: {count: 1, delay: 10}
183 skip_fail: false
184