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 | |
| 20 | salt.enforceState(master, 'I@salt:master', ['salt.master', 'reclass'], true) |
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) |
| 26 | salt.enforceState(master, 'I@salt:master', ['salt.minion'], true) |
| 27 | |
Jakub Josef | 200550f | 2017-05-16 17:39:55 +0200 | [diff] [blame] | 28 | salt.enforceState(master, '*', ['linux.system'], true) |
| 29 | salt.enforceState(master, '*', ['salt.minion'], true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 30 | salt.enforceState(master, 'I@linux:system', ['linux', 'openssh', 'salt.minion', 'ntp'], true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 31 | } |
| 32 | |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 33 | def installInfraKvm(master) { |
| 34 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 35 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 36 | salt.runSaltProcessStep(master, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true) |
| 37 | salt.runSaltProcessStep(master, 'I@linux:system', 'saltutil.sync_all', [], null, true) |
| 38 | |
| 39 | salt.enforceState(master, 'I@salt:control', ['salt.minion', 'linux.system', 'linux.network', 'ntp'], true) |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 40 | salt.enforceState(master, 'I@salt:control', 'libvirt', true) |
| 41 | salt.enforceState(master, 'I@salt:control', 'salt.control', true) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 42 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 43 | sleep(600) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 44 | |
Marek Celoud | c9b3cc8 | 2017-05-22 12:50:53 +0000 | [diff] [blame] | 45 | salt.runSaltProcessStep(master, '* and not kvm*', 'saltutil.refresh_pillar', [], null, true) |
| 46 | salt.runSaltProcessStep(master, '* and not kvm*', 'saltutil.sync_all', [], null, true) |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 47 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 48 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 49 | def installInfra(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 50 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 51 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 52 | // Install glusterfs |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 53 | if (salt.testTarget(master, 'I@glusterfs:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 54 | salt.enforceState(master, 'I@glusterfs:server', 'glusterfs.server.service', true) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 55 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 56 | withEnv(['ASK_ON_ERROR=false']){ |
| 57 | retry(5) { |
| 58 | salt.enforceState(master, 'I@glusterfs:server and *01*', 'glusterfs.server.setup', true) |
| 59 | } |
Alexander Noskov | 93acac4 | 2017-06-20 17:55:55 +0200 | [diff] [blame] | 60 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 61 | |
| 62 | salt.runSaltProcessStep(master, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'], null, true) |
| 63 | 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] | 64 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 65 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 66 | // Install galera |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 67 | if (salt.testTarget(master, 'I@galera:server') || salt.testTarget(master, 'I@galera:slave')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 68 | withEnv(['ASK_ON_ERROR=false']){ |
| 69 | retry(2) { |
| 70 | salt.enforceState(master, 'I@galera:master', 'galera', true) |
| 71 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 72 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 73 | salt.enforceState(master, 'I@galera:slave', 'galera', true) |
| 74 | |
| 75 | // Check galera status |
| 76 | salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status') |
| 77 | salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 78 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 79 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 80 | // Install docker |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 81 | if (salt.testTarget(master, 'I@docker:host')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 82 | salt.enforceState(master, 'I@docker:host', 'docker.host') |
| 83 | salt.runSaltProcessStep(master, 'I@docker:host', 'cmd.run', ['docker ps']) |
| 84 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 85 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 86 | // Install keepalived |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 87 | if (salt.testTarget(master, 'I@keepalived:cluster')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 88 | salt.enforceState(master, 'I@keepalived:cluster and *01*', 'keepalived', true) |
| 89 | salt.enforceState(master, 'I@keepalived:cluster', 'keepalived', true) |
| 90 | } |
| 91 | |
| 92 | // Install rabbitmq |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 93 | if (salt.testTarget(master, 'I@rabbitmq:server')) { |
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@rabbitmq:server', 'rabbitmq', true) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // Check the rabbitmq status |
| 101 | salt.runSaltProcessStep(master, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status']) |
| 102 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 103 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 104 | // Install haproxy |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 105 | if (salt.testTarget(master, 'I@haproxy:proxy')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 106 | salt.enforceState(master, 'I@haproxy:proxy', 'haproxy', true) |
| 107 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
| 108 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.restart', ['rsyslog']) |
| 109 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 110 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 111 | // Install memcached |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 112 | if (salt.testTarget(master, 'I@memcached:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 113 | salt.enforceState(master, 'I@memcached:server', 'memcached', true) |
| 114 | } |
| 115 | |
| 116 | // Install etcd |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 117 | if (salt.testTarget(master, 'I@etcd:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 118 | salt.enforceState(master, 'I@etcd:server', 'etcd.server.service') |
| 119 | salt.runSaltProcessStep(master, 'I@etcd:server', 'cmd.run', ['bash -c "source /var/lib/etcd/configenv && etcdctl cluster-health"']) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | def installOpenstackInfra(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame^] | 124 | def orchestrate = new com.mirantis.mk.Orchestrate() |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 125 | |
| 126 | // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame^] | 127 | orchestrate.installInfra(master) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 131 | def installOpenstackControl(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 132 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 133 | |
| 134 | // Install horizon dashboard |
Martin Polreich | 406f646 | 2017-07-11 11:33:42 +0000 | [diff] [blame] | 135 | salt.enforceState(master, 'I@horizon:server', 'horizon', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 136 | salt.enforceState(master, 'I@nginx:server', 'nginx', true) |
| 137 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 138 | // setup keystone service |
| 139 | //runSaltProcessStep(master, 'I@keystone:server', 'state.sls', ['keystone.server'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 140 | salt.enforceState(master, 'I@keystone:server and *01*', 'keystone.server', true) |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 141 | salt.enforceState(master, 'I@keystone:server', 'keystone.server', true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 142 | // populate keystone services/tenants/roles/users |
Tomáš Kukrál | 926e633 | 2017-03-02 09:23:03 +0100 | [diff] [blame] | 143 | |
| 144 | // keystone:client must be called locally |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 145 | //salt.runSaltProcessStep(master, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true) |
| 146 | salt.runSaltProcessStep(master, 'I@keystone:server', 'service.restart', ['apache2']) |
| 147 | sleep(30) |
| 148 | salt.enforceState(master, 'I@keystone:client', 'keystone.client', true) |
| 149 | salt.enforceState(master, 'I@keystone:client', 'keystone.client', true) |
| 150 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonercv3; openstack service list'], null, true) |
Tomáš Kukrál | 926e633 | 2017-03-02 09:23:03 +0100 | [diff] [blame] | 151 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 152 | // Install glance and ensure glusterfs clusters |
| 153 | //runSaltProcessStep(master, 'I@glance:server', 'state.sls', ['glance.server'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 154 | salt.enforceState(master, 'I@glance:server and *01*', 'glance.server', true) |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 155 | salt.enforceState(master, 'I@glance:server', 'glance.server', true) |
| 156 | salt.enforceState(master, 'I@glance:server', 'glusterfs.client', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 157 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 158 | // Update fernet tokens before doing request on keystone server |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 159 | salt.enforceState(master, 'I@keystone:server', 'keystone.server', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 160 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 161 | // Check glance service |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 162 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true) |
| 163 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 164 | // Install and check nova service |
| 165 | //runSaltProcessStep(master, 'I@nova:controller', 'state.sls', ['nova'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 166 | salt.enforceState(master, 'I@nova:controller and *01*', 'nova.controller', true) |
| 167 | salt.enforceState(master, 'I@nova:controller', 'nova.controller', true) |
| 168 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true) |
| 169 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 170 | // Install and check cinder service |
| 171 | //runSaltProcessStep(master, 'I@cinder:controller', 'state.sls', ['cinder'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 172 | salt.enforceState(master, 'I@cinder:controller and *01*', 'cinder', true) |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 173 | salt.enforceState(master, 'I@cinder:controller', 'cinder', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 174 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true) |
| 175 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 176 | // Install neutron service |
| 177 | //runSaltProcessStep(master, 'I@neutron:server', 'state.sls', ['neutron'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 178 | |
| 179 | salt.enforceState(master, 'I@neutron:server and *01*', 'neutron.server', true) |
| 180 | salt.enforceState(master, 'I@neutron:server', 'neutron.server', true) |
| 181 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true) |
| 182 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 183 | // Install heat service |
| 184 | //runSaltProcessStep(master, 'I@heat:server', 'state.sls', ['heat'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 185 | salt.enforceState(master, 'I@heat:server and *01*', 'heat', true) |
Tomáš Kukrál | 0abdde5 | 2017-03-01 21:57:23 +0100 | [diff] [blame] | 186 | salt.enforceState(master, 'I@heat:server', 'heat', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 187 | salt.runSaltProcessStep(master, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true) |
| 188 | |
| 189 | // Restart nova api |
| 190 | salt.runSaltProcessStep(master, 'I@nova:controller', 'service.restart', ['nova-api']) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 194 | def installOpenstackNetwork(master, physical = "false") { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 195 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 196 | |
| 197 | salt.runSaltProcessStep(master, 'I@neutron:gateway', 'state.apply', [], null, true) |
| 198 | } |
| 199 | |
| 200 | |
| 201 | def installOpenstackCompute(master) { |
| 202 | def salt = new com.mirantis.mk.Salt() |
| 203 | |
| 204 | // Configure compute nodes |
| 205 | retry(2) { |
Marek Celoud | e305ec7 | 2017-05-16 11:27:53 +0200 | [diff] [blame] | 206 | 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] | 207 | } |
| 208 | } |
| 209 | |
| 210 | |
| 211 | def installContrailNetwork(master) { |
Martin Polreich | fc9854c | 2017-06-30 11:17:36 +0200 | [diff] [blame] | 212 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 213 | def salt = new com.mirantis.mk.Salt() |
| 214 | |
| 215 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 216 | // Install opencontrail database services |
| 217 | //runSaltProcessStep(master, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 218 | try { |
| 219 | salt.enforceState(master, 'I@opencontrail:database and *01*', 'opencontrail.database', true) |
| 220 | } catch (Exception e) { |
| 221 | common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database and *01*') |
| 222 | } |
| 223 | |
| 224 | try { |
| 225 | salt.enforceState(master, 'I@opencontrail:database', 'opencontrail.database', true) |
| 226 | } catch (Exception e) { |
| 227 | common.warningMsg('Exception in state opencontrail.database on I@opencontrail:database') |
| 228 | } |
| 229 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 230 | // Install opencontrail control services |
| 231 | //runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 232 | salt.runSaltProcessStep(master, 'I@opencontrail:control and *01*', 'state.sls', ['opencontrail', 'exclude=opencontrail.client']) |
| 233 | salt.runSaltProcessStep(master, 'I@opencontrail:control', 'state.sls', ['opencontrail', 'exclude=opencontrail.client']) |
| 234 | 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] | 235 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 236 | // Test opencontrail |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 237 | salt.runSaltProcessStep(master, 'I@opencontrail:control', 'cmd.run', ['contrail-status'], null, true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 241 | def installContrailCompute(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame^] | 242 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 243 | // Configure compute nodes |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 244 | // Provision opencontrail control services |
| 245 | salt.enforceState(master, 'I@opencontrail:database:id:1', 'opencontrail.client', true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 246 | // Provision opencontrail virtual routers |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 247 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 248 | 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) |
| 249 | sleep(300) |
Marek Celoud | e305ec7 | 2017-05-16 11:27:53 +0200 | [diff] [blame] | 250 | salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail.client', true) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 254 | def installKubernetesInfra(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame^] | 255 | def orchestrate = new com.mirantis.mk.Orchestrate() |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 256 | // THIS FUNCTION IS LEGACY, PLEASE USE installInfra directly |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame^] | 257 | orchestrate.installInfra(master) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | |
Tomáš Kukrál | c1a1bbc | 2017-04-28 21:16:25 +0200 | [diff] [blame] | 261 | def installKubernetesControl(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 262 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 263 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 264 | // Install Kubernetes pool and Calico |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 265 | salt.enforceState(master, 'I@kubernetes:master', 'kubernetes.master.kube-addons') |
| 266 | salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 267 | |
| 268 | // Setup etcd server |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 269 | salt.enforceState(master, 'I@kubernetes:master and *01*', 'etcd.server.setup') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 270 | |
| 271 | // Run k8s without master.setup |
| 272 | salt.runSaltProcessStep(master, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup']) |
| 273 | |
| 274 | // Run k8s master setup |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 275 | salt.enforceState(master, 'I@kubernetes:master and *01*', 'kubernetes.master.setup') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 276 | |
| 277 | // Restart kubelet |
| 278 | salt.runSaltProcessStep(master, 'I@kubernetes:pool', 'service.restart', ['kubelet']) |
| 279 | } |
| 280 | |
| 281 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 282 | def installKubernetesCompute(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 283 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | e7e2896 | 2017-06-06 11:11:16 +0200 | [diff] [blame] | 284 | |
| 285 | // Refresh minion's pillar data |
| 286 | salt.runSaltProcessStep(master, '*', 'saltutil.refresh_pillar', [], null, true) |
| 287 | salt.runSaltProcessStep(master, '*', 'saltutil.sync_all', [], null, true) |
| 288 | |
| 289 | // Bootstrap all nodes |
| 290 | salt.enforceState(master, 'I@kubernetes:pool', 'linux') |
| 291 | salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion') |
| 292 | salt.enforceState(master, 'I@kubernetes:pool', ['openssh', 'ntp']) |
| 293 | |
| 294 | // Create and distribute SSL certificates for services using salt state |
| 295 | salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion.cert') |
| 296 | |
| 297 | // Install docker |
| 298 | salt.enforceState(master, 'I@docker:host', 'docker.host') |
| 299 | |
| 300 | // Install Kubernetes and Calico |
| 301 | salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool') |
| 302 | |
| 303 | } |
| 304 | |
| 305 | |
| 306 | def installKubernetesContrailCompute(master) { |
| 307 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 308 | // Install opencontrail |
| 309 | salt.runSaltProcessStep(master, 'I@opencontrail:compute', 'state.sls', ['opencontrail']) |
| 310 | // Reboot compute nodes |
vrovachev | 02cd1bc | 2017-06-28 10:47:13 +0400 | [diff] [blame] | 311 | try { |
| 312 | salt.runSaltProcessStep(master, 'I@opencontrail:compute', 'system.reboot') |
| 313 | } catch (Exception e) { |
| 314 | common.warningMsg('Exception in state system.reboot on I@opencontrail:compute') |
| 315 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 316 | } |
| 317 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 318 | def installDockerSwarm(master) { |
| 319 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 320 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 321 | //Install and Configure Docker |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 322 | salt.enforceState(master, 'I@docker:swarm', 'docker.host') |
| 323 | salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true) |
| 324 | salt.enforceState(master, 'I@docker:swarm', 'salt.minion.grains', true) |
| 325 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'mine.update', [], null, true) |
| 326 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'saltutil.refresh_modules', [], null, true) |
| 327 | sleep(5) |
| 328 | salt.enforceState(master, 'I@docker:swarm:role:manager', 'docker.swarm', true) |
| 329 | salt.cmdRun(master, 'I@docker:swarm:role:master', 'docker node ls', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | |
| 333 | def installStacklight(master) { |
| 334 | def common = new com.mirantis.mk.Common() |
| 335 | def salt = new com.mirantis.mk.Salt() |
| 336 | |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 337 | // Install haproxy |
| 338 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 339 | salt.enforceState(master, 'I@haproxy:proxy', 'haproxy') |
| 340 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
| 341 | } |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 342 | //Install Telegraf |
Martin Polreich | d894e3e | 2017-07-04 15:35:02 +0200 | [diff] [blame] | 343 | 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] | 344 | |
| 345 | //Install Elasticsearch and Kibana |
Martin Polreich | bf7f616 | 2017-07-06 14:43:21 +0200 | [diff] [blame] | 346 | salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true) |
Martin Polreich | a540ac1 | 2017-06-30 22:48:39 +0200 | [diff] [blame] | 347 | salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true) |
Martin Polreich | bf7f616 | 2017-07-06 14:43:21 +0200 | [diff] [blame] | 348 | salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 349 | salt.enforceState(master, 'I@kibana:server', 'kibana.server', true) |
Martin Polreich | a540ac1 | 2017-06-30 22:48:39 +0200 | [diff] [blame] | 350 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 351 | salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
Martin Polreich | bf7f616 | 2017-07-06 14:43:21 +0200 | [diff] [blame] | 352 | salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 353 | salt.enforceState(master, 'I@influxdb:server', 'influxdb', true) |
| 354 | |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 355 | // Install galera |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 356 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 357 | withEnv(['ASK_ON_ERROR=false']){ |
| 358 | retry(2) { |
| 359 | salt.enforceState(master, 'I@galera:master', 'galera', true) |
| 360 | } |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 361 | } |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 362 | salt.enforceState(master, 'I@galera:slave', 'galera', true) |
Martin Polreich | 406f646 | 2017-07-11 11:33:42 +0000 | [diff] [blame] | 363 | |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 364 | // Check galera status |
| 365 | salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status') |
| 366 | salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status') |
| 367 | } |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 368 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 369 | //Collect Grains |
| 370 | salt.enforceState(master, 'I@salt:minion', 'salt.minion.grains', true) |
| 371 | salt.runSaltProcessStep(master, 'I@salt:minion', 'saltutil.refresh_modules', [], null, true) |
| 372 | salt.runSaltProcessStep(master, 'I@salt:minion', 'mine.update', [], null, true) |
| 373 | sleep(5) |
| 374 | |
| 375 | //Configure services in Docker Swarm |
Martin Polreich | 595baef | 2017-07-04 16:11:04 +0200 | [diff] [blame] | 376 | salt.enforceState(master, 'I@docker:swarm', ['prometheus', 'heka.remote_collector'], true, false) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 377 | salt.enforceState(master, 'I@docker:swarm:role:master', 'docker', true) |
Martin Polreich | 595baef | 2017-07-04 16:11:04 +0200 | [diff] [blame] | 378 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'dockerng.ps', [], null, true) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 379 | |
| 380 | //Configure Grafana |
Martin Polreich | 305e222 | 2017-07-06 11:33:00 +0200 | [diff] [blame] | 381 | def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 382 | common.prettyPrint(pillar) |
Martin Polreich | 595baef | 2017-07-04 16:11:04 +0200 | [diff] [blame] | 383 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 384 | def stacklight_vip |
| 385 | if(!pillar['return'].isEmpty()) { |
| 386 | stacklight_vip = pillar['return'][0].values()[0] |
| 387 | } else { |
| 388 | common.errorMsg('[ERROR] Stacklight VIP address could not be retrieved') |
| 389 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 390 | |
Martin Polreich | 305e222 | 2017-07-06 11:33:00 +0200 | [diff] [blame] | 391 | common.infoMsg("Waiting for service on http://${stacklight_vip}:15013/ to start") |
Martin Polreich | bd7ad22 | 2017-07-06 12:53:51 +0200 | [diff] [blame] | 392 | sleep(120) |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 393 | salt.enforceState(master, 'I@grafana:client', 'grafana.client', true) |
| 394 | |
| 395 | salt.enforceState(master, 'I@heka:log_collector', 'heka.log_collector') |
| 396 | } |
| 397 | |
| 398 | def installStacklightv1Control(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 399 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 400 | |
| 401 | // infra install |
| 402 | // Install the StackLight backends |
| 403 | salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server', true) |
| 404 | salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server', true) |
| 405 | |
| 406 | salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb', true) |
| 407 | salt.enforceState(master, 'I@influxdb:server', 'influxdb', true) |
| 408 | |
| 409 | salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server', true) |
| 410 | salt.enforceState(master, 'I@kibana:server', 'kibana.server', true) |
| 411 | |
| 412 | salt.enforceState(master, '*01* and I@grafana:server','grafana.server', true) |
| 413 | salt.enforceState(master, 'I@grafana:server','grafana.server', true) |
| 414 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 415 | def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service') |
| 416 | def alarming_service = alarming_service_pillar['return'][0].values()[0] |
| 417 | |
| 418 | switch (alarming_service) { |
| 419 | case 'sensu': |
| 420 | // Update Sensu |
| 421 | salt.enforceState(master, 'I@sensu:server and I@rabbitmq:server', 'rabbitmq', true) |
| 422 | salt.enforceState(master, 'I@redis:cluster:role:master', 'redis', true) |
| 423 | salt.enforceState(master, 'I@redis:server', 'redis', true) |
| 424 | salt.enforceState(master, 'I@sensu:server', 'sensu', true) |
| 425 | default: |
| 426 | // Update Nagios |
| 427 | salt.enforceState(master, 'I@nagios:server', 'nagios.server', true) |
| 428 | // Stop the Nagios service because the package starts it by default and it will |
| 429 | // started later only on the node holding the VIP address |
| 430 | salt.runSaltProcessStep(master, 'I@nagios:server', 'service.stop', ['nagios3'], null, true) |
| 431 | } |
| 432 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 433 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client.service', true) |
Marek Celoud | ebc623b | 2017-06-02 17:12:31 +0200 | [diff] [blame] | 434 | salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 435 | |
| 436 | sleep(10) |
| 437 | } |
| 438 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 439 | def installStacklightv1Client(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 440 | def salt = new com.mirantis.mk.Salt() |
| 441 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 442 | |
Alexander Noskov | 3c6a60a | 2017-06-21 14:05:07 +0200 | [diff] [blame] | 443 | 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] | 444 | // salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true) |
Alexander Noskov | 3c6a60a | 2017-06-21 14:05:07 +0200 | [diff] [blame] | 445 | 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] | 446 | // salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
| 447 | |
| 448 | // Install collectd, heka and sensu services on the nodes, this will also |
| 449 | // generate the metadata that goes into the grains and eventually into Salt Mine |
| 450 | salt.enforceState(master, '*', 'collectd', true) |
| 451 | salt.enforceState(master, '*', 'salt.minion', true) |
| 452 | salt.enforceState(master, '*', 'heka', true) |
| 453 | |
| 454 | // Gather the Grafana metadata as grains |
| 455 | salt.enforceState(master, 'I@grafana:collector', 'grafana.collector', true) |
| 456 | |
| 457 | // Update Salt Mine |
| 458 | salt.enforceState(master, '*', 'salt.minion.grains', true) |
| 459 | salt.runSaltProcessStep(master, '*', 'saltutil.refresh_modules', [], null, true) |
| 460 | salt.runSaltProcessStep(master, '*', 'mine.update', [], null, true) |
| 461 | |
| 462 | sleep(5) |
| 463 | |
| 464 | // Update Heka |
| 465 | salt.enforceState(master, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka', true) |
| 466 | |
| 467 | // Update collectd |
| 468 | salt.enforceState(master, 'I@collectd:remote_client:enabled:True', 'collectd', true) |
| 469 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 470 | def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service') |
| 471 | def alarming_service = alarming_service_pillar['return'][0].values()[0] |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 472 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 473 | switch (alarming_service) { |
| 474 | case 'sensu': |
| 475 | // Update Sensu |
| 476 | // TODO for stacklight team, should be fixed in model |
| 477 | salt.enforceState(master, 'I@sensu:client', 'sensu', true) |
| 478 | default: |
| 479 | break |
| 480 | // Default is nagios, and was enforced in installStacklightControl() |
| 481 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 482 | |
Alexander Noskov | 3c6a60a | 2017-06-21 14:05:07 +0200 | [diff] [blame] | 483 | 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] | 484 | // salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true) |
| 485 | |
Marek Celoud | d200cad | 2017-06-07 10:34:46 +0200 | [diff] [blame] | 486 | // Finalize the configuration of Grafana (add the dashboards...) |
Alexander Noskov | 8448fc5 | 2017-06-21 14:03:45 +0200 | [diff] [blame] | 487 | salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true) |
| 488 | salt.enforceState(master, 'I@grafana:client and *02*', 'grafana.client', true) |
| 489 | salt.enforceState(master, 'I@grafana:client and *03*', 'grafana.client', true) |
Marek Celoud | d200cad | 2017-06-07 10:34:46 +0200 | [diff] [blame] | 490 | // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10 |
| 491 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 492 | // Get the StackLight monitoring VIP addres |
| 493 | //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}') |
| 494 | //vip=${vip:=172.16.10.253} |
| 495 | def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address') |
Jakub Josef | bceaa32 | 2017-06-13 18:28:27 +0200 | [diff] [blame] | 496 | common.prettyPrint(pillar) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 497 | def stacklight_vip = pillar['return'][0].values()[0] |
| 498 | |
| 499 | if (stacklight_vip) { |
| 500 | // (re)Start manually the services that are bound to the monitoring VIP |
| 501 | common.infoMsg("restart services on node with IP: ${stacklight_vip}") |
| 502 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], null, true) |
| 503 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], null, true) |
| 504 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], null, true) |
| 505 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], null, true) |
| 506 | } else { |
| 507 | throw new Exception("Missing stacklight_vip") |
| 508 | } |
Tomáš Kukrál | f06ca0f | 2017-02-27 15:18:50 +0100 | [diff] [blame] | 509 | } |