blob: c24f9b633dd61666e3196da267df426ff324c507 [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
Oleg Grigorov26c8a6c2017-08-17 18:54:02 +030070 // Ensure glusterfs clusters is ready
71 if (salt.testTarget(master, 'I@glusterfs:client')) {
72 salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client', true)
73 }
74
Jakub Josef79ecec32017-02-17 14:36:28 +010075 // Install galera
Richard Felklc0f163e2017-07-27 15:11:12 +020076 if (salt.testTarget(master, 'I@galera:master') || salt.testTarget(master, 'I@galera:slave')) {
vrovachev1c4770b2017-07-05 13:25:21 +040077 withEnv(['ASK_ON_ERROR=false']){
78 retry(2) {
79 salt.enforceState(master, 'I@galera:master', 'galera', true)
80 }
Ales Komarekef2bab62017-04-26 11:48:28 +020081 }
vrovachev1c4770b2017-07-05 13:25:21 +040082 salt.enforceState(master, 'I@galera:slave', 'galera', true)
83
84 // Check galera status
85 salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status')
86 salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status')
Vasyl Saienkoc1fb9892017-07-13 14:54:13 +030087 // If galera is not enabled check if we need to install mysql:server
88 } else if (salt.testTarget(master, 'I@mysql:server')){
89 salt.enforceState(master, 'I@mysql:server', 'mysql.server', true)
90 if (salt.testTarget(master, 'I@mysql:client')){
91 salt.enforceState(master, 'I@mysql:client', 'mysql.client', true)
92 }
Ales Komarekef2bab62017-04-26 11:48:28 +020093 }
Ales Komarekef2bab62017-04-26 11:48:28 +020094
vrovachev1c4770b2017-07-05 13:25:21 +040095 // Install docker
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +020096 if (salt.testTarget(master, 'I@docker:host')) {
vrovachev1c4770b2017-07-05 13:25:21 +040097 salt.enforceState(master, 'I@docker:host', 'docker.host')
Tomáš Kukrál0cf3ffb2017-09-03 10:18:18 +020098 salt.cmdRun(master, 'I@docker:host', 'docker ps')
vrovachev1c4770b2017-07-05 13:25:21 +040099 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200100
vrovachev1c4770b2017-07-05 13:25:21 +0400101 // Install keepalived
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200102 if (salt.testTarget(master, 'I@keepalived:cluster')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400103 salt.enforceState(master, 'I@keepalived:cluster and *01*', 'keepalived', true)
104 salt.enforceState(master, 'I@keepalived:cluster', 'keepalived', true)
105 }
106
107 // Install rabbitmq
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200108 if (salt.testTarget(master, 'I@rabbitmq:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400109 withEnv(['ASK_ON_ERROR=false']){
110 retry(2) {
111 salt.enforceState(master, 'I@rabbitmq:server', 'rabbitmq', true)
112 }
113 }
114
115 // Check the rabbitmq status
116 salt.runSaltProcessStep(master, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status'])
117 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200118
Jakub Josef79ecec32017-02-17 14:36:28 +0100119 // Install haproxy
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200120 if (salt.testTarget(master, 'I@haproxy:proxy')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400121 salt.enforceState(master, 'I@haproxy:proxy', 'haproxy', true)
122 salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy'])
123 salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.restart', ['rsyslog'])
124 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200125
Jakub Josef79ecec32017-02-17 14:36:28 +0100126 // Install memcached
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200127 if (salt.testTarget(master, 'I@memcached:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400128 salt.enforceState(master, 'I@memcached:server', 'memcached', true)
129 }
130
131 // Install etcd
Tomáš Kukráld0cf7ec2017-07-13 11:29:20 +0200132 if (salt.testTarget(master, 'I@etcd:server')) {
vrovachev1c4770b2017-07-05 13:25:21 +0400133 salt.enforceState(master, 'I@etcd:server', 'etcd.server.service')
Tomáš Kukrál0cf3ffb2017-09-03 10:18:18 +0200134 salt.cmdRun(master, 'I@etcd:server', 'bash -c "source /var/lib/etcd/configenv && etcdctl cluster-health"')
vrovachev1c4770b2017-07-05 13:25:21 +0400135 }
136}
137
138def installOpenstackInfra(master) {
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200139 def orchestrate = new com.mirantis.mk.Orchestrate()
vrovachev1c4770b2017-07-05 13:25:21 +0400140
141 // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200142 orchestrate.installInfra(master)
Jakub Josef79ecec32017-02-17 14:36:28 +0100143}
144
145
Ales Komarekef2bab62017-04-26 11:48:28 +0200146def installOpenstackControl(master) {
Jakub Josef79ecec32017-02-17 14:36:28 +0100147 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +0200148
149 // Install horizon dashboard
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300150 if (salt.testTarget(master, 'I@horizon:server')) {
151 salt.enforceState(master, 'I@horizon:server', 'horizon', true)
152 }
153 if (salt.testTarget(master, 'I@nginx:server')) {
154 salt.enforceState(master, 'I@nginx:server', 'nginx', true)
155 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200156
Jakub Josef79ecec32017-02-17 14:36:28 +0100157 // setup keystone service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300158 if (salt.testTarget(master, 'I@keystone:server')) {
159 //runSaltProcessStep(master, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
160 salt.enforceState(master, 'I@keystone:server and *01*', 'keystone.server', true)
161 salt.enforceState(master, 'I@keystone:server', 'keystone.server', true)
162 // populate keystone services/tenants/roles/users
Tomáš Kukrál926e6332017-03-02 09:23:03 +0100163
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300164 // keystone:client must be called locally
165 //salt.runSaltProcessStep(master, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true)
166 salt.runSaltProcessStep(master, 'I@keystone:server', 'service.restart', ['apache2'])
167 sleep(30)
168 }
169 if (salt.testTarget(master, 'I@keystone:client')) {
Vasyl Saienkoff6f0f02017-07-19 15:54:16 +0300170 salt.enforceState(master, 'I@keystone:client and *01*', 'keystone.client', true)
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300171 salt.enforceState(master, 'I@keystone:client', 'keystone.client', true)
172 }
173 if (salt.testTarget(master, 'I@keystone:server')) {
174 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonercv3; openstack service list'], null, true)
175 }
Tomáš Kukrál926e6332017-03-02 09:23:03 +0100176
Oleg Grigorov26c8a6c2017-08-17 18:54:02 +0300177 // Install glance
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300178 if (salt.testTarget(master, 'I@glance:server')) {
179 //runSaltProcessStep(master, 'I@glance:server', 'state.sls', ['glance.server'], 1)
180 salt.enforceState(master, 'I@glance:server and *01*', 'glance.server', true)
181 salt.enforceState(master, 'I@glance:server', 'glance.server', true)
182 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200183
Oleg Grigorov26c8a6c2017-08-17 18:54:02 +0300184 // Check glance service
185 if (salt.testTarget(master, 'I@glance:server')){
186 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true)
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300187 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200188
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400189 // Create glance resources
190 if (salt.testTarget(master, 'I@glance:client')) {
191 salt.enforceState(master, 'I@glance:client', 'glance.client', true)
192 }
193
Jakub Josef79ecec32017-02-17 14:36:28 +0100194 // Install and check nova service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300195 if (salt.testTarget(master, 'I@nova:controller')) {
196 //runSaltProcessStep(master, 'I@nova:controller', 'state.sls', ['nova'], 1)
197 salt.enforceState(master, 'I@nova:controller and *01*', 'nova.controller', true)
198 salt.enforceState(master, 'I@nova:controller', 'nova.controller', true)
199 if (salt.testTarget(master, 'I@keystone:server')) {
200 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true)
201 }
202 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200203
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400204 // Create nova resources
205 if (salt.testTarget(master, 'I@nova:client')) {
206 salt.enforceState(master, 'I@nova:client', 'nova.client', true)
207 }
208
Jakub Josef79ecec32017-02-17 14:36:28 +0100209 // Install and check cinder service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300210 if (salt.testTarget(master, 'I@cinder:controller')) {
211 //runSaltProcessStep(master, 'I@cinder:controller', 'state.sls', ['cinder'], 1)
212 salt.enforceState(master, 'I@cinder:controller and *01*', 'cinder', true)
213 salt.enforceState(master, 'I@cinder:controller', 'cinder', true)
214 if (salt.testTarget(master, 'I@keystone:server')) {
215 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true)
216 }
217 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200218
Jakub Josef79ecec32017-02-17 14:36:28 +0100219 // Install neutron service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300220 if (salt.testTarget(master, 'I@neutron:server')) {
221 //runSaltProcessStep(master, 'I@neutron:server', 'state.sls', ['neutron'], 1)
Ales Komarekef2bab62017-04-26 11:48:28 +0200222
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300223 salt.enforceState(master, 'I@neutron:server and *01*', 'neutron.server', true)
224 salt.enforceState(master, 'I@neutron:server', 'neutron.server', true)
225 if (salt.testTarget(master, 'I@keystone:server')) {
226 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true)
227 }
228 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200229
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400230 // Create neutron resources
231 if (salt.testTarget(master, 'I@neutron:client')) {
232 salt.enforceState(master, 'I@neutron:client', 'neutron.client', true)
233 }
234
Jakub Josef79ecec32017-02-17 14:36:28 +0100235 // Install heat service
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300236 if (salt.testTarget(master, 'I@heat:server')) {
237 //runSaltProcessStep(master, 'I@heat:server', 'state.sls', ['heat'], 1)
238 salt.enforceState(master, 'I@heat:server and *01*', 'heat', true)
239 salt.enforceState(master, 'I@heat:server', 'heat', true)
240 if (salt.testTarget(master, 'I@keystone:server')) {
241 salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true)
242 }
243 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200244
245 // Restart nova api
Vasyl Saienko962e0b52017-07-11 10:49:19 +0300246 if (salt.testTarget(master, 'I@nova:controller')) {
247 salt.runSaltProcessStep(master, 'I@nova:controller', 'service.restart', ['nova-api'])
248 }
Vasyl Saienkoa7c10c02017-07-13 10:43:43 +0300249
250 // Install ironic service
251 if (salt.testTarget(master, 'I@ironic:api')) {
Andrey Shestakov82c0b892017-07-24 18:46:21 +0300252 salt.enforceState(master, 'I@ironic:api and *01*', 'ironic.api', true)
Vasyl Saienkoa7c10c02017-07-13 10:43:43 +0300253 salt.enforceState(master, 'I@ironic:api', 'ironic.api', true)
254 }
Andrey Shestakov82c0b892017-07-24 18:46:21 +0300255
256 // Install designate service
257 if (salt.testTarget(master, 'I@designate:server:enabled')) {
258 if (salt.testTarget(master, 'I@designate:server:backend:bind9')) {
259 salt.enforceState(master, 'I@bind:server', 'bind.server', true)
260 }
261 if (salt.testTarget(master, 'I@designate:server:backend:pdns4')) {
262 salt.enforceState(master, 'I@powerdns:server', 'powerdns.server', true)
263 }
264 salt.enforceState(master, 'I@designate:server and *01*', 'designate.server', true)
265 salt.enforceState(master, 'I@designate:server', 'designate.server', true)
266 }
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400267
268 // Install octavia api service
269 if (salt.testTarget(master, 'I@octavia:api')) {
270 salt.enforceState(master, 'I@octavia:api', 'octavia', true)
271 }
Marek Celoudc9dd50f2017-08-28 13:54:40 +0200272
273 // Install barbican server service
274 if (salt.testTarget(master, 'I@barbican:server')) {
275 salt.enforceState(master, 'I@barbican:server', 'barbican.server', true)
276 }
277 // Install barbican client
278 if (salt.testTarget(master, 'I@barbican:client')) {
279 salt.enforceState(master, 'I@barbican:client', 'barbican.client', true)
280 }
Jakub Josef79ecec32017-02-17 14:36:28 +0100281}
282
283
Vasyl Saienkoa7c10c02017-07-13 10:43:43 +0300284def installIronicConductor(master){
285 def salt = new com.mirantis.mk.Salt()
286
287 if (salt.testTarget(master, 'I@ironic:conductor')) {
288 salt.enforceState(master, 'I@ironic:conductor', 'ironic.conductor', true)
289 salt.enforceState(master, 'I@ironic:conductor', 'apache', true)
290 }
291 if (salt.testTarget(master, 'I@tftpd_hpa:server')) {
292 salt.enforceState(master, 'I@tftpd_hpa:server', 'tftpd_hpa', true)
293 }
294
295 if (salt.testTarget(master, 'I@nova:compute')) {
296 salt.runSaltProcessStep(master, 'I@nova:compute', 'service.restart', ['nova-compute'])
297 }
298
299 if (salt.testTarget(master, 'I@baremetal_simulator:enabled')) {
300 salt.enforceState(master, 'I@baremetal_simulator:enabled', 'baremetal_simulator', true)
301 }
302 if (salt.testTarget(master, 'I@ironic:client')) {
303 salt.enforceState(master, 'I@ironic:client', 'ironic.client', true)
304 }
305}
306
307
308
Ales Komarekef2bab62017-04-26 11:48:28 +0200309def installOpenstackNetwork(master, physical = "false") {
Jakub Josef79ecec32017-02-17 14:36:28 +0100310 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +0200311
312 salt.runSaltProcessStep(master, 'I@neutron:gateway', 'state.apply', [], null, true)
Elena Ezhova8d53bff2017-08-01 17:43:30 +0400313
314 // install octavia manager services
315 if (salt.testTarget(master, 'I@octavia:manager')) {
316 salt.runSaltProcessStep(master, 'I@salt:master', 'mine.update', ['*'], null, true)
317 salt.enforceState(master, 'I@octavia:manager', 'salt.minion.ca', true)
318 salt.enforceState(master, 'I@octavia:manager', 'salt.minion.cert', true)
319 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200320}
321
322
323def installOpenstackCompute(master) {
324 def salt = new com.mirantis.mk.Salt()
325
326 // Configure compute nodes
327 retry(2) {
Marek Celoude305ec72017-05-16 11:27:53 +0200328 salt.runSaltProcessStep(master, 'I@nova:compute', 'state.highstate', ['exclude=opencontrail.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200329 }
330}
331
332
333def installContrailNetwork(master) {
Martin Polreichfc9854c2017-06-30 11:17:36 +0200334 def common = new com.mirantis.mk.Common()
Ales Komarekef2bab62017-04-26 11:48:28 +0200335 def salt = new com.mirantis.mk.Salt()
336
337
Jakub Josef79ecec32017-02-17 14:36:28 +0100338 // Install opencontrail database services
339 //runSaltProcessStep(master, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1)
Ales Komarekef2bab62017-04-26 11:48:28 +0200340 try {
341 salt.enforceState(master, 'I@opencontrail:database and *01*', 'opencontrail.database', true)
342 } catch (Exception e) {
343 common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database and *01*')
344 }
345
346 try {
347 salt.enforceState(master, 'I@opencontrail:database', 'opencontrail.database', true)
348 } catch (Exception e) {
349 common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database')
350 }
351
Jakub Josef79ecec32017-02-17 14:36:28 +0100352 // Install opencontrail control services
353 //runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1)
Ales Komarekef2bab62017-04-26 11:48:28 +0200354 salt.runSaltProcessStep(master, 'I@opencontrail:control and *01*', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
355 salt.runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
356 salt.runSaltProcessStep(master, 'I@opencontrail:collector', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
Tomáš Kukrálb8e97112017-03-01 16:03:16 +0100357
Jakub Josef79ecec32017-02-17 14:36:28 +0100358 // Test opencontrail
Ales Komarekef2bab62017-04-26 11:48:28 +0200359 salt.runSaltProcessStep(master, 'I@opencontrail:control', 'cmd.run', ['contrail-status'], null, true)
Jakub Josef79ecec32017-02-17 14:36:28 +0100360}
361
362
Ales Komarekef2bab62017-04-26 11:48:28 +0200363def installContrailCompute(master) {
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200364 def salt = new com.mirantis.mk.Salt()
vrovachev32f7f542017-08-25 16:17:25 +0400365 def common = new com.mirantis.mk.Common()
Jakub Josef79ecec32017-02-17 14:36:28 +0100366 // Configure compute nodes
Ales Komarekef2bab62017-04-26 11:48:28 +0200367 // Provision opencontrail control services
368 salt.enforceState(master, 'I@opencontrail:database:id:1', 'opencontrail.client', true)
Jakub Josef79ecec32017-02-17 14:36:28 +0100369 // Provision opencontrail virtual routers
Tomáš Kukrálb8e97112017-03-01 16:03:16 +0100370
vrovachev4ff77302017-08-09 20:39:57 +0400371 // Generate script /usr/lib/contrail/if-vhost0 for up vhost0
372 try {
373 salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail', true)
374 } catch (Exception e) {
375 common.warningMsg('Exception in state opencontrail on I@opencontrail:compute')
376 }
377
Ales Komarekef2bab62017-04-26 11:48:28 +0200378 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 +0400379
380 if (salt.testTarget(master, 'I@opencontrail:compute')) {
381 sleep(300)
382 salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail.client', true)
383 salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail', true)
384 }
Jakub Josef79ecec32017-02-17 14:36:28 +0100385}
386
387
Ales Komarekef2bab62017-04-26 11:48:28 +0200388def installKubernetesInfra(master) {
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200389 def orchestrate = new com.mirantis.mk.Orchestrate()
vrovachev1c4770b2017-07-05 13:25:21 +0400390 // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly
Tomáš Kukrál104a07a2017-07-13 12:19:11 +0200391 orchestrate.installInfra(master)
Jakub Josef79ecec32017-02-17 14:36:28 +0100392}
393
394
Tomáš Kukrálc1a1bbc2017-04-28 21:16:25 +0200395def installKubernetesControl(master) {
Jakub Josef79ecec32017-02-17 14:36:28 +0100396 def salt = new com.mirantis.mk.Salt()
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200397
Jakub Josef79ecec32017-02-17 14:36:28 +0100398 // Install Kubernetes pool and Calico
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200399 salt.enforceState(master, 'I@kubernetes:master', 'kubernetes.master.kube-addons')
400 salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool')
Jakub Josef79ecec32017-02-17 14:36:28 +0100401
402 // Setup etcd server
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200403 salt.enforceState(master, 'I@kubernetes:master and *01*', 'etcd.server.setup')
Jakub Josef79ecec32017-02-17 14:36:28 +0100404
405 // Run k8s without master.setup
406 salt.runSaltProcessStep(master, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup'])
407
408 // Run k8s master setup
Tomáš Kukrálb05cf002017-05-02 11:05:43 +0200409 salt.enforceState(master, 'I@kubernetes:master and *01*', 'kubernetes.master.setup')
Jakub Josef79ecec32017-02-17 14:36:28 +0100410
411 // Restart kubelet
412 salt.runSaltProcessStep(master, 'I@kubernetes:pool', 'service.restart', ['kubelet'])
413}
414
415
Ales Komarekef2bab62017-04-26 11:48:28 +0200416def installKubernetesCompute(master) {
Tomáš Kukrála53b5352017-05-04 11:45:53 +0200417 def salt = new com.mirantis.mk.Salt()
Tomáš Kukrále7e28962017-06-06 11:11:16 +0200418
419 // Refresh minion's pillar data
420 salt.runSaltProcessStep(master, '*', 'saltutil.refresh_pillar', [], null, true)
421 salt.runSaltProcessStep(master, '*', 'saltutil.sync_all', [], null, true)
422
423 // Bootstrap all nodes
424 salt.enforceState(master, 'I@kubernetes:pool', 'linux')
425 salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion')
426 salt.enforceState(master, 'I@kubernetes:pool', ['openssh', 'ntp'])
427
428 // Create and distribute SSL certificates for services using salt state
429 salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion.cert')
430
431 // Install docker
432 salt.enforceState(master, 'I@docker:host', 'docker.host')
433
434 // Install Kubernetes and Calico
435 salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool')
436
Tomáš Kukrál30ba1042017-09-07 13:15:26 +0200437 // temporarily disable helm installation
438 // if (salt.testTarget(master, 'I@helm:client')) {
439 // salt.enforceState(master, 'I@helm:client', 'helm')
440 // }
Tomáš Kukrále7e28962017-06-06 11:11:16 +0200441}
442
443
Martin Polreich8663a342017-06-30 17:33:08 +0200444def installDockerSwarm(master) {
445 def salt = new com.mirantis.mk.Salt()
Jakub Josef79ecec32017-02-17 14:36:28 +0100446
vrovachev1c4770b2017-07-05 13:25:21 +0400447 //Install and Configure Docker
Martin Polreich8663a342017-06-30 17:33:08 +0200448 salt.enforceState(master, 'I@docker:swarm', 'docker.host')
449 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true)
450 salt.enforceState(master, 'I@docker:swarm', 'salt.minion.grains', true)
451 salt.runSaltProcessStep(master, 'I@docker:swarm', 'mine.update', [], null, true)
452 salt.runSaltProcessStep(master, 'I@docker:swarm', 'saltutil.refresh_modules', [], null, true)
453 sleep(5)
Martin Polreich377c37a2017-08-08 15:42:51 +0200454 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200455 salt.enforceState(master, 'I@docker:swarm:role:manager', 'docker.swarm', true)
456 salt.cmdRun(master, 'I@docker:swarm:role:master', 'docker node ls', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200457}
458
Jiri Broulikb9a0c592017-09-05 16:41:48 +0200459
460def installCicd(master) {
461 def salt = new com.mirantis.mk.Salt()
462
463 //Install and Configure Docker
464 salt.enforceState(master, 'I@aptly:publisher', 'aptly.publisher')
465 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.client', true)
466 sleep(300)
467 salt.enforceState(master, 'I@aptly:server', 'aptly', true)
468 salt.enforceState(master, 'I@openldap:client', 'openldap', true)
469 salt.enforceState(master, 'I@gerrit:client', 'gerrit', true)
470 salt.enforceState(master, 'I@jenkins:client', 'jenkins', true)
471}
472
473
Martin Polreich8663a342017-06-30 17:33:08 +0200474def installStacklight(master) {
475 def common = new com.mirantis.mk.Common()
476 def salt = new com.mirantis.mk.Salt()
477
Simon Pasquieref4122c2017-08-25 15:52:07 +0200478 // Install core services for K8S environments:
479 // HAProxy, Nginx and lusterFS clients
480 // In case of OpenStack, those are already installed
Martin Polreich792f2662017-07-11 13:36:32 +0200481 if (common.checkContains('STACK_INSTALL', 'k8s')) {
482 salt.enforceState(master, 'I@haproxy:proxy', 'haproxy')
483 salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy'])
Simon Pasquieref4122c2017-08-25 15:52:07 +0200484
485 if (salt.testTarget(master, 'I@nginx:server')) {
486 salt.enforceState(master, 'I@nginx:server', 'nginx', true)
487 }
488
489 if (salt.testTarget(master, 'I@glusterfs:client')) {
490 salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client', true)
491 }
Martin Polreich792f2662017-07-11 13:36:32 +0200492 }
Martin Polreich8663a342017-06-30 17:33:08 +0200493 //Install Telegraf
Martin Polreichd894e3e2017-07-04 15:35:02 +0200494 salt.enforceState(master, 'I@telegraf:agent or I@telegraf:remote_agent', 'telegraf', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200495
Dmitry Kalashnikebc1e1e2017-07-13 14:20:08 +0400496 // Install Prometheus exporters
497 if (salt.testTarget(master, 'I@prometheus:exporters')) {
498 salt.enforceState(master, 'I@prometheus:exporters', 'prometheus', true)
499 }
500
Martin Polreich8663a342017-06-30 17:33:08 +0200501 //Install Elasticsearch and Kibana
Martin Polreichbf7f6162017-07-06 14:43:21 +0200502 salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true)
Martin Polreicha540ac12017-06-30 22:48:39 +0200503 salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true)
Martin Polreichbf7f6162017-07-06 14:43:21 +0200504 salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200505 salt.enforceState(master, 'I@kibana:server', 'kibana.server', true)
Martin Polreicha540ac12017-06-30 22:48:39 +0200506 salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200507 salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
Martin Polreichbf7f6162017-07-06 14:43:21 +0200508 salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200509 salt.enforceState(master, 'I@influxdb:server', 'influxdb', true)
510
Simon Pasquier6301ddd2017-09-05 11:56:58 +0200511 salt.enforceState(master, 'I@heka:log_collector', 'heka.log_collector')
512
Martin Polreich470925a2017-07-06 17:12:59 +0200513 // Install galera
Martin Polreich792f2662017-07-11 13:36:32 +0200514 if (common.checkContains('STACK_INSTALL', 'k8s')) {
515 withEnv(['ASK_ON_ERROR=false']){
516 retry(2) {
517 salt.enforceState(master, 'I@galera:master', 'galera', true)
518 }
Martin Polreich470925a2017-07-06 17:12:59 +0200519 }
Martin Polreich792f2662017-07-11 13:36:32 +0200520 salt.enforceState(master, 'I@galera:slave', 'galera', true)
Martin Polreich406f6462017-07-11 11:33:42 +0000521
Martin Polreich792f2662017-07-11 13:36:32 +0200522 // Check galera status
523 salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status')
524 salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status')
525 }
Martin Polreich470925a2017-07-06 17:12:59 +0200526
Martin Polreich8663a342017-06-30 17:33:08 +0200527 //Collect Grains
528 salt.enforceState(master, 'I@salt:minion', 'salt.minion.grains', true)
529 salt.runSaltProcessStep(master, 'I@salt:minion', 'saltutil.refresh_modules', [], null, true)
530 salt.runSaltProcessStep(master, 'I@salt:minion', 'mine.update', [], null, true)
531 sleep(5)
532
533 //Configure services in Docker Swarm
Martin Polreich8017f452017-08-21 16:01:42 +0200534 if (common.checkContains('STACK_INSTALL', 'k8s')) {
535 salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'prometheus', true, false)
536 }
537 else {
538 salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', ['prometheus', 'heka.remote_collector'], true, false)
539 }
Martin Polreich8663a342017-06-30 17:33:08 +0200540 salt.enforceState(master, 'I@docker:swarm:role:master', 'docker', true)
Martin Polreich595baef2017-07-04 16:11:04 +0200541 salt.runSaltProcessStep(master, 'I@docker:swarm', 'dockerng.ps', [], null, true)
Martin Polreich8663a342017-06-30 17:33:08 +0200542
543 //Configure Grafana
Martin Polreich305e2222017-07-06 11:33:00 +0200544 def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address')
Martin Polreich8663a342017-06-30 17:33:08 +0200545 common.prettyPrint(pillar)
Martin Polreich595baef2017-07-04 16:11:04 +0200546
Martin Polreich8663a342017-06-30 17:33:08 +0200547 def stacklight_vip
548 if(!pillar['return'].isEmpty()) {
549 stacklight_vip = pillar['return'][0].values()[0]
550 } else {
551 common.errorMsg('[ERROR] Stacklight VIP address could not be retrieved')
552 }
vrovachev1c4770b2017-07-05 13:25:21 +0400553
Martin Polreich305e2222017-07-06 11:33:00 +0200554 common.infoMsg("Waiting for service on http://${stacklight_vip}:15013/ to start")
Martin Polreichbd7ad222017-07-06 12:53:51 +0200555 sleep(120)
Martin Polreich8663a342017-06-30 17:33:08 +0200556 salt.enforceState(master, 'I@grafana:client', 'grafana.client', true)
Martin Polreich8663a342017-06-30 17:33:08 +0200557}
558
559def installStacklightv1Control(master) {
Tomáš Kukrála53b5352017-05-04 11:45:53 +0200560 def salt = new com.mirantis.mk.Salt()
Ales Komarekef2bab62017-04-26 11:48:28 +0200561
562 // infra install
563 // Install the StackLight backends
564 salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true)
565 salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true)
566
567 salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true)
568 salt.enforceState(master, 'I@influxdb:server', 'influxdb', true)
569
570 salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true)
571 salt.enforceState(master, 'I@kibana:server', 'kibana.server', true)
572
573 salt.enforceState(master, '*01* and I@grafana:server','grafana.server', true)
574 salt.enforceState(master, 'I@grafana:server','grafana.server', true)
575
Kalynovskyi3e370112017-06-26 12:48:23 +0300576 def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service')
577 def alarming_service = alarming_service_pillar['return'][0].values()[0]
578
579 switch (alarming_service) {
580 case 'sensu':
581 // Update Sensu
582 salt.enforceState(master, 'I@sensu:server and I@rabbitmq:server', 'rabbitmq', true)
583 salt.enforceState(master, 'I@redis:cluster:role:master', 'redis', true)
584 salt.enforceState(master, 'I@redis:server', 'redis', true)
585 salt.enforceState(master, 'I@sensu:server', 'sensu', true)
586 default:
587 // Update Nagios
588 salt.enforceState(master, 'I@nagios:server', 'nagios.server', true)
589 // Stop the Nagios service because the package starts it by default and it will
590 // started later only on the node holding the VIP address
591 salt.runSaltProcessStep(master, 'I@nagios:server', 'service.stop', ['nagios3'], null, true)
592 }
593
Ales Komarekef2bab62017-04-26 11:48:28 +0200594 salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client.service', true)
Marek Celoudebc623b2017-06-02 17:12:31 +0200595 salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200596
597 sleep(10)
598}
599
Martin Polreich8663a342017-06-30 17:33:08 +0200600def installStacklightv1Client(master) {
Tomáš Kukrála53b5352017-05-04 11:45:53 +0200601 def salt = new com.mirantis.mk.Salt()
602 def common = new com.mirantis.mk.Common()
Ales Komarekef2bab62017-04-26 11:48:28 +0200603
Alexander Noskov3c6a60a2017-06-21 14:05:07 +0200604 salt.runSaltProcessStep(master, 'I@elasticsearch:client', 'cmd.run', ['salt-call state.sls elasticsearch.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200605 // salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true)
Alexander Noskov3c6a60a2017-06-21 14:05:07 +0200606 salt.runSaltProcessStep(master, 'I@kibana:client', 'cmd.run', ['salt-call state.sls kibana.client'], null, true)
Ales Komarekef2bab62017-04-26 11:48:28 +0200607 // salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
608
609 // Install collectd, heka and sensu services on the nodes, this will also
610 // generate the metadata that goes into the grains and eventually into Salt Mine
611 salt.enforceState(master, '*', 'collectd', true)
612 salt.enforceState(master, '*', 'salt.minion', true)
613 salt.enforceState(master, '*', 'heka', true)
614
615 // Gather the Grafana metadata as grains
616 salt.enforceState(master, 'I@grafana:collector', 'grafana.collector', true)
617
618 // Update Salt Mine
619 salt.enforceState(master, '*', 'salt.minion.grains', true)
620 salt.runSaltProcessStep(master, '*', 'saltutil.refresh_modules', [], null, true)
621 salt.runSaltProcessStep(master, '*', 'mine.update', [], null, true)
622
623 sleep(5)
624
625 // Update Heka
626 salt.enforceState(master, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka', true)
627
628 // Update collectd
629 salt.enforceState(master, 'I@collectd:remote_client:enabled:True', 'collectd', true)
630
Kalynovskyi3e370112017-06-26 12:48:23 +0300631 def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service')
632 def alarming_service = alarming_service_pillar['return'][0].values()[0]
Ales Komarekef2bab62017-04-26 11:48:28 +0200633
Kalynovskyi3e370112017-06-26 12:48:23 +0300634 switch (alarming_service) {
635 case 'sensu':
636 // Update Sensu
637 // TODO for stacklight team, should be fixed in model
638 salt.enforceState(master, 'I@sensu:client', 'sensu', true)
639 default:
640 break
641 // Default is nagios, and was enforced in installStacklightControl()
642 }
Ales Komarekef2bab62017-04-26 11:48:28 +0200643
Alexander Noskov3c6a60a2017-06-21 14:05:07 +0200644 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 +0200645 // salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true)
646
Marek Celoudd200cad2017-06-07 10:34:46 +0200647 // Finalize the configuration of Grafana (add the dashboards...)
Alexander Noskov8448fc52017-06-21 14:03:45 +0200648 salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true)
649 salt.enforceState(master, 'I@grafana:client and *02*', 'grafana.client', true)
650 salt.enforceState(master, 'I@grafana:client and *03*', 'grafana.client', true)
Marek Celoudd200cad2017-06-07 10:34:46 +0200651 // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10
652
Ales Komarekef2bab62017-04-26 11:48:28 +0200653 // Get the StackLight monitoring VIP addres
654 //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}')
655 //vip=${vip:=172.16.10.253}
656 def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address')
Jakub Josefbceaa322017-06-13 18:28:27 +0200657 common.prettyPrint(pillar)
Ales Komarekef2bab62017-04-26 11:48:28 +0200658 def stacklight_vip = pillar['return'][0].values()[0]
659
660 if (stacklight_vip) {
661 // (re)Start manually the services that are bound to the monitoring VIP
662 common.infoMsg("restart services on node with IP: ${stacklight_vip}")
663 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], null, true)
664 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], null, true)
665 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], null, true)
666 salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], null, true)
667 } else {
668 throw new Exception("Missing stacklight_vip")
669 }
Tomáš Kukrálf06ca0f2017-02-27 15:18:50 +0100670}
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200671
672
673//
674// Ceph
675//
676
Tomáš Kukráled27a472017-08-29 10:26:25 +0200677def installCephMon(master, target='I@ceph:mon') {
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200678 def salt = new com.mirantis.mk.Salt()
679
Ondrej Smolafd5c2352017-08-11 14:25:39 +0200680 // install Ceph Mons
Tomáš Kukrál9b4fb512017-08-14 11:01:49 +0200681 salt.enforceState(master, target, 'ceph.mon', true)
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200682}
683
Tomáš Kukráled27a472017-08-29 10:26:25 +0200684def installCephOsd(master, target='I@ceph:osd', setup=true) {
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200685 def salt = new com.mirantis.mk.Salt()
686
Tomáš Kukrál3343a1f2017-08-16 12:03:36 +0200687 // Prapare filesystem on OSD drives
688 salt.enforceState(master, target, 'linux.storage', true)
689
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200690 // install Ceph OSDs
691 salt.enforceState(master, target, 'ceph.osd', true)
Tomáš Kukráled27a472017-08-29 10:26:25 +0200692
693 // setup poools, keyrings and maybe crush
694 if (salt.testTarget(master, 'I@ceph:setup') && setup) {
Tomáš Kukrál4edbfa32017-08-29 14:26:06 +0200695 sleep(30)
Tomáš Kukráled27a472017-08-29 10:26:25 +0200696 salt.enforceState(master, 'I@ceph:setup', 'ceph.setup', true)
697 }
Tomáš Kukrál64f8e1c2017-08-11 10:32:20 +0200698}
Tomáš Kukrál1e5b2192017-08-15 16:58:18 +0200699
Tomáš Kukrál5836e3d2017-08-25 18:20:55 +0200700def installCephClient(master) {
Tomáš Kukrál1e5b2192017-08-15 16:58:18 +0200701 def salt = new com.mirantis.mk.Salt()
702
703 // install Ceph Radosgw
Tomáš Kukrál5836e3d2017-08-25 18:20:55 +0200704 if (salt.testTarget(master, 'I@ceph:radosgw')) {
Tomáš Kukrál1fe90452017-08-28 18:27:26 +0200705 salt.enforceState(master, 'I@ceph:radosgw', 'ceph.radosgw', true)
Tomáš Kukrál5836e3d2017-08-25 18:20:55 +0200706 }
Tomáš Kukrál1e5b2192017-08-15 16:58:18 +0200707}