blob: d29c9c3103c55db3d0aa00d952f4847327739803 [file] [log] [blame]
Jakub Josef79ecec32017-02-17 14:36:28 +01001package com.mirantis.mk
2/**
3 * Orchestration functions
4 *
5*/
6
7def validateFoundationInfra(master) {
8 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +02009
10 salt.runSaltProcessStep(master, 'I@salt:master', 'cmd.run', ['salt-key'], null, true)
11 salt.runSaltProcessStep(master, 'I@salt:minion', 'test.version', [], null, true)
12 salt.runSaltProcessStep(master, 'I@salt:master', 'cmd.run', ['reclass-salt --top'], null, true)
13 salt.runSaltProcessStep(master, 'I@reclass:storage', 'reclass.inventory', [], null, true)
14 salt.runSaltProcessStep(master, 'I@salt:minion', 'state.show_top', [], null, true)
Jakub Josef79ecec32017-02-17 14:36:28 +010015}
16
Jakub Josef79ecec32017-02-17 14:36:28 +010017def installFoundationInfra(master) {
18 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +020019
Vasyl Saienkoe36ab7c2017-07-17 14:35:48 +030020 salt.enforceState(master, 'I@salt:master', ['salt.master', 'reclass'], true, false, null, false, 60, 2)
Tomáš Kukrálb4d75222017-06-06 10:36:02 +020021
22 salt.runSaltProcessStep(master, '*', 'saltutil.refresh_pillar', [], null, true)
23 salt.runSaltProcessStep(master, '*', 'saltutil.sync_all', [], null, true)
24
25 salt.enforceState(master, 'I@salt:master', ['linux.system'], true)
Vasyl Saienkoe36ab7c2017-07-17 14:35:48 +030026 salt.enforceState(master, 'I@salt:master', ['salt.minion'], true, false, null, false, 60, 2)
Tomáš Kukrálb4d75222017-06-06 10:36:02 +020027 salt.enforceState(master, 'I@salt:master', ['salt.minion'], true)
28
Jakub Josef200550f2017-05-16 17:39:55 +020029 salt.enforceState(master, '*', ['linux.system'], true)
Vasyl Saienkoe36ab7c2017-07-17 14:35:48 +030030 salt.enforceState(master, 'I@linux:system', ['linux', 'openssh', 'ntp'], true)
Tomáš Kukrál7e767f92017-08-18 14:53:17 +020031 salt.enforceState(master, '*', ['salt.minion'], true, false, null, false, 60, 2)
Jakub Josef4f8f4df2017-09-01 14:32:42 +020032 sleep(5)
33 salt.enforceState(master, '*', ['linux.network.host'], true)
Jakub Josef79ecec32017-02-17 14:36:28 +010034}
35
Tomáš Kukrál8d2be5a2017-02-28 11:22:29 +010036def installInfraKvm(master) {
37 def salt = new com.mirantis.mk.Salt()
Tomáš Kukrál8d2be5a2017-02-28 11:22:29 +010038
Ales Komarekef2bab62017-04-26 11:48:28 +020039 salt.runSaltProcessStep(master, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true)
40 salt.runSaltProcessStep(master, 'I@linux:system', 'saltutil.sync_all', [], null, true)
41
Richard Felkl286f25f2017-07-26 14:23:55 +020042 salt.enforceState(master, 'I@salt:control', ['salt.minion'], true, false, null, false, 60, 2)
Vasyl Saienkoe36ab7c2017-07-17 14:35:48 +030043 salt.enforceState(master, 'I@salt:control', ['linux.system', 'linux.network', 'ntp'], true)
Tomáš Kukrál0abdde52017-03-01 21:57:23 +010044 salt.enforceState(master, 'I@salt:control', 'libvirt', true)
45 salt.enforceState(master, 'I@salt:control', 'salt.control', true)
Tomáš Kukrálb8e97112017-03-01 16:03:16 +010046
Ales Komarekef2bab62017-04-26 11:48:28 +020047 sleep(600)
Tomáš Kukrálb8e97112017-03-01 16:03:16 +010048
Marek Celoudc9b3cc82017-05-22 12:50:53 +000049 salt.runSaltProcessStep(master, '* and not kvm*', 'saltutil.refresh_pillar', [], null, true)
50 salt.runSaltProcessStep(master, '* and not kvm*', 'saltutil.sync_all', [], null, true)
Tomáš Kukrál8d2be5a2017-02-28 11:22:29 +010051}
Jakub Josef79ecec32017-02-17 14:36:28 +010052
vrovachev1c4770b2017-07-05 13:25:21 +040053def installInfra(master) {
Jakub Josef79ecec32017-02-17 14:36:28 +010054 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +020055
Jakub Josef79ecec32017-02-17 14:36:28 +010056 // Install glusterfs
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +020057 if (salt.testTarget(master, 'I@glusterfs:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +040058 salt.enforceState(master, 'I@glusterfs:server', 'glusterfs.server.service', true)
Tomáš Kukrálb8e97112017-03-01 16:03:16 +010059
vrovachev1c4770b2017-07-05 13:25:21 +040060 withEnv(['ASK_ON_ERROR=false']){
61 retry(5) {
62 salt.enforceState(master, 'I@glusterfs:server and *01*', 'glusterfs.server.setup', true)
63 }
Alexander Noskov93acac42017-06-20 17:55:55 +020064 }
vrovachev1c4770b2017-07-05 13:25:21 +040065
66 salt.runSaltProcessStep(master, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'], null, true)
67 salt.runSaltProcessStep(master, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'], null, true)
Alexander Noskov93acac42017-06-20 17:55:55 +020068 }
Ales Komarekef2bab62017-04-26 11:48:28 +020069
Jakub Josef79ecec32017-02-17 14:36:28 +010070 // Install galera
Richard Felklc0f163e2017-07-27 15:11:12 +020071 if (salt.testTarget(master, 'I@galera:master') || salt.testTarget(master, 'I@galera:slave')) {
vrovachev1c4770b2017-07-05 13:25:21 +040072 withEnv(['ASK_ON_ERROR=false']){
73 retry(2) {
74 salt.enforceState(master, 'I@galera:master', 'galera', true)
75 }
Ales Komarekef2bab62017-04-26 11:48:28 +020076 }
vrovachev1c4770b2017-07-05 13:25:21 +040077 salt.enforceState(master, 'I@galera:slave', 'galera', true)
78
79 // Check galera status
80 salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status')
81 salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status')
Vasyl Saienkoc1fb9892017-07-13 14:54:13 +030082 // If galera is not enabled check if we need to install mysql:server
83 } else if (salt.testTarget(master, 'I@mysql:server')){
84 salt.enforceState(master, 'I@mysql:server', 'mysql.server', true)
85 if (salt.testTarget(master, 'I@mysql:client')){
86 salt.enforceState(master, 'I@mysql:client', 'mysql.client', true)
87 }
Ales Komarekef2bab62017-04-26 11:48:28 +020088 }
Ales Komarekef2bab62017-04-26 11:48:28 +020089
vrovachev1c4770b2017-07-05 13:25:21 +040090 // Install docker
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +020091 if (salt.testTarget(master, 'I@docker:host')) {
vrovachev1c4770b2017-07-05 13:25:21 +040092 salt.enforceState(master, 'I@docker:host', 'docker.host')
Tomáš Kukrál0cf3ffb2017-09-03 10:18:18 +020093 salt.cmdRun(master, 'I@docker:host', 'docker ps')
vrovachev1c4770b2017-07-05 13:25:21 +040094 }
Ales Komarekef2bab62017-04-26 11:48:28 +020095
vrovachev1c4770b2017-07-05 13:25:21 +040096 // Install keepalived
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +020097 if (salt.testTarget(master, 'I@keepalived:cluster')) {
vrovachev1c4770b2017-07-05 13:25:21 +040098 salt.enforceState(master, 'I@keepalived:cluster and *01*', 'keepalived', true)
99 salt.enforceState(master, 'I@keepalived:cluster', 'keepalived', true)
100 }
101
102 // Install rabbitmq
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200103 if (salt.testTarget(master, 'I@rabbitmq:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400104 withEnv(['ASK_ON_ERROR=false']){
105 retry(2) {
106 salt.enforceState(master, 'I@rabbitmq:server', 'rabbitmq', true)
107 }
108 }
109
110 // Check the rabbitmq status
111 salt.runSaltProcessStep(master, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status'])
112 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200113
Jakub Josef79ecec32017-02-17 14:36:28 +0100114 // Install haproxy
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200115 if (salt.testTarget(master, 'I@haproxy:proxy')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400116 salt.enforceState(master, 'I@haproxy:proxy', 'haproxy', true)
117 salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy'])
118 salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.restart', ['rsyslog'])
119 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200120
Jakub Josef79ecec32017-02-17 14:36:28 +0100121 // Install memcached
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200122 if (salt.testTarget(master, 'I@memcached:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400123 salt.enforceState(master, 'I@memcached:server', 'memcached', true)
124 }
125
126 // Install etcd
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200127 if (salt.testTarget(master, 'I@etcd:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400128 salt.enforceState(master, 'I@etcd:server', 'etcd.server.service')
Tomáš Kukrál0cf3ffb2017-09-03 10:18:18 +0200129 salt.cmdRun(master, 'I@etcd:server', 'bash -c "source /var/lib/etcd/configenv && etcdctl cluster-health"')
vrovachev1c4770b2017-07-05 13:25:21 +0400130 }
131}
132
133def installOpenstackInfra(master) {
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200134 def orchestrate = new com.mirantis.mk.Orchestrate()
vrovachev1c4770b2017-07-05 13:25:21 +0400135
136 // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200137 orchestrate.installInfra(master)
Jakub Josef79ecec32017-02-17 14:36:28 +0100138}
139
140
Ales Komarekef2bab62017-04-26 11:48:28 +0200141def installOpenstackControl(master) {
Jakub Josef79ecec32017-02-17 14:36:28 +0100142 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +0200143
144 // Install horizon dashboard
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300145 if (salt.testTarget(master, 'I@horizon:server')) {
146 salt.enforceState(master, 'I@horizon:server', 'horizon', true)
147 }
148 if (salt.testTarget(master, 'I@nginx:server')) {
149 salt.enforceState(master, 'I@nginx:server', 'nginx', true)
150 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200151
Jakub Josef79ecec32017-02-17 14:36:28 +0100152 // setup keystone service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300153 if (salt.testTarget(master, 'I@keystone:server')) {
154 //runSaltProcessStep(master, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
155 salt.enforceState(master, 'I@keystone:server and *01*', 'keystone.server', true)
156 salt.enforceState(master, 'I@keystone:server', 'keystone.server', true)
157 // populate keystone services/tenants/roles/users
Tomáš Kukrál926e6332017-03-02 09:23:03 +0100158
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300159 // keystone:client must be called locally
160 //salt.runSaltProcessStep(master, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true)
161 salt.runSaltProcessStep(master, 'I@keystone:server', 'service.restart', ['apache2'])
162 sleep(30)
163 }
164 if (salt.testTarget(master, 'I@keystone:client')) {
Vasyl Saienkoff6f0f02017-07-19 15:54:16 +0300165 salt.enforceState(master, 'I@keystone:client and *01*', 'keystone.client', true)
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300166 salt.enforceState(master, 'I@keystone:client', 'keystone.client', true)
167 }
168 if (salt.testTarget(master, 'I@keystone:server')) {
169 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonercv3; openstack service list'], null, true)
170 }
Tomáš Kukrál926e6332017-03-02 09:23:03 +0100171
Jakub Josef79ecec32017-02-17 14:36:28 +0100172 // Install glance and ensure glusterfs clusters
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300173 if (salt.testTarget(master, 'I@glance:server')) {
174 //runSaltProcessStep(master, 'I@glance:server', 'state.sls', ['glance.server'], 1)
175 salt.enforceState(master, 'I@glance:server and *01*', 'glance.server', true)
176 salt.enforceState(master, 'I@glance:server', 'glance.server', true)
177 }
178 if (salt.testTarget(master, 'I@glusterfs:client')) {
179 salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client', true)
180 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200181
Jakub Josef79ecec32017-02-17 14:36:28 +0100182 // Update fernet tokens before doing request on keystone server
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300183 if (salt.testTarget(master, 'I@keystone:server')) {
184 salt.enforceState(master, 'I@keystone:server', 'keystone.server', true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200185
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300186 // Check glance service
187 if (salt.testTarget(master, 'I@glance:server')){
188 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true)
189 }
190 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200191
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400192 // Create glance resources
193 if (salt.testTarget(master, 'I@glance:client')) {
194 salt.enforceState(master, 'I@glance:client', 'glance.client', true)
195 }
196
Jakub Josef79ecec32017-02-17 14:36:28 +0100197 // Install and check nova service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300198 if (salt.testTarget(master, 'I@nova:controller')) {
199 //runSaltProcessStep(master, 'I@nova:controller', 'state.sls', ['nova'], 1)
200 salt.enforceState(master, 'I@nova:controller and *01*', 'nova.controller', true)
201 salt.enforceState(master, 'I@nova:controller', 'nova.controller', true)
202 if (salt.testTarget(master, 'I@keystone:server')) {
203 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true)
204 }
205 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200206
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400207 // Create nova resources
208 if (salt.testTarget(master, 'I@nova:client')) {
209 salt.enforceState(master, 'I@nova:client', 'nova.client', true)
210 }
211
Jakub Josef79ecec32017-02-17 14:36:28 +0100212 // Install and check cinder service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300213 if (salt.testTarget(master, 'I@cinder:controller')) {
214 //runSaltProcessStep(master, 'I@cinder:controller', 'state.sls', ['cinder'], 1)
215 salt.enforceState(master, 'I@cinder:controller and *01*', 'cinder', true)
216 salt.enforceState(master, 'I@cinder:controller', 'cinder', true)
217 if (salt.testTarget(master, 'I@keystone:server')) {
218 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true)
219 }
220 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200221
Jakub Josef79ecec32017-02-17 14:36:28 +0100222 // Install neutron service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300223 if (salt.testTarget(master, 'I@neutron:server')) {
224 //runSaltProcessStep(master, 'I@neutron:server', 'state.sls', ['neutron'], 1)
Ales Komarekef2bab62017-04-26 11:48:28 +0200225
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300226 salt.enforceState(master, 'I@neutron:server and *01*', 'neutron.server', true)
227 salt.enforceState(master, 'I@neutron:server', 'neutron.server', true)
228 if (salt.testTarget(master, 'I@keystone:server')) {
229 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true)
230 }
231 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200232
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400233 // Create neutron resources
234 if (salt.testTarget(master, 'I@neutron:client')) {
235 salt.enforceState(master, 'I@neutron:client', 'neutron.client', true)
236 }
237
Jakub Josef79ecec32017-02-17 14:36:28 +0100238 // Install heat service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300239 if (salt.testTarget(master, 'I@heat:server')) {
240 //runSaltProcessStep(master, 'I@heat:server', 'state.sls', ['heat'], 1)
241 salt.enforceState(master, 'I@heat:server and *01*', 'heat', true)
242 salt.enforceState(master, 'I@heat:server', 'heat', true)
243 if (salt.testTarget(master, 'I@keystone:server')) {
244 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true)
245 }
246 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200247
248 // Restart nova api
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300249 if (salt.testTarget(master, 'I@nova:controller')) {
250 salt.runSaltProcessStep(master, 'I@nova:controller', 'service.restart', ['nova-api'])
251 }
Vasyl Saienkoa7c10c02017-07-13 10:43:43 +0300252
253 // Install ironic service
254 if (salt.testTarget(master, 'I@ironic:api')) {
Andrey Shestakov82c0b892017-07-24 18:46:21 +0300255 salt.enforceState(master, 'I@ironic:api and *01*', 'ironic.api', true)
Vasyl Saienkoa7c10c02017-07-13 10:43:43 +0300256 salt.enforceState(master, 'I@ironic:api', 'ironic.api', true)
257 }
Andrey Shestakov82c0b892017-07-24 18:46:21 +0300258
259 // Install designate service
260 if (salt.testTarget(master, 'I@designate:server:enabled')) {
261 if (salt.testTarget(master, 'I@designate:server:backend:bind9')) {
262 salt.enforceState(master, 'I@bind:server', 'bind.server', true)
263 }
264 if (salt.testTarget(master, 'I@designate:server:backend:pdns4')) {
265 salt.enforceState(master, 'I@powerdns:server', 'powerdns.server', true)
266 }
267 salt.enforceState(master, 'I@designate:server and *01*', 'designate.server', true)
268 salt.enforceState(master, 'I@designate:server', 'designate.server', true)
269 }
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400270
271 // Install octavia api service
272 if (salt.testTarget(master, 'I@octavia:api')) {
273 salt.enforceState(master, 'I@octavia:api', 'octavia', true)
274 }
Marek Celoudc9dd50f2017-08-28 13:54:40 +0200275
276 // Install barbican server service
277 if (salt.testTarget(master, 'I@barbican:server')) {
278 salt.enforceState(master, 'I@barbican:server', 'barbican.server', true)
279 }
280 // Install barbican client
281 if (salt.testTarget(master, 'I@barbican:client')) {
282 salt.enforceState(master, 'I@barbican:client', 'barbican.client', true)
283 }
Jakub Josef79ecec32017-02-17 14:36:28 +0100284}
285
286
Vasyl Saienkoa7c10c02017-07-13 10:43:43 +0300287def installIronicConductor(master){
288 def salt = new com.mirantis.mk.Salt()
289
290 if (salt.testTarget(master, 'I@ironic:conductor')) {
291 salt.enforceState(master, 'I@ironic:conductor', 'ironic.conductor', true)
292 salt.enforceState(master, 'I@ironic:conductor', 'apache', true)
293 }
294 if (salt.testTarget(master, 'I@tftpd_hpa:server')) {
295 salt.enforceState(master, 'I@tftpd_hpa:server', 'tftpd_hpa', true)
296 }
297
298 if (salt.testTarget(master, 'I@nova:compute')) {
299 salt.runSaltProcessStep(master, 'I@nova:compute', 'service.restart', ['nova-compute'])
300 }
301
302 if (salt.testTarget(master, 'I@baremetal_simulator:enabled')) {
303 salt.enforceState(master, 'I@baremetal_simulator:enabled', 'baremetal_simulator', true)
304 }
305 if (salt.testTarget(master, 'I@ironic:client')) {
306 salt.enforceState(master, 'I@ironic:client', 'ironic.client', true)
307 }
308}
309
310
311
Ales Komarekef2bab62017-04-26 11:48:28 +0200312def installOpenstackNetwork(master, physical = "false") {
Jakub Josef79ecec32017-02-17 14:36:28 +0100313 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +0200314
315 salt.runSaltProcessStep(master, 'I@neutron:gateway', 'state.apply', [], null, true)
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400316
317 // install octavia manager services
318 if (salt.testTarget(master, 'I@octavia:manager')) {
319 salt.runSaltProcessStep(master, 'I@salt:master', 'mine.update', ['*'], null, true)
320 salt.enforceState(master, 'I@octavia:manager', 'salt.minion.ca', true)
321 salt.enforceState(master, 'I@octavia:manager', 'salt.minion.cert', true)
322 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200323}
324
325
326def installOpenstackCompute(master) {
327 def salt = new com.mirantis.mk.Salt()
328
329 // Configure compute nodes
330 retry(2) {
Marek Celoude305ec72017-05-16 11:27:53 +0200331 salt.runSaltProcessStep(master, 'I@nova:compute', 'state.highstate', ['exclude=opencontrail.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200332 }
333}
334
335
336def installContrailNetwork(master) {
Martin Polreichfc9854c2017-06-30 11:17:36 +0200337 def common = new com.mirantis.mk.Common()
Ales Komarekef2bab62017-04-26 11:48:28 +0200338 def salt = new com.mirantis.mk.Salt()
339
340
Jakub Josef79ecec32017-02-17 14:36:28 +0100341 // Install opencontrail database services
342 //runSaltProcessStep(master, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1)
Ales Komarekef2bab62017-04-26 11:48:28 +0200343 try {
344 salt.enforceState(master, 'I@opencontrail:database and *01*', 'opencontrail.database', true)
345 } catch (Exception e) {
346 common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database and *01*')
347 }
348
349 try {
350 salt.enforceState(master, 'I@opencontrail:database', 'opencontrail.database', true)
351 } catch (Exception e) {
352 common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database')
353 }
354
Jakub Josef79ecec32017-02-17 14:36:28 +0100355 // Install opencontrail control services
356 //runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1)
Ales Komarekef2bab62017-04-26 11:48:28 +0200357 salt.runSaltProcessStep(master, 'I@opencontrail:control and *01*', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
358 salt.runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
359 salt.runSaltProcessStep(master, 'I@opencontrail:collector', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
Tomáš Kukrálb8e97112017-03-01 16:03:16 +0100360
Jakub Josef79ecec32017-02-17 14:36:28 +0100361 // Test opencontrail
Ales Komarekef2bab62017-04-26 11:48:28 +0200362 salt.runSaltProcessStep(master, 'I@opencontrail:control', 'cmd.run', ['contrail-status'], null, true)
Jakub Josef79ecec32017-02-17 14:36:28 +0100363}
364
365
Ales Komarekef2bab62017-04-26 11:48:28 +0200366def installContrailCompute(master) {
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200367 def salt = new com.mirantis.mk.Salt()
vrovachev32f7f542017-08-25 16:17:25 +0400368 def common = new com.mirantis.mk.Common()
Jakub Josef79ecec32017-02-17 14:36:28 +0100369 // Configure compute nodes
Ales Komarekef2bab62017-04-26 11:48:28 +0200370 // Provision opencontrail control services
371 salt.enforceState(master, 'I@opencontrail:database:id:1', 'opencontrail.client', true)
Jakub Josef79ecec32017-02-17 14:36:28 +0100372 // Provision opencontrail virtual routers
Tomáš Kukrálb8e97112017-03-01 16:03:16 +0100373
vrovachev4ff77302017-08-09 20:39:57 +0400374 // Generate script /usr/lib/contrail/if-vhost0 for up vhost0
375 try {
376 salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail', true)
377 } catch (Exception e) {
378 common.warningMsg('Exception in state opencontrail on I@opencontrail:compute')
379 }
380
Ales Komarekef2bab62017-04-26 11:48:28 +0200381 salt.runSaltProcessStep(master, 'I@nova:compute', 'cmd.run', ['exec 0>&-; exec 1>&-; exec 2>&-; nohup bash -c "ip link | grep vhost && echo no_reboot || sleep 5 && reboot & "'], null, true)
vrovachev4ff77302017-08-09 20:39:57 +0400382
383 if (salt.testTarget(master, 'I@opencontrail:compute')) {
384 sleep(300)
385 salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail.client', true)
386 salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail', true)
387 }
Jakub Josef79ecec32017-02-17 14:36:28 +0100388}
389
390
Ales Komarekef2bab62017-04-26 11:48:28 +0200391def installKubernetesInfra(master) {
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200392 def orchestrate = new com.mirantis.mk.Orchestrate()
vrovachev1c4770b2017-07-05 13:25:21 +0400393 // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200394 orchestrate.installInfra(master)
Jakub Josef79ecec32017-02-17 14:36:28 +0100395}
396
397
Tomáš Kukrálc1a1bbc2017-04-28 21:16:25 +0200398def installKubernetesControl(master) {
Jakub Josef79ecec32017-02-17 14:36:28 +0100399 def salt = new com.mirantis.mk.Salt()
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200400
Jakub Josef79ecec32017-02-17 14:36:28 +0100401 // Install Kubernetes pool and Calico
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200402 salt.enforceState(master, 'I@kubernetes:master', 'kubernetes.master.kube-addons')
403 salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool')
Jakub Josef79ecec32017-02-17 14:36:28 +0100404
405 // Setup etcd server
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200406 salt.enforceState(master, 'I@kubernetes:master and *01*', 'etcd.server.setup')
Jakub Josef79ecec32017-02-17 14:36:28 +0100407
408 // Run k8s without master.setup
409 salt.runSaltProcessStep(master, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup'])
410
411 // Run k8s master setup
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200412 salt.enforceState(master, 'I@kubernetes:master and *01*', 'kubernetes.master.setup')
Jakub Josef79ecec32017-02-17 14:36:28 +0100413
414 // Restart kubelet
415 salt.runSaltProcessStep(master, 'I@kubernetes:pool', 'service.restart', ['kubelet'])
416}
417
418
Ales Komarekef2bab62017-04-26 11:48:28 +0200419def installKubernetesCompute(master) {
Tomáš Kukrála53b5352017-05-04 11:45:53 +0200420 def salt = new com.mirantis.mk.Salt()
Tomáš Kukrále7e28962017-06-06 11:11:16 +0200421
422 // Refresh minion's pillar data
423 salt.runSaltProcessStep(master, '*', 'saltutil.refresh_pillar', [], null, true)
424 salt.runSaltProcessStep(master, '*', 'saltutil.sync_all', [], null, true)
425
426 // Bootstrap all nodes
427 salt.enforceState(master, 'I@kubernetes:pool', 'linux')
428 salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion')
429 salt.enforceState(master, 'I@kubernetes:pool', ['openssh', 'ntp'])
430
431 // Create and distribute SSL certificates for services using salt state
432 salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion.cert')
433
434 // Install docker
435 salt.enforceState(master, 'I@docker:host', 'docker.host')
436
437 // Install Kubernetes and Calico
438 salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool')
439
Tomáš Kukrál0c598272017-09-04 11:03:05 +0200440 if (salt.testTarget(master, 'I@helm:client')) {
441 salt.enforceState(master, 'I@helm:client', 'helm')
442 }
Tomáš Kukrále7e28962017-06-06 11:11:16 +0200443}
444
445
Martin Polreich8663a342017-06-30 17:33:08 +0200446def installDockerSwarm(master) {
447 def salt = new com.mirantis.mk.Salt()
Jakub Josef79ecec32017-02-17 14:36:28 +0100448
vrovachev1c4770b2017-07-05 13:25:21 +0400449 //Install and Configure Docker
Martin Polreich8663a342017-06-30 17:33:08 +0200450 salt.enforceState(master, 'I@docker:swarm', 'docker.host')
451 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true)
452 salt.enforceState(master, 'I@docker:swarm', 'salt.minion.grains', true)
453 salt.runSaltProcessStep(master, 'I@docker:swarm', 'mine.update', [], null, true)
454 salt.runSaltProcessStep(master, 'I@docker:swarm', 'saltutil.refresh_modules', [], null, true)
455 sleep(5)
Martin Polreich377c37a2017-08-08 15:42:51 +0200456 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200457 salt.enforceState(master, 'I@docker:swarm:role:manager', 'docker.swarm', true)
458 salt.cmdRun(master, 'I@docker:swarm:role:master', 'docker node ls', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200459}
460
Jiri Broulikb9a0c592017-09-05 16:41:48 +0200461
462def installCicd(master) {
463 def salt = new com.mirantis.mk.Salt()
464
465 //Install and Configure Docker
466 salt.enforceState(master, 'I@aptly:publisher', 'aptly.publisher')
467 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.client', true)
468 sleep(300)
469 salt.enforceState(master, 'I@aptly:server', 'aptly', true)
470 salt.enforceState(master, 'I@openldap:client', 'openldap', true)
471 salt.enforceState(master, 'I@gerrit:client', 'gerrit', true)
472 salt.enforceState(master, 'I@jenkins:client', 'jenkins', true)
473}
474
475
Martin Polreich8663a342017-06-30 17:33:08 +0200476def installStacklight(master) {
477 def common = new com.mirantis.mk.Common()
478 def salt = new com.mirantis.mk.Salt()
479
Simon Pasquieref4122c2017-08-25 15:52:07 +0200480 // Install core services for K8S environments:
481 // HAProxy, Nginx and lusterFS clients
482 // In case of OpenStack, those are already installed
Martin Polreich792f2662017-07-11 13:36:32 +0200483 if (common.checkContains('STACK_INSTALL', 'k8s')) {
484 salt.enforceState(master, 'I@haproxy:proxy', 'haproxy')
485 salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy'])
Simon Pasquieref4122c2017-08-25 15:52:07 +0200486
487 if (salt.testTarget(master, 'I@nginx:server')) {
488 salt.enforceState(master, 'I@nginx:server', 'nginx', true)
489 }
490
491 if (salt.testTarget(master, 'I@glusterfs:client')) {
492 salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client', true)
493 }
Martin Polreich792f2662017-07-11 13:36:32 +0200494 }
Martin Polreich8663a342017-06-30 17:33:08 +0200495 //Install Telegraf
Martin Polreichd894e3e2017-07-04 15:35:02 +0200496 salt.enforceState(master, 'I@telegraf:agent or I@telegraf:remote_agent', 'telegraf', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200497
Dmitry Kalashnikebc1e1e2017-07-13 14:20:08 +0400498 // Install Prometheus exporters
499 if (salt.testTarget(master, 'I@prometheus:exporters')) {
500 salt.enforceState(master, 'I@prometheus:exporters', 'prometheus', true)
501 }
502
Martin Polreich8663a342017-06-30 17:33:08 +0200503 //Install Elasticsearch and Kibana
Martin Polreichbf7f6162017-07-06 14:43:21 +0200504 salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true)
Martin Polreicha540ac12017-06-30 22:48:39 +0200505 salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true)
Martin Polreichbf7f6162017-07-06 14:43:21 +0200506 salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200507 salt.enforceState(master, 'I@kibana:server', 'kibana.server', true)
Martin Polreicha540ac12017-06-30 22:48:39 +0200508 salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200509 salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
Martin Polreichbf7f6162017-07-06 14:43:21 +0200510 salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200511 salt.enforceState(master, 'I@influxdb:server', 'influxdb', true)
512
Simon Pasquier6301ddd2017-09-05 11:56:58 +0200513 salt.enforceState(master, 'I@heka:log_collector', 'heka.log_collector')
514
Martin Polreich470925a2017-07-06 17:12:59 +0200515 // Install galera
Martin Polreich792f2662017-07-11 13:36:32 +0200516 if (common.checkContains('STACK_INSTALL', 'k8s')) {
517 withEnv(['ASK_ON_ERROR=false']){
518 retry(2) {
519 salt.enforceState(master, 'I@galera:master', 'galera', true)
520 }
Martin Polreich470925a2017-07-06 17:12:59 +0200521 }
Martin Polreich792f2662017-07-11 13:36:32 +0200522 salt.enforceState(master, 'I@galera:slave', 'galera', true)
Martin Polreich406f6462017-07-11 11:33:42 +0000523
Martin Polreich792f2662017-07-11 13:36:32 +0200524 // Check galera status
525 salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status')
526 salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status')
527 }
Martin Polreich470925a2017-07-06 17:12:59 +0200528
Martin Polreich8663a342017-06-30 17:33:08 +0200529 //Collect Grains
530 salt.enforceState(master, 'I@salt:minion', 'salt.minion.grains', true)
531 salt.runSaltProcessStep(master, 'I@salt:minion', 'saltutil.refresh_modules', [], null, true)
532 salt.runSaltProcessStep(master, 'I@salt:minion', 'mine.update', [], null, true)
533 sleep(5)
534
535 //Configure services in Docker Swarm
Martin Polreich8017f452017-08-21 16:01:42 +0200536 if (common.checkContains('STACK_INSTALL', 'k8s')) {
537 salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'prometheus', true, false)
538 }
539 else {
540 salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', ['prometheus', 'heka.remote_collector'], true, false)
541 }
Martin Polreich8663a342017-06-30 17:33:08 +0200542 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker', true)
Martin Polreich595baef2017-07-04 16:11:04 +0200543 salt.runSaltProcessStep(master, 'I@docker:swarm', 'dockerng.ps', [], null, true)
Martin Polreich8663a342017-06-30 17:33:08 +0200544
545 //Configure Grafana
Martin Polreich305e2222017-07-06 11:33:00 +0200546 def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address')
Martin Polreich8663a342017-06-30 17:33:08 +0200547 common.prettyPrint(pillar)
Martin Polreich595baef2017-07-04 16:11:04 +0200548
Martin Polreich8663a342017-06-30 17:33:08 +0200549 def stacklight_vip
550 if(!pillar['return'].isEmpty()) {
551 stacklight_vip = pillar['return'][0].values()[0]
552 } else {
553 common.errorMsg('[ERROR] Stacklight VIP address could not be retrieved')
554 }
vrovachev1c4770b2017-07-05 13:25:21 +0400555
Martin Polreich305e2222017-07-06 11:33:00 +0200556 common.infoMsg("Waiting for service on http://${stacklight_vip}:15013/ to start")
Martin Polreichbd7ad222017-07-06 12:53:51 +0200557 sleep(120)
Martin Polreich8663a342017-06-30 17:33:08 +0200558 salt.enforceState(master, 'I@grafana:client', 'grafana.client', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200559}
560
561def installStacklightv1Control(master) {
Tomáš Kukrála53b5352017-05-04 11:45:53 +0200562 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +0200563
564 // infra install
565 // Install the StackLight backends
566 salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true)
567 salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true)
568
569 salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true)
570 salt.enforceState(master, 'I@influxdb:server', 'influxdb', true)
571
572 salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true)
573 salt.enforceState(master, 'I@kibana:server', 'kibana.server', true)
574
575 salt.enforceState(master, '*01* and I@grafana:server','grafana.server', true)
576 salt.enforceState(master, 'I@grafana:server','grafana.server', true)
577
Kalynovskyi3e370112017-06-26 12:48:23 +0300578 def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service')
579 def alarming_service = alarming_service_pillar['return'][0].values()[0]
580
581 switch (alarming_service) {
582 case 'sensu':
583 // Update Sensu
584 salt.enforceState(master, 'I@sensu:server and I@rabbitmq:server', 'rabbitmq', true)
585 salt.enforceState(master, 'I@redis:cluster:role:master', 'redis', true)
586 salt.enforceState(master, 'I@redis:server', 'redis', true)
587 salt.enforceState(master, 'I@sensu:server', 'sensu', true)
588 default:
589 // Update Nagios
590 salt.enforceState(master, 'I@nagios:server', 'nagios.server', true)
591 // Stop the Nagios service because the package starts it by default and it will
592 // started later only on the node holding the VIP address
593 salt.runSaltProcessStep(master, 'I@nagios:server', 'service.stop', ['nagios3'], null, true)
594 }
595
Ales Komarekef2bab62017-04-26 11:48:28 +0200596 salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client.service', true)
Marek Celoudebc623b2017-06-02 17:12:31 +0200597 salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200598
599 sleep(10)
600}
601
Martin Polreich8663a342017-06-30 17:33:08 +0200602def installStacklightv1Client(master) {
Tomáš Kukrála53b5352017-05-04 11:45:53 +0200603 def salt = new com.mirantis.mk.Salt()
604 def common = new com.mirantis.mk.Common()
Ales Komarekef2bab62017-04-26 11:48:28 +0200605
Alexander Noskov3c6a60a2017-06-21 14:05:07 +0200606 salt.runSaltProcessStep(master, 'I@elasticsearch:client', 'cmd.run', ['salt-call state.sls elasticsearch.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200607 // salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true)
Alexander Noskov3c6a60a2017-06-21 14:05:07 +0200608 salt.runSaltProcessStep(master, 'I@kibana:client', 'cmd.run', ['salt-call state.sls kibana.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200609 // salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
610
611 // Install collectd, heka and sensu services on the nodes, this will also
612 // generate the metadata that goes into the grains and eventually into Salt Mine
613 salt.enforceState(master, '*', 'collectd', true)
614 salt.enforceState(master, '*', 'salt.minion', true)
615 salt.enforceState(master, '*', 'heka', true)
616
617 // Gather the Grafana metadata as grains
618 salt.enforceState(master, 'I@grafana:collector', 'grafana.collector', true)
619
620 // Update Salt Mine
621 salt.enforceState(master, '*', 'salt.minion.grains', true)
622 salt.runSaltProcessStep(master, '*', 'saltutil.refresh_modules', [], null, true)
623 salt.runSaltProcessStep(master, '*', 'mine.update', [], null, true)
624
625 sleep(5)
626
627 // Update Heka
628 salt.enforceState(master, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka', true)
629
630 // Update collectd
631 salt.enforceState(master, 'I@collectd:remote_client:enabled:True', 'collectd', true)
632
Kalynovskyi3e370112017-06-26 12:48:23 +0300633 def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service')
634 def alarming_service = alarming_service_pillar['return'][0].values()[0]
Ales Komarekef2bab62017-04-26 11:48:28 +0200635
Kalynovskyi3e370112017-06-26 12:48:23 +0300636 switch (alarming_service) {
637 case 'sensu':
638 // Update Sensu
639 // TODO for stacklight team, should be fixed in model
640 salt.enforceState(master, 'I@sensu:client', 'sensu', true)
641 default:
642 break
643 // Default is nagios, and was enforced in installStacklightControl()
644 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200645
Alexander Noskov3c6a60a2017-06-21 14:05:07 +0200646 salt.runSaltProcessStep(master, 'I@grafana:client and *01*', 'cmd.run', ['salt-call state.sls grafana.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200647 // salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true)
648
Marek Celoudd200cad2017-06-07 10:34:46 +0200649 // Finalize the configuration of Grafana (add the dashboards...)
Alexander Noskov8448fc52017-06-21 14:03:45 +0200650 salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true)
651 salt.enforceState(master, 'I@grafana:client and *02*', 'grafana.client', true)
652 salt.enforceState(master, 'I@grafana:client and *03*', 'grafana.client', true)
Marek Celoudd200cad2017-06-07 10:34:46 +0200653 // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10
654
Ales Komarekef2bab62017-04-26 11:48:28 +0200655 // Get the StackLight monitoring VIP addres
656 //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}')
657 //vip=${vip:=172.16.10.253}
658 def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address')
Jakub Josefbceaa322017-06-13 18:28:27 +0200659 common.prettyPrint(pillar)
Ales Komarekef2bab62017-04-26 11:48:28 +0200660 def stacklight_vip = pillar['return'][0].values()[0]
661
662 if (stacklight_vip) {
663 // (re)Start manually the services that are bound to the monitoring VIP
664 common.infoMsg("restart services on node with IP: ${stacklight_vip}")
665 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], null, true)
666 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], null, true)
667 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], null, true)
668 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], null, true)
669 } else {
670 throw new Exception("Missing stacklight_vip")
671 }
Tomáš Kukrálf06ca0f2017-02-27 15:18:50 +0100672}
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200673
674
675//
676// Ceph
677//
678
Tomáš Kukráled27a472017-08-29 10:26:25 +0200679def installCephMon(master, target='I@ceph:mon') {
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200680 def salt = new com.mirantis.mk.Salt()
681
Ondrej Smolafd5c2352017-08-11 14:25:39 +0200682 // install Ceph Mons
Tomáš Kukrál9b4fb512017-08-14 11:01:49 +0200683 salt.enforceState(master, target, 'ceph.mon', true)
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200684}
685
Tomáš Kukráled27a472017-08-29 10:26:25 +0200686def installCephOsd(master, target='I@ceph:osd', setup=true) {
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200687 def salt = new com.mirantis.mk.Salt()
688
Tomáš Kukrál3343a1f2017-08-16 12:03:36 +0200689 // Prapare filesystem on OSD drives
690 salt.enforceState(master, target, 'linux.storage', true)
691
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200692 // install Ceph OSDs
693 salt.enforceState(master, target, 'ceph.osd', true)
Tomáš Kukráled27a472017-08-29 10:26:25 +0200694
695 // setup poools, keyrings and maybe crush
696 if (salt.testTarget(master, 'I@ceph:setup') && setup) {
Tomáš Kukrál4edbfa32017-08-29 14:26:06 +0200697 sleep(30)
Tomáš Kukráled27a472017-08-29 10:26:25 +0200698 salt.enforceState(master, 'I@ceph:setup', 'ceph.setup', true)
699 }
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200700}
Tomáš Kukrál1e5b2192017-08-15 16:58:18 +0200701
Tomáš Kukrál5836e3d2017-08-25 18:20:55 +0200702def installCephClient(master) {
Tomáš Kukrál1e5b2192017-08-15 16:58:18 +0200703 def salt = new com.mirantis.mk.Salt()
704
705 // install Ceph Radosgw
Tomáš Kukrál5836e3d2017-08-25 18:20:55 +0200706 if (salt.testTarget(master, 'I@ceph:radosgw')) {
Tomáš Kukrál1fe90452017-08-28 18:27:26 +0200707 salt.enforceState(master, 'I@ceph:radosgw', 'ceph.radosgw', true)
Tomáš Kukrál5836e3d2017-08-25 18:20:55 +0200708 }
Tomáš Kukrál1e5b2192017-08-15 16:58:18 +0200709}