Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 1 | package com.mirantis.mk |
| 2 | /** |
| 3 | * Orchestration functions |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | def validateFoundationInfra(master) { |
| 8 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 9 | |
| 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 Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 15 | } |
| 16 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 17 | def installFoundationInfra(master) { |
| 18 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 19 | |
Petr Michalec | de0ff32 | 2017-10-04 09:32:14 +0200 | [diff] [blame] | 20 | salt.enforceState(master, 'I@salt:master', ['salt.master', 'reclass'], true, false, null, false, 120, 2) |
Tomáš Kukrál | b4d7522 | 2017-06-06 10:36:02 +0200 | [diff] [blame] | 21 | |
| 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 Saienko | e36ab7c | 2017-07-17 14:35:48 +0300 | [diff] [blame] | 26 | salt.enforceState(master, 'I@salt:master', ['salt.minion'], true, false, null, false, 60, 2) |
Tomáš Kukrál | b4d7522 | 2017-06-06 10:36:02 +0200 | [diff] [blame] | 27 | salt.enforceState(master, 'I@salt:master', ['salt.minion'], true) |
| 28 | |
Jakub Josef | 200550f | 2017-05-16 17:39:55 +0200 | [diff] [blame] | 29 | salt.enforceState(master, '*', ['linux.system'], true) |
Vasyl Saienko | e36ab7c | 2017-07-17 14:35:48 +0300 | [diff] [blame] | 30 | salt.enforceState(master, 'I@linux:system', ['linux', 'openssh', 'ntp'], true) |
Tomáš Kukrál | 7e767f9 | 2017-08-18 14:53:17 +0200 | [diff] [blame] | 31 | salt.enforceState(master, '*', ['salt.minion'], true, false, null, false, 60, 2) |
Jakub Josef | 4f8f4df | 2017-09-01 14:32:42 +0200 | [diff] [blame] | 32 | sleep(5) |
| 33 | salt.enforceState(master, '*', ['linux.network.host'], true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 34 | } |
| 35 | |
Jiri Broulik | 976bf6c | 2017-10-20 14:43:25 +0200 | [diff] [blame] | 36 | def installFoundationInfraOnTarget(master, target) { |
| 37 | def salt = new com.mirantis.mk.Salt() |
| 38 | |
| 39 | salt.enforceState(master, 'I@salt:master', ['reclass'], true, false, null, false, 120, 2) |
| 40 | |
| 41 | salt.runSaltProcessStep(master, target, 'saltutil.refresh_pillar', [], null, true) |
| 42 | salt.runSaltProcessStep(master, target, 'saltutil.sync_all', [], null, true) |
| 43 | |
| 44 | salt.enforceState(master, target, ['linux.system'], true) |
| 45 | salt.enforceState(master, target, ['salt.minion'], true, false, null, false, 60, 2) |
| 46 | salt.enforceState(master, target, ['salt.minion'], true) |
| 47 | |
| 48 | salt.enforceState(master, target, ['linux', 'openssh', 'ntp'], true) |
| 49 | sleep(5) |
| 50 | salt.enforceState(master, target, ['linux.network.host'], true) |
| 51 | } |
| 52 | |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 53 | def installInfraKvm(master) { |
| 54 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 55 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 56 | salt.runSaltProcessStep(master, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true) |
| 57 | salt.runSaltProcessStep(master, 'I@linux:system', 'saltutil.sync_all', [], null, true) |
| 58 | |
Richard Felkl | 286f25f | 2017-07-26 14:23:55 +0200 | [diff] [blame] | 59 | salt.enforceState(master, 'I@salt:control', ['salt.minion'], true, false, null, false, 60, 2) |
Vasyl Saienko | e36ab7c | 2017-07-17 14:35:48 +0300 | [diff] [blame] | 60 | salt.enforceState(master, 'I@salt:control', ['linux.system', 'linux.network', 'ntp'], true) |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 61 | salt.enforceState(master, 'I@salt:control', 'libvirt', true) |
| 62 | salt.enforceState(master, 'I@salt:control', 'salt.control', true) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 63 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 64 | sleep(600) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 65 | |
Marek Celoud | c9b3cc8 | 2017-05-22 12:50:53 +0000 | [diff] [blame] | 66 | salt.runSaltProcessStep(master, '* and not kvm*', 'saltutil.refresh_pillar', [], null, true) |
| 67 | salt.runSaltProcessStep(master, '* and not kvm*', 'saltutil.sync_all', [], null, true) |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 68 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 69 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 70 | def installInfra(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 71 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 72 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 73 | // Install glusterfs |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 74 | if (salt.testTarget(master, 'I@glusterfs:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 75 | salt.enforceState(master, 'I@glusterfs:server', 'glusterfs.server.service', true) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 76 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 77 | withEnv(['ASK_ON_ERROR=false']){ |
| 78 | retry(5) { |
| 79 | salt.enforceState(master, 'I@glusterfs:server and *01*', 'glusterfs.server.setup', true) |
| 80 | } |
Alexander Noskov | 93acac4 | 2017-06-20 17:55:55 +0200 | [diff] [blame] | 81 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 82 | |
| 83 | salt.runSaltProcessStep(master, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'], null, true) |
| 84 | salt.runSaltProcessStep(master, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'], null, true) |
Alexander Noskov | 93acac4 | 2017-06-20 17:55:55 +0200 | [diff] [blame] | 85 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 86 | |
Oleg Grigorov | 26c8a6c | 2017-08-17 18:54:02 +0300 | [diff] [blame] | 87 | // Ensure glusterfs clusters is ready |
| 88 | if (salt.testTarget(master, 'I@glusterfs:client')) { |
| 89 | salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client', true) |
| 90 | } |
| 91 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 92 | // Install galera |
Richard Felkl | c0f163e | 2017-07-27 15:11:12 +0200 | [diff] [blame] | 93 | if (salt.testTarget(master, 'I@galera:master') || salt.testTarget(master, 'I@galera:slave')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 94 | withEnv(['ASK_ON_ERROR=false']){ |
| 95 | retry(2) { |
| 96 | salt.enforceState(master, 'I@galera:master', 'galera', true) |
| 97 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 98 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 99 | salt.enforceState(master, 'I@galera:slave', 'galera', true) |
| 100 | |
| 101 | // Check galera status |
| 102 | salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status') |
| 103 | salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status') |
Vasyl Saienko | c1fb989 | 2017-07-13 14:54:13 +0300 | [diff] [blame] | 104 | // If galera is not enabled check if we need to install mysql:server |
| 105 | } else if (salt.testTarget(master, 'I@mysql:server')){ |
| 106 | salt.enforceState(master, 'I@mysql:server', 'mysql.server', true) |
| 107 | if (salt.testTarget(master, 'I@mysql:client')){ |
| 108 | salt.enforceState(master, 'I@mysql:client', 'mysql.client', true) |
| 109 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 110 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 111 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 112 | // Install docker |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 113 | if (salt.testTarget(master, 'I@docker:host')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 114 | salt.enforceState(master, 'I@docker:host', 'docker.host') |
Tomáš Kukrál | 0cf3ffb | 2017-09-03 10:18:18 +0200 | [diff] [blame] | 115 | salt.cmdRun(master, 'I@docker:host', 'docker ps') |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 116 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 117 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 118 | // Install keepalived |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 119 | if (salt.testTarget(master, 'I@keepalived:cluster')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 120 | salt.enforceState(master, 'I@keepalived:cluster and *01*', 'keepalived', true) |
| 121 | salt.enforceState(master, 'I@keepalived:cluster', 'keepalived', true) |
| 122 | } |
| 123 | |
| 124 | // Install rabbitmq |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 125 | if (salt.testTarget(master, 'I@rabbitmq:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 126 | withEnv(['ASK_ON_ERROR=false']){ |
| 127 | retry(2) { |
| 128 | salt.enforceState(master, 'I@rabbitmq:server', 'rabbitmq', true) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | // Check the rabbitmq status |
| 133 | salt.runSaltProcessStep(master, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status']) |
| 134 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 135 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 136 | // Install haproxy |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 137 | if (salt.testTarget(master, 'I@haproxy:proxy')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 138 | salt.enforceState(master, 'I@haproxy:proxy', 'haproxy', true) |
| 139 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
| 140 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.restart', ['rsyslog']) |
| 141 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 142 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 143 | // Install memcached |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 144 | if (salt.testTarget(master, 'I@memcached:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 145 | salt.enforceState(master, 'I@memcached:server', 'memcached', true) |
| 146 | } |
| 147 | |
| 148 | // Install etcd |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 149 | if (salt.testTarget(master, 'I@etcd:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 150 | salt.enforceState(master, 'I@etcd:server', 'etcd.server.service') |
vrovachev | 076e5c9 | 2017-11-13 18:56:17 +0400 | [diff] [blame] | 151 | salt.cmdRun(master, 'I@etcd:server', '. /var/lib/etcd/configenv && etcdctl cluster-health') |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 152 | } |
| 153 | } |
| 154 | |
| 155 | def installOpenstackInfra(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame] | 156 | def orchestrate = new com.mirantis.mk.Orchestrate() |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 157 | |
| 158 | // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame] | 159 | orchestrate.installInfra(master) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 163 | def installOpenstackControl(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 164 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 165 | |
| 166 | // Install horizon dashboard |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 167 | if (salt.testTarget(master, 'I@horizon:server')) { |
| 168 | salt.enforceState(master, 'I@horizon:server', 'horizon', true) |
| 169 | } |
| 170 | if (salt.testTarget(master, 'I@nginx:server')) { |
Richard Felkl | 34e1b99 | 2017-11-02 23:15:06 +0100 | [diff] [blame] | 171 | salt.enforceState(master, 'I@nginx:server', 'salt.minion', true) |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 172 | salt.enforceState(master, 'I@nginx:server', 'nginx', true) |
| 173 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 174 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 175 | // setup keystone service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 176 | if (salt.testTarget(master, 'I@keystone:server')) { |
| 177 | //runSaltProcessStep(master, 'I@keystone:server', 'state.sls', ['keystone.server'], 1) |
| 178 | salt.enforceState(master, 'I@keystone:server and *01*', 'keystone.server', true) |
| 179 | salt.enforceState(master, 'I@keystone:server', 'keystone.server', true) |
| 180 | // populate keystone services/tenants/roles/users |
Tomáš Kukrál | 926e633 | 2017-03-02 09:23:03 +0100 | [diff] [blame] | 181 | |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 182 | // keystone:client must be called locally |
| 183 | //salt.runSaltProcessStep(master, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true) |
| 184 | salt.runSaltProcessStep(master, 'I@keystone:server', 'service.restart', ['apache2']) |
| 185 | sleep(30) |
| 186 | } |
| 187 | if (salt.testTarget(master, 'I@keystone:client')) { |
Vasyl Saienko | ff6f0f0 | 2017-07-19 15:54:16 +0300 | [diff] [blame] | 188 | salt.enforceState(master, 'I@keystone:client and *01*', 'keystone.client', true) |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 189 | salt.enforceState(master, 'I@keystone:client', 'keystone.client', true) |
| 190 | } |
| 191 | if (salt.testTarget(master, 'I@keystone:server')) { |
| 192 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonercv3; openstack service list'], null, true) |
| 193 | } |
Tomáš Kukrál | 926e633 | 2017-03-02 09:23:03 +0100 | [diff] [blame] | 194 | |
Oleg Grigorov | 26c8a6c | 2017-08-17 18:54:02 +0300 | [diff] [blame] | 195 | // Install glance |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 196 | if (salt.testTarget(master, 'I@glance:server')) { |
| 197 | //runSaltProcessStep(master, 'I@glance:server', 'state.sls', ['glance.server'], 1) |
| 198 | salt.enforceState(master, 'I@glance:server and *01*', 'glance.server', true) |
| 199 | salt.enforceState(master, 'I@glance:server', 'glance.server', true) |
| 200 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 201 | |
Oleg Grigorov | 26c8a6c | 2017-08-17 18:54:02 +0300 | [diff] [blame] | 202 | // Check glance service |
| 203 | if (salt.testTarget(master, 'I@glance:server')){ |
| 204 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true) |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 205 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 206 | |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 207 | // Create glance resources |
| 208 | if (salt.testTarget(master, 'I@glance:client')) { |
| 209 | salt.enforceState(master, 'I@glance:client', 'glance.client', true) |
| 210 | } |
| 211 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 212 | // Install and check nova service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 213 | if (salt.testTarget(master, 'I@nova:controller')) { |
| 214 | //runSaltProcessStep(master, 'I@nova:controller', 'state.sls', ['nova'], 1) |
| 215 | salt.enforceState(master, 'I@nova:controller and *01*', 'nova.controller', true) |
| 216 | salt.enforceState(master, 'I@nova:controller', 'nova.controller', true) |
| 217 | if (salt.testTarget(master, 'I@keystone:server')) { |
| 218 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true) |
| 219 | } |
| 220 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 221 | |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 222 | // Create nova resources |
| 223 | if (salt.testTarget(master, 'I@nova:client')) { |
| 224 | salt.enforceState(master, 'I@nova:client', 'nova.client', true) |
| 225 | } |
| 226 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 227 | // Install and check cinder service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 228 | if (salt.testTarget(master, 'I@cinder:controller')) { |
| 229 | //runSaltProcessStep(master, 'I@cinder:controller', 'state.sls', ['cinder'], 1) |
| 230 | salt.enforceState(master, 'I@cinder:controller and *01*', 'cinder', true) |
| 231 | salt.enforceState(master, 'I@cinder:controller', 'cinder', true) |
| 232 | if (salt.testTarget(master, 'I@keystone:server')) { |
| 233 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true) |
| 234 | } |
| 235 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 236 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 237 | // Install neutron service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 238 | if (salt.testTarget(master, 'I@neutron:server')) { |
| 239 | //runSaltProcessStep(master, 'I@neutron:server', 'state.sls', ['neutron'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 240 | |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 241 | salt.enforceState(master, 'I@neutron:server and *01*', 'neutron.server', true) |
| 242 | salt.enforceState(master, 'I@neutron:server', 'neutron.server', true) |
| 243 | if (salt.testTarget(master, 'I@keystone:server')) { |
| 244 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true) |
| 245 | } |
| 246 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 247 | |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 248 | // Create neutron resources |
| 249 | if (salt.testTarget(master, 'I@neutron:client')) { |
| 250 | salt.enforceState(master, 'I@neutron:client', 'neutron.client', true) |
| 251 | } |
| 252 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 253 | // Install heat service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 254 | if (salt.testTarget(master, 'I@heat:server')) { |
| 255 | //runSaltProcessStep(master, 'I@heat:server', 'state.sls', ['heat'], 1) |
| 256 | salt.enforceState(master, 'I@heat:server and *01*', 'heat', true) |
| 257 | salt.enforceState(master, 'I@heat:server', 'heat', true) |
| 258 | if (salt.testTarget(master, 'I@keystone:server')) { |
| 259 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true) |
| 260 | } |
| 261 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 262 | |
| 263 | // Restart nova api |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 264 | if (salt.testTarget(master, 'I@nova:controller')) { |
| 265 | salt.runSaltProcessStep(master, 'I@nova:controller', 'service.restart', ['nova-api']) |
| 266 | } |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 267 | |
| 268 | // Install ironic service |
| 269 | if (salt.testTarget(master, 'I@ironic:api')) { |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 270 | salt.enforceState(master, 'I@ironic:api and *01*', 'ironic.api', true) |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 271 | salt.enforceState(master, 'I@ironic:api', 'ironic.api', true) |
| 272 | } |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 273 | |
| 274 | // Install designate service |
| 275 | if (salt.testTarget(master, 'I@designate:server:enabled')) { |
| 276 | if (salt.testTarget(master, 'I@designate:server:backend:bind9')) { |
| 277 | salt.enforceState(master, 'I@bind:server', 'bind.server', true) |
| 278 | } |
| 279 | if (salt.testTarget(master, 'I@designate:server:backend:pdns4')) { |
| 280 | salt.enforceState(master, 'I@powerdns:server', 'powerdns.server', true) |
| 281 | } |
| 282 | salt.enforceState(master, 'I@designate:server and *01*', 'designate.server', true) |
| 283 | salt.enforceState(master, 'I@designate:server', 'designate.server', true) |
| 284 | } |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 285 | |
| 286 | // Install octavia api service |
| 287 | if (salt.testTarget(master, 'I@octavia:api')) { |
| 288 | salt.enforceState(master, 'I@octavia:api', 'octavia', true) |
| 289 | } |
Marek Celoud | c9dd50f | 2017-08-28 13:54:40 +0200 | [diff] [blame] | 290 | |
| 291 | // Install barbican server service |
| 292 | if (salt.testTarget(master, 'I@barbican:server')) { |
Petr Jediný | 1c71703 | 2017-11-03 13:37:34 +0100 | [diff] [blame] | 293 | salt.enforceState(master, 'I@barbican:server and *01*', 'barbican.server', true) |
Marek Celoud | c9dd50f | 2017-08-28 13:54:40 +0200 | [diff] [blame] | 294 | salt.enforceState(master, 'I@barbican:server', 'barbican.server', true) |
| 295 | } |
| 296 | // Install barbican client |
| 297 | if (salt.testTarget(master, 'I@barbican:client')) { |
| 298 | salt.enforceState(master, 'I@barbican:client', 'barbican.client', true) |
| 299 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 303 | def installIronicConductor(master){ |
| 304 | def salt = new com.mirantis.mk.Salt() |
| 305 | |
| 306 | if (salt.testTarget(master, 'I@ironic:conductor')) { |
| 307 | salt.enforceState(master, 'I@ironic:conductor', 'ironic.conductor', true) |
| 308 | salt.enforceState(master, 'I@ironic:conductor', 'apache', true) |
| 309 | } |
| 310 | if (salt.testTarget(master, 'I@tftpd_hpa:server')) { |
| 311 | salt.enforceState(master, 'I@tftpd_hpa:server', 'tftpd_hpa', true) |
| 312 | } |
| 313 | |
| 314 | if (salt.testTarget(master, 'I@nova:compute')) { |
| 315 | salt.runSaltProcessStep(master, 'I@nova:compute', 'service.restart', ['nova-compute']) |
| 316 | } |
| 317 | |
| 318 | if (salt.testTarget(master, 'I@baremetal_simulator:enabled')) { |
| 319 | salt.enforceState(master, 'I@baremetal_simulator:enabled', 'baremetal_simulator', true) |
| 320 | } |
| 321 | if (salt.testTarget(master, 'I@ironic:client')) { |
| 322 | salt.enforceState(master, 'I@ironic:client', 'ironic.client', true) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | |
| 327 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 328 | def installOpenstackNetwork(master, physical = "false") { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 329 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 330 | |
| 331 | salt.runSaltProcessStep(master, 'I@neutron:gateway', 'state.apply', [], null, true) |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 332 | |
| 333 | // install octavia manager services |
| 334 | if (salt.testTarget(master, 'I@octavia:manager')) { |
| 335 | salt.runSaltProcessStep(master, 'I@salt:master', 'mine.update', ['*'], null, true) |
Anastasia Kuznetsova | 38aee7d | 2017-09-12 14:28:17 +0400 | [diff] [blame] | 336 | salt.enforceState(master, 'I@octavia:manager', 'octavia', true) |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 337 | salt.enforceState(master, 'I@octavia:manager', 'salt.minion.ca', true) |
| 338 | salt.enforceState(master, 'I@octavia:manager', 'salt.minion.cert', true) |
| 339 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | |
| 343 | def installOpenstackCompute(master) { |
| 344 | def salt = new com.mirantis.mk.Salt() |
| 345 | |
| 346 | // Configure compute nodes |
| 347 | retry(2) { |
Marek Celoud | e305ec7 | 2017-05-16 11:27:53 +0200 | [diff] [blame] | 348 | salt.runSaltProcessStep(master, 'I@nova:compute', 'state.highstate', ['exclude=opencontrail.client'], null, true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 349 | } |
| 350 | } |
| 351 | |
| 352 | |
| 353 | def installContrailNetwork(master) { |
Martin Polreich | fc9854c | 2017-06-30 11:17:36 +0200 | [diff] [blame] | 354 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 355 | def salt = new com.mirantis.mk.Salt() |
| 356 | |
| 357 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 358 | // Install opencontrail database services |
| 359 | //runSaltProcessStep(master, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 360 | try { |
| 361 | salt.enforceState(master, 'I@opencontrail:database and *01*', 'opencontrail.database', true) |
| 362 | } catch (Exception e) { |
| 363 | common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database and *01*') |
| 364 | } |
| 365 | |
| 366 | try { |
| 367 | salt.enforceState(master, 'I@opencontrail:database', 'opencontrail.database', true) |
| 368 | } catch (Exception e) { |
| 369 | common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database') |
| 370 | } |
| 371 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 372 | // Install opencontrail control services |
| 373 | //runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 374 | salt.runSaltProcessStep(master, 'I@opencontrail:control and *01*', 'state.sls', ['opencontrail', 'exclude=opencontrail.client']) |
| 375 | salt.runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail', 'exclude=opencontrail.client']) |
| 376 | salt.runSaltProcessStep(master, 'I@opencontrail:collector', 'state.sls', ['opencontrail', 'exclude=opencontrail.client']) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 377 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 378 | // Test opencontrail |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 379 | salt.runSaltProcessStep(master, 'I@opencontrail:control', 'cmd.run', ['contrail-status'], null, true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 383 | def installContrailCompute(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame] | 384 | def salt = new com.mirantis.mk.Salt() |
vrovachev | 32f7f54 | 2017-08-25 16:17:25 +0400 | [diff] [blame] | 385 | def common = new com.mirantis.mk.Common() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 386 | // Configure compute nodes |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 387 | // Provision opencontrail control services |
| 388 | salt.enforceState(master, 'I@opencontrail:database:id:1', 'opencontrail.client', true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 389 | // Provision opencontrail virtual routers |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 390 | |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 391 | // Generate script /usr/lib/contrail/if-vhost0 for up vhost0 |
| 392 | try { |
| 393 | salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail', true) |
| 394 | } catch (Exception e) { |
| 395 | common.warningMsg('Exception in state opencontrail on I@opencontrail:compute') |
| 396 | } |
| 397 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 398 | 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) |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 399 | |
| 400 | if (salt.testTarget(master, 'I@opencontrail:compute')) { |
| 401 | sleep(300) |
| 402 | salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail.client', true) |
| 403 | salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail', true) |
| 404 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 408 | def installKubernetesInfra(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame] | 409 | def orchestrate = new com.mirantis.mk.Orchestrate() |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 410 | // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame] | 411 | orchestrate.installInfra(master) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | |
Tomáš Kukrál | c1a1bbc | 2017-04-28 21:16:25 +0200 | [diff] [blame] | 415 | def installKubernetesControl(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 416 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 417 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 418 | // Install Kubernetes pool and Calico |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 419 | salt.enforceState(master, 'I@kubernetes:master', 'kubernetes.master.kube-addons') |
| 420 | salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 421 | |
Marek Celoud | 029391c | 2017-11-14 10:06:18 +0100 | [diff] [blame] | 422 | if (salt.testTarget(master, 'I@etcd:server:setup')) { |
| 423 | // Setup etcd server |
| 424 | salt.enforceState(master, 'I@kubernetes:master and *01*', 'etcd.server.setup') |
| 425 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 426 | |
| 427 | // Run k8s without master.setup |
| 428 | salt.runSaltProcessStep(master, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup']) |
| 429 | |
| 430 | // Run k8s master setup |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 431 | salt.enforceState(master, 'I@kubernetes:master and *01*', 'kubernetes.master.setup') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 432 | |
| 433 | // Restart kubelet |
| 434 | salt.runSaltProcessStep(master, 'I@kubernetes:pool', 'service.restart', ['kubelet']) |
| 435 | } |
| 436 | |
| 437 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 438 | def installKubernetesCompute(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 439 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | e7e2896 | 2017-06-06 11:11:16 +0200 | [diff] [blame] | 440 | |
| 441 | // Refresh minion's pillar data |
| 442 | salt.runSaltProcessStep(master, '*', 'saltutil.refresh_pillar', [], null, true) |
| 443 | salt.runSaltProcessStep(master, '*', 'saltutil.sync_all', [], null, true) |
| 444 | |
| 445 | // Bootstrap all nodes |
| 446 | salt.enforceState(master, 'I@kubernetes:pool', 'linux') |
| 447 | salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion') |
| 448 | salt.enforceState(master, 'I@kubernetes:pool', ['openssh', 'ntp']) |
| 449 | |
| 450 | // Create and distribute SSL certificates for services using salt state |
| 451 | salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion.cert') |
| 452 | |
| 453 | // Install docker |
| 454 | salt.enforceState(master, 'I@docker:host', 'docker.host') |
| 455 | |
| 456 | // Install Kubernetes and Calico |
| 457 | salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool') |
| 458 | |
Yuriy Taraday | ab564d7 | 2017-10-11 15:14:35 +0400 | [diff] [blame] | 459 | // Install Tiller and all configured releases |
| 460 | if (salt.testTarget(master, 'I@helm:client')) { |
| 461 | salt.enforceState(master, 'I@helm:client', 'helm') |
| 462 | } |
Tomáš Kukrál | e7e2896 | 2017-06-06 11:11:16 +0200 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 466 | def installDockerSwarm(master) { |
| 467 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 468 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 469 | //Install and Configure Docker |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 470 | salt.enforceState(master, 'I@docker:swarm', 'docker.host') |
| 471 | salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true) |
| 472 | salt.enforceState(master, 'I@docker:swarm', 'salt.minion.grains', true) |
| 473 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'mine.update', [], null, true) |
| 474 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'saltutil.refresh_modules', [], null, true) |
| 475 | sleep(5) |
Martin Polreich | 377c37a | 2017-08-08 15:42:51 +0200 | [diff] [blame] | 476 | salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 477 | salt.enforceState(master, 'I@docker:swarm:role:manager', 'docker.swarm', true) |
| 478 | salt.cmdRun(master, 'I@docker:swarm:role:master', 'docker node ls', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 479 | } |
| 480 | |
Jiri Broulik | b9a0c59 | 2017-09-05 16:41:48 +0200 | [diff] [blame] | 481 | |
| 482 | def installCicd(master) { |
| 483 | def salt = new com.mirantis.mk.Salt() |
| 484 | |
| 485 | //Install and Configure Docker |
Richard Felkl | 9d2cd92 | 2017-11-03 11:49:32 +0100 | [diff] [blame] | 486 | salt.runSaltProcessStep(master, 'I@jenkins:client or I@gerrit:client', 'saltutil.refresh_pillar', [], null, true) |
| 487 | salt.runSaltProcessStep(master, 'I@jenkins:client or I@gerrit:client', 'saltutil.sync_all', [], null, true) |
| 488 | |
Richard Felkl | 6de1676 | 2017-11-20 11:42:28 +0100 | [diff] [blame^] | 489 | salt.enforceState(master, 'I@aptly:publisher', 'aptly.publisher',true, null, false, -1, 2) |
| 490 | salt.enforceState(master, 'I@docker:swarm:role:master and I@jenkins:client', 'docker.client', true, true, null, false, -1, 2) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 491 | sleep(500) |
Richard Felkl | 6de1676 | 2017-11-20 11:42:28 +0100 | [diff] [blame^] | 492 | salt.enforceState(master, 'I@aptly:server', 'aptly', true, true, null, false, -1, 2) |
| 493 | salt.enforceState(master, 'I@openldap:client', 'openldap', true, true, null, false, -1, 2) |
Richard Felkl | b6fdec9 | 2017-09-26 10:52:36 +0200 | [diff] [blame] | 494 | |
| 495 | if (salt.testTarget(master, 'I@python:environment')) { |
| 496 | salt.enforceState(master, 'I@python:environment', 'python', true) |
| 497 | } |
Richard Felkl | 6de1676 | 2017-11-20 11:42:28 +0100 | [diff] [blame^] | 498 | salt.enforceState(master, 'I@gerrit:client', 'gerrit', true, true, null, false, -1, 2) |
| 499 | salt.enforceState(master, 'I@jenkins:client', 'jenkins', true, true, null, false, -1, 2) |
Jiri Broulik | b9a0c59 | 2017-09-05 16:41:48 +0200 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 503 | def installStacklight(master) { |
| 504 | def common = new com.mirantis.mk.Common() |
| 505 | def salt = new com.mirantis.mk.Salt() |
| 506 | |
Simon Pasquier | ef4122c | 2017-08-25 15:52:07 +0200 | [diff] [blame] | 507 | // Install core services for K8S environments: |
| 508 | // HAProxy, Nginx and lusterFS clients |
| 509 | // In case of OpenStack, those are already installed |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 510 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 511 | salt.enforceState(master, 'I@haproxy:proxy', 'haproxy') |
| 512 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
Simon Pasquier | ef4122c | 2017-08-25 15:52:07 +0200 | [diff] [blame] | 513 | |
| 514 | if (salt.testTarget(master, 'I@nginx:server')) { |
| 515 | salt.enforceState(master, 'I@nginx:server', 'nginx', true) |
| 516 | } |
| 517 | |
| 518 | if (salt.testTarget(master, 'I@glusterfs:client')) { |
| 519 | salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client', true) |
| 520 | } |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 521 | } |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 522 | |
| 523 | // Launch containers |
| 524 | salt.enforceState(master, 'I@docker:swarm:role:master and I@prometheus:server', 'docker.client', true) |
| 525 | salt.runSaltProcessStep(master, 'I@docker:swarm and I@prometheus:server', 'dockerng.ps', [], null, true) |
| 526 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 527 | //Install Telegraf |
Martin Polreich | d894e3e | 2017-07-04 15:35:02 +0200 | [diff] [blame] | 528 | salt.enforceState(master, 'I@telegraf:agent or I@telegraf:remote_agent', 'telegraf', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 529 | |
Dmitry Kalashnik | ebc1e1e | 2017-07-13 14:20:08 +0400 | [diff] [blame] | 530 | // Install Prometheus exporters |
| 531 | if (salt.testTarget(master, 'I@prometheus:exporters')) { |
| 532 | salt.enforceState(master, 'I@prometheus:exporters', 'prometheus', true) |
| 533 | } |
| 534 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 535 | //Install Elasticsearch and Kibana |
Martin Polreich | bf7f616 | 2017-07-06 14:43:21 +0200 | [diff] [blame] | 536 | salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true) |
Martin Polreich | a540ac1 | 2017-06-30 22:48:39 +0200 | [diff] [blame] | 537 | salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true) |
Martin Polreich | bf7f616 | 2017-07-06 14:43:21 +0200 | [diff] [blame] | 538 | salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 539 | salt.enforceState(master, 'I@kibana:server', 'kibana.server', true) |
Martin Polreich | a540ac1 | 2017-06-30 22:48:39 +0200 | [diff] [blame] | 540 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 541 | salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
Martin Polreich | bf7f616 | 2017-07-06 14:43:21 +0200 | [diff] [blame] | 542 | salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 543 | salt.enforceState(master, 'I@influxdb:server', 'influxdb', true) |
| 544 | |
Simon Pasquier | 6301ddd | 2017-09-05 11:56:58 +0200 | [diff] [blame] | 545 | salt.enforceState(master, 'I@heka:log_collector', 'heka.log_collector') |
| 546 | |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 547 | // Install galera |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 548 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 549 | withEnv(['ASK_ON_ERROR=false']){ |
| 550 | retry(2) { |
| 551 | salt.enforceState(master, 'I@galera:master', 'galera', true) |
| 552 | } |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 553 | } |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 554 | salt.enforceState(master, 'I@galera:slave', 'galera', true) |
Martin Polreich | 406f646 | 2017-07-11 11:33:42 +0000 | [diff] [blame] | 555 | |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 556 | // Check galera status |
| 557 | salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status') |
| 558 | salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status') |
| 559 | } |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 560 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 561 | //Collect Grains |
| 562 | salt.enforceState(master, 'I@salt:minion', 'salt.minion.grains', true) |
| 563 | salt.runSaltProcessStep(master, 'I@salt:minion', 'saltutil.refresh_modules', [], null, true) |
| 564 | salt.runSaltProcessStep(master, 'I@salt:minion', 'mine.update', [], null, true) |
| 565 | sleep(5) |
| 566 | |
| 567 | //Configure services in Docker Swarm |
Martin Polreich | 8017f45 | 2017-08-21 16:01:42 +0200 | [diff] [blame] | 568 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 569 | salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'prometheus', true, false) |
| 570 | } |
| 571 | else { |
| 572 | salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', ['prometheus', 'heka.remote_collector'], true, false) |
| 573 | } |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 574 | |
| 575 | //Configure Grafana |
Martin Polreich | 305e222 | 2017-07-06 11:33:00 +0200 | [diff] [blame] | 576 | def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 577 | common.prettyPrint(pillar) |
Martin Polreich | 595baef | 2017-07-04 16:11:04 +0200 | [diff] [blame] | 578 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 579 | def stacklight_vip |
| 580 | if(!pillar['return'].isEmpty()) { |
| 581 | stacklight_vip = pillar['return'][0].values()[0] |
| 582 | } else { |
| 583 | common.errorMsg('[ERROR] Stacklight VIP address could not be retrieved') |
| 584 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 585 | |
Martin Polreich | 305e222 | 2017-07-06 11:33:00 +0200 | [diff] [blame] | 586 | common.infoMsg("Waiting for service on http://${stacklight_vip}:15013/ to start") |
Martin Polreich | bd7ad22 | 2017-07-06 12:53:51 +0200 | [diff] [blame] | 587 | sleep(120) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 588 | salt.enforceState(master, 'I@grafana:client', 'grafana.client', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | def installStacklightv1Control(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 592 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 593 | |
| 594 | // infra install |
| 595 | // Install the StackLight backends |
| 596 | salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true) |
| 597 | salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true) |
| 598 | |
| 599 | salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true) |
| 600 | salt.enforceState(master, 'I@influxdb:server', 'influxdb', true) |
| 601 | |
| 602 | salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true) |
| 603 | salt.enforceState(master, 'I@kibana:server', 'kibana.server', true) |
| 604 | |
| 605 | salt.enforceState(master, '*01* and I@grafana:server','grafana.server', true) |
| 606 | salt.enforceState(master, 'I@grafana:server','grafana.server', true) |
| 607 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 608 | def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service') |
| 609 | def alarming_service = alarming_service_pillar['return'][0].values()[0] |
| 610 | |
| 611 | switch (alarming_service) { |
| 612 | case 'sensu': |
| 613 | // Update Sensu |
| 614 | salt.enforceState(master, 'I@sensu:server and I@rabbitmq:server', 'rabbitmq', true) |
| 615 | salt.enforceState(master, 'I@redis:cluster:role:master', 'redis', true) |
| 616 | salt.enforceState(master, 'I@redis:server', 'redis', true) |
| 617 | salt.enforceState(master, 'I@sensu:server', 'sensu', true) |
| 618 | default: |
| 619 | // Update Nagios |
| 620 | salt.enforceState(master, 'I@nagios:server', 'nagios.server', true) |
| 621 | // Stop the Nagios service because the package starts it by default and it will |
| 622 | // started later only on the node holding the VIP address |
| 623 | salt.runSaltProcessStep(master, 'I@nagios:server', 'service.stop', ['nagios3'], null, true) |
| 624 | } |
| 625 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 626 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client.service', true) |
Marek Celoud | ebc623b | 2017-06-02 17:12:31 +0200 | [diff] [blame] | 627 | salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 628 | |
| 629 | sleep(10) |
| 630 | } |
| 631 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 632 | def installStacklightv1Client(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 633 | def salt = new com.mirantis.mk.Salt() |
| 634 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 635 | |
Alexander Noskov | 3c6a60a | 2017-06-21 14:05:07 +0200 | [diff] [blame] | 636 | salt.runSaltProcessStep(master, 'I@elasticsearch:client', 'cmd.run', ['salt-call state.sls elasticsearch.client'], null, true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 637 | // salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true) |
Alexander Noskov | 3c6a60a | 2017-06-21 14:05:07 +0200 | [diff] [blame] | 638 | salt.runSaltProcessStep(master, 'I@kibana:client', 'cmd.run', ['salt-call state.sls kibana.client'], null, true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 639 | // salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
| 640 | |
| 641 | // Install collectd, heka and sensu services on the nodes, this will also |
| 642 | // generate the metadata that goes into the grains and eventually into Salt Mine |
| 643 | salt.enforceState(master, '*', 'collectd', true) |
| 644 | salt.enforceState(master, '*', 'salt.minion', true) |
| 645 | salt.enforceState(master, '*', 'heka', true) |
| 646 | |
| 647 | // Gather the Grafana metadata as grains |
| 648 | salt.enforceState(master, 'I@grafana:collector', 'grafana.collector', true) |
| 649 | |
| 650 | // Update Salt Mine |
| 651 | salt.enforceState(master, '*', 'salt.minion.grains', true) |
| 652 | salt.runSaltProcessStep(master, '*', 'saltutil.refresh_modules', [], null, true) |
| 653 | salt.runSaltProcessStep(master, '*', 'mine.update', [], null, true) |
| 654 | |
| 655 | sleep(5) |
| 656 | |
| 657 | // Update Heka |
| 658 | salt.enforceState(master, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka', true) |
| 659 | |
| 660 | // Update collectd |
| 661 | salt.enforceState(master, 'I@collectd:remote_client:enabled:True', 'collectd', true) |
| 662 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 663 | def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service') |
| 664 | def alarming_service = alarming_service_pillar['return'][0].values()[0] |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 665 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 666 | switch (alarming_service) { |
| 667 | case 'sensu': |
| 668 | // Update Sensu |
| 669 | // TODO for stacklight team, should be fixed in model |
| 670 | salt.enforceState(master, 'I@sensu:client', 'sensu', true) |
| 671 | default: |
| 672 | break |
| 673 | // Default is nagios, and was enforced in installStacklightControl() |
| 674 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 675 | |
Alexander Noskov | 3c6a60a | 2017-06-21 14:05:07 +0200 | [diff] [blame] | 676 | salt.runSaltProcessStep(master, 'I@grafana:client and *01*', 'cmd.run', ['salt-call state.sls grafana.client'], null, true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 677 | // salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true) |
| 678 | |
Marek Celoud | d200cad | 2017-06-07 10:34:46 +0200 | [diff] [blame] | 679 | // Finalize the configuration of Grafana (add the dashboards...) |
Alexander Noskov | 8448fc5 | 2017-06-21 14:03:45 +0200 | [diff] [blame] | 680 | salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true) |
| 681 | salt.enforceState(master, 'I@grafana:client and *02*', 'grafana.client', true) |
| 682 | salt.enforceState(master, 'I@grafana:client and *03*', 'grafana.client', true) |
Marek Celoud | d200cad | 2017-06-07 10:34:46 +0200 | [diff] [blame] | 683 | // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10 |
| 684 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 685 | // Get the StackLight monitoring VIP addres |
| 686 | //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}') |
| 687 | //vip=${vip:=172.16.10.253} |
| 688 | def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address') |
Jakub Josef | bceaa32 | 2017-06-13 18:28:27 +0200 | [diff] [blame] | 689 | common.prettyPrint(pillar) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 690 | def stacklight_vip = pillar['return'][0].values()[0] |
| 691 | |
| 692 | if (stacklight_vip) { |
| 693 | // (re)Start manually the services that are bound to the monitoring VIP |
| 694 | common.infoMsg("restart services on node with IP: ${stacklight_vip}") |
| 695 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], null, true) |
| 696 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], null, true) |
| 697 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], null, true) |
| 698 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], null, true) |
| 699 | } else { |
| 700 | throw new Exception("Missing stacklight_vip") |
| 701 | } |
Tomáš Kukrál | f06ca0f | 2017-02-27 15:18:50 +0100 | [diff] [blame] | 702 | } |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 703 | |
| 704 | |
| 705 | // |
| 706 | // Ceph |
| 707 | // |
| 708 | |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 709 | def installCephMon(master, target='I@ceph:mon') { |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 710 | def salt = new com.mirantis.mk.Salt() |
| 711 | |
Jiri Broulik | bfc234f | 2017-10-17 15:45:38 +0200 | [diff] [blame] | 712 | salt.enforceState(master, 'I@ceph:common', 'salt.minion.grains', true) |
| 713 | |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 714 | // generate keyrings |
| 715 | if (salt.testTarget(master, 'I@ceph:mon:keyring:mon or I@ceph:common:keyring:admin')) { |
| 716 | salt.enforceState(master, 'I@ceph:mon:keyring:mon or I@ceph:common:keyring:admin', 'ceph.mon', true) |
Jiri Broulik | 07f8de7 | 2017-10-09 14:12:17 +0200 | [diff] [blame] | 717 | salt.runSaltProcessStep(master, 'I@ceph:mon', 'saltutil.sync_grains', [], null, true) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 718 | salt.runSaltProcessStep(master, 'I@ceph:mon:keyring:mon or I@ceph:common:keyring:admin', 'mine.update', [], null, true) |
Jiri Broulik | 3c75a6d | 2017-10-06 18:44:37 +0200 | [diff] [blame] | 719 | sleep(5) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 720 | } |
Ondrej Smola | fd5c235 | 2017-08-11 14:25:39 +0200 | [diff] [blame] | 721 | // install Ceph Mons |
Tomáš Kukrál | 9b4fb51 | 2017-08-14 11:01:49 +0200 | [diff] [blame] | 722 | salt.enforceState(master, target, 'ceph.mon', true) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 723 | if (salt.testTarget(master, 'I@ceph:mgr')) { |
Jiri Broulik | 3c75a6d | 2017-10-06 18:44:37 +0200 | [diff] [blame] | 724 | salt.enforceState(master, 'I@ceph:mgr', 'ceph.mgr', true) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 725 | } |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 726 | } |
| 727 | |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 728 | def installCephOsd(master, target='I@ceph:osd', setup=true) { |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 729 | def salt = new com.mirantis.mk.Salt() |
| 730 | |
| 731 | // install Ceph OSDs |
| 732 | salt.enforceState(master, target, 'ceph.osd', true) |
Jiri Broulik | 07f8de7 | 2017-10-09 14:12:17 +0200 | [diff] [blame] | 733 | salt.runSaltProcessStep(master, 'I@ceph:osd', 'saltutil.sync_grains', [], null, true) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 734 | salt.enforceState(master, target, 'ceph.osd.custom', true) |
Jiri Broulik | 2911deb | 2017-10-12 20:26:43 +0200 | [diff] [blame] | 735 | salt.runSaltProcessStep(master, 'I@ceph:osd', 'saltutil.sync_grains', [], null, true) |
| 736 | salt.runSaltProcessStep(master, 'I@ceph:osd', 'mine.update', [], null, true) |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 737 | |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 738 | // setup pools, keyrings and maybe crush |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 739 | if (salt.testTarget(master, 'I@ceph:setup') && setup) { |
Jiri Broulik | 07f8de7 | 2017-10-09 14:12:17 +0200 | [diff] [blame] | 740 | sleep(5) |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 741 | salt.enforceState(master, 'I@ceph:setup', 'ceph.setup', true) |
| 742 | } |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 743 | } |
Tomáš Kukrál | 1e5b219 | 2017-08-15 16:58:18 +0200 | [diff] [blame] | 744 | |
Tomáš Kukrál | 5836e3d | 2017-08-25 18:20:55 +0200 | [diff] [blame] | 745 | def installCephClient(master) { |
Tomáš Kukrál | 1e5b219 | 2017-08-15 16:58:18 +0200 | [diff] [blame] | 746 | def salt = new com.mirantis.mk.Salt() |
| 747 | |
| 748 | // install Ceph Radosgw |
Tomáš Kukrál | 5836e3d | 2017-08-25 18:20:55 +0200 | [diff] [blame] | 749 | if (salt.testTarget(master, 'I@ceph:radosgw')) { |
Jiri Broulik | bfc234f | 2017-10-17 15:45:38 +0200 | [diff] [blame] | 750 | salt.runSaltProcessStep(master, 'I@ceph:radosgw', 'saltutil.sync_grains', [], null, true) |
Tomáš Kukrál | 1fe9045 | 2017-08-28 18:27:26 +0200 | [diff] [blame] | 751 | salt.enforceState(master, 'I@ceph:radosgw', 'ceph.radosgw', true) |
Jiri Broulik | 831a74e | 2017-10-18 08:27:11 +0200 | [diff] [blame] | 752 | // setup Keystone service and endpoints for swift or / and S3 |
| 753 | salt.enforceState(master, 'I@keystone:client', 'keystone.client', true) |
Tomáš Kukrál | 5836e3d | 2017-08-25 18:20:55 +0200 | [diff] [blame] | 754 | } |
Tomáš Kukrál | 1e5b219 | 2017-08-15 16:58:18 +0200 | [diff] [blame] | 755 | } |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 756 | |
| 757 | def connectCeph(master) { |
| 758 | def salt = new com.mirantis.mk.Salt() |
| 759 | |
| 760 | // connect Ceph to the env |
| 761 | if (salt.testTarget(master, 'I@ceph:common and I@glance:server')) { |
| 762 | salt.enforceState(master, 'I@ceph:common and I@glance:server', ['ceph.common', 'ceph.setup.keyring', 'glance'], true) |
| 763 | salt.runSaltProcessStep(master, 'I@ceph:common and I@glance:server', 'service.restart', ['glance-api', 'glance-glare', 'glance-registry']) |
| 764 | } |
| 765 | if (salt.testTarget(master, 'I@ceph:common and I@cinder:controller')) { |
| 766 | salt.enforceState(master, 'I@ceph:common and I@cinder:controller', ['ceph.common', 'ceph.setup.keyring', 'cinder'], true) |
| 767 | } |
| 768 | if (salt.testTarget(master, 'I@ceph:common and I@nova:compute')) { |
| 769 | salt.enforceState(master, 'I@ceph:common and I@nova:compute', ['ceph.common', 'ceph.setup.keyring'], true) |
Jiri Broulik | 07f8de7 | 2017-10-09 14:12:17 +0200 | [diff] [blame] | 770 | salt.runSaltProcessStep(master, 'I@ceph:common and I@nova:compute', 'saltutil.sync_grains', [], null, true) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 771 | salt.enforceState(master, 'I@ceph:common and I@nova:compute', ['nova'], true) |
| 772 | } |
| 773 | } |