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 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 10 | salt.cmdRun(master, 'I@salt:master' ,'salt-key') |
| 11 | salt.runSaltProcessStep(master, 'I@salt:minion', 'test.version') |
| 12 | salt.cmdRun(master, 'I@salt:master' ,'reclass-salt --top') |
| 13 | salt.runSaltProcessStep(master, 'I@reclass:storage', 'reclass.inventory') |
| 14 | salt.runSaltProcessStep(master, 'I@salt:minion', 'state.show_top') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 15 | } |
| 16 | |
Jiri Broulik | 8e1f1fe | 2017-12-13 11:54:06 +0100 | [diff] [blame] | 17 | def installFoundationInfra(master, staticMgmtNet=false) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 18 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 19 | |
Vasyl Saienko | 0869b3a | 2017-11-22 14:37:57 +0200 | [diff] [blame] | 20 | // NOTE(vsaienko) Apply reclass first, it may update cluster model |
| 21 | // apply linux and salt.master salt.minion states afterwards to make sure |
| 22 | // correct cluster model is used. |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 23 | salt.enforceState(master, 'I@salt:master', ['reclass']) |
Tomáš Kukrál | b4d7522 | 2017-06-06 10:36:02 +0200 | [diff] [blame] | 24 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 25 | salt.enforceState(master, 'I@salt:master', ['linux.system']) |
Vasyl Saienko | 0869b3a | 2017-11-22 14:37:57 +0200 | [diff] [blame] | 26 | salt.enforceState(master, 'I@salt:master', ['salt.master'], true, false, null, false, 120, 2) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 27 | salt.fullRefresh(master, "*") |
Tomáš Kukrál | b4d7522 | 2017-06-06 10:36:02 +0200 | [diff] [blame] | 28 | |
Vasyl Saienko | e36ab7c | 2017-07-17 14:35:48 +0300 | [diff] [blame] | 29 | salt.enforceState(master, 'I@salt:master', ['salt.minion'], true, false, null, false, 60, 2) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 30 | salt.enforceState(master, 'I@salt:master', ['salt.minion']) |
| 31 | salt.fullRefresh(master, "*") |
Tomáš Kukrál | b4d7522 | 2017-06-06 10:36:02 +0200 | [diff] [blame] | 32 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 33 | salt.enforceState(master, '*', ['linux.system']) |
Jiri Broulik | 8e1f1fe | 2017-12-13 11:54:06 +0100 | [diff] [blame] | 34 | if (staticMgmtNet) { |
| 35 | salt.runSaltProcessStep(master, '*', 'cmd.shell', ["salt-call state.sls linux.network; salt-call service.restart salt-minion"], null, true, 60) |
| 36 | } |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 37 | salt.enforceState(master, 'I@linux:system', ['linux', 'openssh', 'ntp']) |
Tomáš Kukrál | 7e767f9 | 2017-08-18 14:53:17 +0200 | [diff] [blame] | 38 | salt.enforceState(master, '*', ['salt.minion'], true, false, null, false, 60, 2) |
Jakub Josef | 4f8f4df | 2017-09-01 14:32:42 +0200 | [diff] [blame] | 39 | sleep(5) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 40 | salt.enforceState(master, '*', ['linux.network.host']) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 41 | } |
| 42 | |
Jiri Broulik | 8e1f1fe | 2017-12-13 11:54:06 +0100 | [diff] [blame] | 43 | def installFoundationInfraOnTarget(master, target, staticMgmtNet=false) { |
Jiri Broulik | 976bf6c | 2017-10-20 14:43:25 +0200 | [diff] [blame] | 44 | def salt = new com.mirantis.mk.Salt() |
| 45 | |
| 46 | salt.enforceState(master, 'I@salt:master', ['reclass'], true, false, null, false, 120, 2) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 47 | salt.fullRefresh(master, target) |
| 48 | salt.enforceState(master, target, ['linux.system']) |
Jiri Broulik | 8e1f1fe | 2017-12-13 11:54:06 +0100 | [diff] [blame] | 49 | if (staticMgmtNet) { |
| 50 | salt.runSaltProcessStep(master, target, 'cmd.shell', ["salt-call state.sls linux.network; salt-call service.restart salt-minion"], null, true, 60) |
| 51 | } |
Jiri Broulik | 976bf6c | 2017-10-20 14:43:25 +0200 | [diff] [blame] | 52 | salt.enforceState(master, target, ['salt.minion'], true, false, null, false, 60, 2) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 53 | salt.enforceState(master, target, ['salt.minion']) |
Jiri Broulik | 976bf6c | 2017-10-20 14:43:25 +0200 | [diff] [blame] | 54 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 55 | salt.enforceState(master, target, ['linux', 'openssh', 'ntp']) |
Jiri Broulik | 976bf6c | 2017-10-20 14:43:25 +0200 | [diff] [blame] | 56 | sleep(5) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 57 | salt.enforceState(master, target, ['linux.network.host']) |
Jiri Broulik | 976bf6c | 2017-10-20 14:43:25 +0200 | [diff] [blame] | 58 | } |
| 59 | |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 60 | def installInfraKvm(master) { |
| 61 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 62 | salt.fullRefresh(master, 'I@linux:system') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 63 | |
Richard Felkl | 286f25f | 2017-07-26 14:23:55 +0200 | [diff] [blame] | 64 | salt.enforceState(master, 'I@salt:control', ['salt.minion'], true, false, null, false, 60, 2) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 65 | salt.enforceState(master, 'I@salt:control', ['linux.system', 'linux.network', 'ntp']) |
| 66 | salt.enforceState(master, 'I@salt:control', 'libvirt') |
| 67 | salt.enforceState(master, 'I@salt:control', 'salt.control') |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 68 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 69 | sleep(600) |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 70 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 71 | salt.fullRefresh(master, '* and not kvm*') |
Tomáš Kukrál | 8d2be5a | 2017-02-28 11:22:29 +0100 | [diff] [blame] | 72 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 73 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 74 | def installInfra(master) { |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 75 | def common = new com.mirantis.mk.Common() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 76 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 77 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 78 | // Install glusterfs |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 79 | if (salt.testTarget(master, 'I@glusterfs:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 80 | salt.enforceState(master, 'I@glusterfs:server', 'glusterfs.server.service') |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 81 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 82 | salt.enforceState(master, 'I@glusterfs:server and *01*', 'glusterfs.server.setup', true, true, null, false, -1, 5) |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 83 | sleep(10) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 84 | salt.cmdRun(master, 'I@glusterfs:server', "gluster peer status; gluster volume status") |
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')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 89 | salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client') |
Oleg Grigorov | 26c8a6c | 2017-08-17 18:54:02 +0300 | [diff] [blame] | 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')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 94 | salt.enforceState(master, 'I@galera:master', 'galera', true, true, null, false, -1, 2) |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 95 | |
| 96 | // Check galera status |
| 97 | salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status') |
| 98 | salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status') |
Vasyl Saienko | c1fb989 | 2017-07-13 14:54:13 +0300 | [diff] [blame] | 99 | // If galera is not enabled check if we need to install mysql:server |
| 100 | } else if (salt.testTarget(master, 'I@mysql:server')){ |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 101 | salt.enforceState(master, 'I@mysql:server', 'mysql.server') |
Vasyl Saienko | c1fb989 | 2017-07-13 14:54:13 +0300 | [diff] [blame] | 102 | if (salt.testTarget(master, 'I@mysql:client')){ |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 103 | salt.enforceState(master, 'I@mysql:client', 'mysql.client') |
Vasyl Saienko | c1fb989 | 2017-07-13 14:54:13 +0300 | [diff] [blame] | 104 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 105 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 106 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 107 | // Install docker |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 108 | if (salt.testTarget(master, 'I@docker:host')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 109 | salt.enforceState(master, 'I@docker:host', 'docker.host') |
Tomáš Kukrál | 0cf3ffb | 2017-09-03 10:18:18 +0200 | [diff] [blame] | 110 | salt.cmdRun(master, 'I@docker:host', 'docker ps') |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 111 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 112 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 113 | // Install keepalived |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 114 | if (salt.testTarget(master, 'I@keepalived:cluster')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 115 | salt.enforceState(master, 'I@keepalived:cluster and *01*', 'keepalived') |
| 116 | salt.enforceState(master, 'I@keepalived:cluster', 'keepalived') |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | // Install rabbitmq |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 120 | if (salt.testTarget(master, 'I@rabbitmq:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 121 | salt.enforceState(master, 'I@rabbitmq:server', 'rabbitmq', true, true, null, false, -1, 2) |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 122 | |
| 123 | // Check the rabbitmq status |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 124 | common.retry(3,5){ |
| 125 | salt.cmdRun(master, 'I@rabbitmq:server', 'rabbitmqctl cluster_status') |
| 126 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 127 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 128 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 129 | // Install haproxy |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 130 | if (salt.testTarget(master, 'I@haproxy:proxy')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 131 | salt.enforceState(master, 'I@haproxy:proxy', 'haproxy') |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 132 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
| 133 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.restart', ['rsyslog']) |
| 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 memcached |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 137 | if (salt.testTarget(master, 'I@memcached:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 138 | salt.enforceState(master, 'I@memcached:server', 'memcached') |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | // Install etcd |
Tomáš Kukrál | d0cf7ec | 2017-07-13 11:29:20 +0200 | [diff] [blame] | 142 | if (salt.testTarget(master, 'I@etcd:server')) { |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 143 | salt.enforceState(master, 'I@etcd:server', 'etcd.server.service') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 144 | common.retry(3,5){ |
| 145 | salt.cmdRun(master, 'I@etcd:server', '. /var/lib/etcd/configenv && etcdctl cluster-health') |
| 146 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 147 | } |
Mykyta Karpin | 8185e4a | 2018-02-23 19:15:48 +0200 | [diff] [blame] | 148 | |
| 149 | // Install redis |
| 150 | if (salt.testTarget(master, 'I@redis:server')) { |
| 151 | if (salt.testTarget(master, 'I@redis:cluster:role:master')) { |
| 152 | salt.enforceState(master, 'I@redis:cluster:role:master', 'redis') |
| 153 | } |
| 154 | salt.enforceState(master, 'I@redis:server', 'redis') |
| 155 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | def installOpenstackInfra(master) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 159 | def common = new com.mirantis.mk.Common() |
| 160 | common.warningMsg("You calling orchestrate.installOpenstackInfra(). This function is deprecated please use orchestrate.installInfra() directly") |
| 161 | installInfra(master) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 165 | def installOpenstackControl(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 166 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 167 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 168 | |
| 169 | // Install horizon dashboard |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 170 | if (salt.testTarget(master, 'I@horizon:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 171 | salt.enforceState(master, 'I@horizon:server', 'horizon') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 172 | } |
| 173 | if (salt.testTarget(master, 'I@nginx:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 174 | salt.enforceState(master, 'I@nginx:server', 'salt.minion') |
| 175 | salt.enforceState(master, 'I@nginx:server', 'nginx') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 176 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 177 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 178 | // setup keystone service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 179 | if (salt.testTarget(master, 'I@keystone:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 180 | salt.enforceState(master, 'I@keystone:server and *01*', 'keystone.server') |
| 181 | salt.enforceState(master, 'I@keystone:server', 'keystone.server') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 182 | // populate keystone services/tenants/roles/users |
Tomáš Kukrál | 926e633 | 2017-03-02 09:23:03 +0100 | [diff] [blame] | 183 | |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 184 | // keystone:client must be called locally |
| 185 | //salt.runSaltProcessStep(master, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true) |
| 186 | salt.runSaltProcessStep(master, 'I@keystone:server', 'service.restart', ['apache2']) |
| 187 | sleep(30) |
| 188 | } |
| 189 | if (salt.testTarget(master, 'I@keystone:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 190 | salt.enforceState(master, 'I@keystone:client and *01*', 'keystone.client') |
| 191 | salt.enforceState(master, 'I@keystone:client', 'keystone.client') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 192 | } |
| 193 | if (salt.testTarget(master, 'I@keystone:server')) { |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 194 | common.retry(3,5){ |
| 195 | salt.cmdRun(master, 'I@keystone:server', '. /root/keystonercv3; openstack service list') |
| 196 | } |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 197 | } |
Tomáš Kukrál | 926e633 | 2017-03-02 09:23:03 +0100 | [diff] [blame] | 198 | |
Oleg Grigorov | 26c8a6c | 2017-08-17 18:54:02 +0300 | [diff] [blame] | 199 | // Install glance |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 200 | if (salt.testTarget(master, 'I@glance:server')) { |
| 201 | //runSaltProcessStep(master, 'I@glance:server', 'state.sls', ['glance.server'], 1) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 202 | salt.enforceState(master, 'I@glance:server and *01*', 'glance.server') |
| 203 | salt.enforceState(master, 'I@glance:server', 'glance.server') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 204 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 205 | |
Oleg Grigorov | 26c8a6c | 2017-08-17 18:54:02 +0300 | [diff] [blame] | 206 | // Check glance service |
| 207 | if (salt.testTarget(master, 'I@glance:server')){ |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 208 | common.retry(3,5){ |
Oleg Iurchenko | 01410f2 | 2018-02-22 22:18:21 +0200 | [diff] [blame^] | 209 | salt.cmdRun(master, 'I@keystone:server','. /root/keystonercv3; glance image-list') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 210 | } |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 211 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 212 | |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 213 | // Create glance resources |
| 214 | if (salt.testTarget(master, 'I@glance:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 215 | salt.enforceState(master, 'I@glance:client', 'glance.client') |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 216 | } |
| 217 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 218 | // Install and check nova service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 219 | if (salt.testTarget(master, 'I@nova:controller')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 220 | // run on first node first |
| 221 | salt.enforceState(master, 'I@nova:controller and *01*', 'nova.controller') |
| 222 | salt.enforceState(master, 'I@nova:controller', 'nova.controller') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 223 | if (salt.testTarget(master, 'I@keystone:server')) { |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 224 | common.retry(3,5){ |
Oleg Iurchenko | 01410f2 | 2018-02-22 22:18:21 +0200 | [diff] [blame^] | 225 | salt.cmdRun(master, 'I@keystone:server', '. /root/keystonercv3; nova service-list') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 226 | } |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 227 | } |
| 228 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 229 | |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 230 | // Create nova resources |
| 231 | if (salt.testTarget(master, 'I@nova:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 232 | salt.enforceState(master, 'I@nova:client', 'nova.client') |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 233 | } |
| 234 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 235 | // Install and check cinder service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 236 | if (salt.testTarget(master, 'I@cinder:controller')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 237 | // run on first node first |
| 238 | salt.enforceState(master, 'I@cinder:controller and *01*', 'cinder') |
| 239 | salt.enforceState(master, 'I@cinder:controller', 'cinder') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 240 | if (salt.testTarget(master, 'I@keystone:server')) { |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 241 | common.retry(3,5){ |
Oleg Iurchenko | 01410f2 | 2018-02-22 22:18:21 +0200 | [diff] [blame^] | 242 | salt.cmdRun(master, 'I@keystone:server', '. /root/keystonercv3; cinder list') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 243 | } |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 244 | } |
| 245 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 246 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 247 | // Install neutron service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 248 | if (salt.testTarget(master, 'I@neutron:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 249 | // run on first node first |
| 250 | salt.enforceState(master, 'I@neutron:server and *01*', 'neutron.server') |
| 251 | salt.enforceState(master, 'I@neutron:server', 'neutron.server') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 252 | if (salt.testTarget(master, 'I@keystone:server')) { |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 253 | common.retry(3,5){ |
Oleg Iurchenko | 01410f2 | 2018-02-22 22:18:21 +0200 | [diff] [blame^] | 254 | salt.cmdRun(master, 'I@keystone:server','. /root/keystonercv3; neutron agent-list') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 255 | } |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 256 | } |
| 257 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 258 | |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 259 | // Create neutron resources |
| 260 | if (salt.testTarget(master, 'I@neutron:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 261 | salt.enforceState(master, 'I@neutron:client', 'neutron.client') |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 262 | } |
| 263 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 264 | // Install heat service |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 265 | if (salt.testTarget(master, 'I@heat:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 266 | // run on first node first |
| 267 | salt.enforceState(master, 'I@heat:server and *01*', 'heat') |
| 268 | salt.enforceState(master, 'I@heat:server', 'heat') |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 269 | if (salt.testTarget(master, 'I@keystone:server')) { |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 270 | common.retry(3,5){ |
Oleg Iurchenko | 01410f2 | 2018-02-22 22:18:21 +0200 | [diff] [blame^] | 271 | salt.cmdRun(master, 'I@keystone:server', '. /root/keystonercv3; heat resource-type-list') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 272 | } |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 273 | } |
| 274 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 275 | |
| 276 | // Restart nova api |
Vasyl Saienko | 962e0b5 | 2017-07-11 10:49:19 +0300 | [diff] [blame] | 277 | if (salt.testTarget(master, 'I@nova:controller')) { |
| 278 | salt.runSaltProcessStep(master, 'I@nova:controller', 'service.restart', ['nova-api']) |
| 279 | } |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 280 | |
| 281 | // Install ironic service |
| 282 | if (salt.testTarget(master, 'I@ironic:api')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 283 | salt.enforceState(master, 'I@ironic:api and *01*', 'ironic.api') |
| 284 | salt.enforceState(master, 'I@ironic:api', 'ironic.api') |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 285 | } |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 286 | |
Vasyl Saienko | b7e4cdf | 2018-02-21 18:33:17 +0200 | [diff] [blame] | 287 | // Install manila service |
| 288 | if (salt.testTarget(master, 'I@manila:api')) { |
| 289 | salt.enforceState(master, 'I@manila:api and *01*', 'manila.api') |
| 290 | salt.enforceState(master, 'I@manila:api', 'manila.api') |
| 291 | } |
| 292 | if (salt.testTarget(master, 'I@manila:scheduler')) { |
| 293 | salt.enforceState(master, 'I@manila:scheduler', 'manila.scheduler') |
| 294 | } |
| 295 | |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 296 | // Install designate service |
| 297 | if (salt.testTarget(master, 'I@designate:server:enabled')) { |
| 298 | if (salt.testTarget(master, 'I@designate:server:backend:bind9')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 299 | salt.enforceState(master, 'I@bind:server', 'bind.server') |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 300 | } |
| 301 | if (salt.testTarget(master, 'I@designate:server:backend:pdns4')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 302 | salt.enforceState(master, 'I@powerdns:server', 'powerdns.server') |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 303 | } |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 304 | salt.enforceState(master, 'I@designate:server and *01*', 'designate.server') |
| 305 | salt.enforceState(master, 'I@designate:server', 'designate.server') |
Andrey Shestakov | 82c0b89 | 2017-07-24 18:46:21 +0300 | [diff] [blame] | 306 | } |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 307 | |
| 308 | // Install octavia api service |
| 309 | if (salt.testTarget(master, 'I@octavia:api')) { |
Marcin Iwinski | b1ac98e | 2018-02-08 10:16:49 +0100 | [diff] [blame] | 310 | salt.enforceState(master, 'I@octavia:api and *01*', 'octavia') |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 311 | salt.enforceState(master, 'I@octavia:api', 'octavia') |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 312 | } |
Marek Celoud | c9dd50f | 2017-08-28 13:54:40 +0200 | [diff] [blame] | 313 | |
Oleg Iurchenko | d0898c9 | 2017-12-14 14:28:44 +0200 | [diff] [blame] | 314 | // Install DogTag server service |
| 315 | if (salt.testTarget(master, 'I@dogtag:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 316 | salt.enforceState(master, 'I@dogtag:server and *01*', 'dogtag.server') |
| 317 | salt.enforceState(master, 'I@dogtag:server', 'dogtag.server') |
Oleg Iurchenko | d0898c9 | 2017-12-14 14:28:44 +0200 | [diff] [blame] | 318 | } |
| 319 | |
Marek Celoud | c9dd50f | 2017-08-28 13:54:40 +0200 | [diff] [blame] | 320 | // Install barbican server service |
| 321 | if (salt.testTarget(master, 'I@barbican:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 322 | salt.enforceState(master, 'I@barbican:server and *01*', 'barbican.server') |
| 323 | salt.enforceState(master, 'I@barbican:server', 'barbican.server') |
Marek Celoud | c9dd50f | 2017-08-28 13:54:40 +0200 | [diff] [blame] | 324 | } |
| 325 | // Install barbican client |
| 326 | if (salt.testTarget(master, 'I@barbican:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 327 | salt.enforceState(master, 'I@barbican:client', 'barbican.client') |
Marek Celoud | c9dd50f | 2017-08-28 13:54:40 +0200 | [diff] [blame] | 328 | } |
Ondrej Smola | 5908ae6 | 2018-01-08 13:42:08 +0100 | [diff] [blame] | 329 | |
Mykyta Karpin | 8185e4a | 2018-02-23 19:15:48 +0200 | [diff] [blame] | 330 | // Install gnocchi server |
| 331 | if (salt.testTarget(master, 'I@gnocchi:server')) { |
| 332 | salt.enforceState(master, 'I@gnocchi:server', 'gnocchi.server') |
| 333 | } |
| 334 | |
| 335 | // Install gnocchi statsd |
| 336 | if (salt.testTarget(master, 'I@gnocchi:statsd')) { |
| 337 | salt.enforceState(master, 'I@gnocchi:statsd', 'gnocchi.statsd') |
| 338 | } |
| 339 | |
| 340 | // Install panko server |
| 341 | if (salt.testTarget(master, 'I@panko:server')) { |
| 342 | salt.enforceState(master, 'I@panko:server', 'panko') |
| 343 | } |
| 344 | |
Ondrej Smola | 5908ae6 | 2018-01-08 13:42:08 +0100 | [diff] [blame] | 345 | // Install ceilometer server |
| 346 | if (salt.testTarget(master, 'I@ceilometer:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 347 | salt.enforceState(master, 'I@ceilometer:server', 'ceilometer') |
Ondrej Smola | 5908ae6 | 2018-01-08 13:42:08 +0100 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | // Install aodh server |
| 351 | if (salt.testTarget(master, 'I@aodh:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 352 | salt.enforceState(master, 'I@aodh:server', 'aodh') |
Ondrej Smola | 5908ae6 | 2018-01-08 13:42:08 +0100 | [diff] [blame] | 353 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 357 | def installIronicConductor(master){ |
| 358 | def salt = new com.mirantis.mk.Salt() |
| 359 | |
| 360 | if (salt.testTarget(master, 'I@ironic:conductor')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 361 | salt.enforceState(master, 'I@ironic:conductor', 'ironic.conductor') |
| 362 | salt.enforceState(master, 'I@ironic:conductor', 'apache') |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 363 | } |
| 364 | if (salt.testTarget(master, 'I@tftpd_hpa:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 365 | salt.enforceState(master, 'I@tftpd_hpa:server', 'tftpd_hpa') |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | if (salt.testTarget(master, 'I@nova:compute')) { |
| 369 | salt.runSaltProcessStep(master, 'I@nova:compute', 'service.restart', ['nova-compute']) |
| 370 | } |
| 371 | |
| 372 | if (salt.testTarget(master, 'I@baremetal_simulator:enabled')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 373 | salt.enforceState(master, 'I@baremetal_simulator:enabled', 'baremetal_simulator') |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 374 | } |
| 375 | if (salt.testTarget(master, 'I@ironic:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 376 | salt.enforceState(master, 'I@ironic:client', 'ironic.client') |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 377 | } |
| 378 | } |
| 379 | |
Vasyl Saienko | b7e4cdf | 2018-02-21 18:33:17 +0200 | [diff] [blame] | 380 | def installManilaShare(master){ |
| 381 | def salt = new com.mirantis.mk.Salt() |
| 382 | |
| 383 | if (salt.testTarget(master, 'I@manila:share')) { |
| 384 | salt.enforceState(master, 'I@manila:share', 'manila.share') |
| 385 | } |
| 386 | if (salt.testTarget(master, 'I@manila:data')) { |
| 387 | salt.enforceState(master, 'I@manila:data', 'manila.data') |
| 388 | } |
| 389 | |
| 390 | if (salt.testTarget(master, 'I@manila:client')) { |
| 391 | salt.enforceState(master, 'I@manila:client', 'manila.client') |
| 392 | } |
| 393 | } |
Vasyl Saienko | a7c10c0 | 2017-07-13 10:43:43 +0300 | [diff] [blame] | 394 | |
| 395 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 396 | def installOpenstackNetwork(master, physical = "false") { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 397 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 398 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 399 | salt.enforceHighstate(master, 'I@neutron:gateway') |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 400 | |
| 401 | // install octavia manager services |
| 402 | if (salt.testTarget(master, 'I@octavia:manager')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 403 | salt.runSaltProcessStep(master, 'I@salt:master', 'mine.update', ['*']) |
| 404 | salt.enforceState(master, 'I@octavia:manager', 'octavia') |
| 405 | salt.enforceState(master, 'I@octavia:manager', 'salt.minion.ca') |
| 406 | salt.enforceState(master, 'I@octavia:manager', 'salt.minion.cert') |
Elena Ezhova | 8d53bff | 2017-08-01 17:43:30 +0400 | [diff] [blame] | 407 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | |
| 411 | def installOpenstackCompute(master) { |
| 412 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 413 | // Configure compute nodes |
Sergio Lystopad | cd5b277 | 2018-02-09 14:37:10 +0200 | [diff] [blame] | 414 | if (salt.testTarget(master, 'I@nova:compute')) { |
| 415 | retry(2) { |
| 416 | salt.enforceHighstateWithExclude(master, 'I@nova:compute', 'opencontrail.client') |
| 417 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 418 | } |
| 419 | } |
| 420 | |
| 421 | |
| 422 | def installContrailNetwork(master) { |
Martin Polreich | fc9854c | 2017-06-30 11:17:36 +0200 | [diff] [blame] | 423 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 424 | def salt = new com.mirantis.mk.Salt() |
| 425 | |
| 426 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 427 | // Install opencontrail database services |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 428 | salt.enforceState(master, 'I@opencontrail:database and *01*', 'opencontrail.database') |
| 429 | salt.enforceState(master, 'I@opencontrail:database', 'opencontrail.database') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 430 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 431 | // Install opencontrail control services |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 432 | salt.enforceStateWithExclude(master, "I@opencontrail:control and *01*", "opencontrail", "opencontrail.client") |
| 433 | salt.enforceStateWithExclude(master, "I@opencontrail:control", "opencontrail", "opencontrail.client") |
| 434 | salt.enforceStateWithExclude(master, "I@opencontrail:collector and *01*", "opencontrail", "opencontrail.client") |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 435 | |
Marek Celoud | 443fb64 | 2017-11-22 15:07:12 +0100 | [diff] [blame] | 436 | if (salt.testTarget(master, 'I@docker:client and I@opencontrail:control')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 437 | salt.enforceState(master, 'I@opencontrail:control or I@opencontrail:collector', 'docker.client') |
Marek Celoud | 443fb64 | 2017-11-22 15:07:12 +0100 | [diff] [blame] | 438 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 442 | def installContrailCompute(master) { |
Tomáš Kukrál | 104a07a | 2017-07-13 12:19:11 +0200 | [diff] [blame] | 443 | def salt = new com.mirantis.mk.Salt() |
vrovachev | 32f7f54 | 2017-08-25 16:17:25 +0400 | [diff] [blame] | 444 | def common = new com.mirantis.mk.Common() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 445 | // Configure compute nodes |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 446 | // Provision opencontrail control services |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 447 | salt.enforceState(master, 'I@opencontrail:database:id:1', 'opencontrail.client') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 448 | // Provision opencontrail virtual routers |
Tomáš Kukrál | b8e9711 | 2017-03-01 16:03:16 +0100 | [diff] [blame] | 449 | |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 450 | // Generate script /usr/lib/contrail/if-vhost0 for up vhost0 |
Sergio Lystopad | cd5b277 | 2018-02-09 14:37:10 +0200 | [diff] [blame] | 451 | if (salt.testTarget(master, 'I@opencontrail:compute')) { |
| 452 | salt.enforceStateWithExclude(master, "I@opencontrail:compute", "opencontrail", "opencontrail.client") |
| 453 | } |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 454 | |
Sergio Lystopad | cd5b277 | 2018-02-09 14:37:10 +0200 | [diff] [blame] | 455 | if (salt.testTarget(master, 'I@nova:compute')) { |
| 456 | salt.cmdRun(master, 'I@nova:compute', 'exec 0>&-; exec 1>&-; exec 2>&-; nohup bash -c "ip link | grep vhost && echo no_reboot || sleep 5 && reboot & "', false) |
| 457 | } |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 458 | |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 459 | sleep(300) |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 460 | if (salt.testTarget(master, 'I@opencontrail:compute')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 461 | salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail.client') |
| 462 | salt.enforceState(master, 'I@opencontrail:compute', 'opencontrail') |
vrovachev | 4ff7730 | 2017-08-09 20:39:57 +0400 | [diff] [blame] | 463 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 467 | def installKubernetesInfra(master) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 468 | def common = new com.mirantis.mk.Common() |
| 469 | common.warningMsg("You calling orchestrate.installKubernetesInfra(). This function is deprecated please use orchestrate.installInfra() directly") |
| 470 | installInfra(master) |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | |
Tomáš Kukrál | c1a1bbc | 2017-04-28 21:16:25 +0200 | [diff] [blame] | 474 | def installKubernetesControl(master) { |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 475 | def salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 476 | |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 477 | // Install Kubernetes pool and Calico |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 478 | salt.enforceState(master, 'I@kubernetes:master', 'kubernetes.master.kube-addons') |
| 479 | salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 480 | |
Marek Celoud | 029391c | 2017-11-14 10:06:18 +0100 | [diff] [blame] | 481 | if (salt.testTarget(master, 'I@etcd:server:setup')) { |
| 482 | // Setup etcd server |
| 483 | salt.enforceState(master, 'I@kubernetes:master and *01*', 'etcd.server.setup') |
| 484 | } |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 485 | |
| 486 | // Run k8s without master.setup |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 487 | salt.enforceStateWithExclude(master, 'I@kubernetes:master', "kubernetes", "kubernetes.master.setup") |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 488 | |
| 489 | // Run k8s master setup |
Tomáš Kukrál | b05cf00 | 2017-05-02 11:05:43 +0200 | [diff] [blame] | 490 | salt.enforceState(master, 'I@kubernetes:master and *01*', 'kubernetes.master.setup') |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 491 | |
| 492 | // Restart kubelet |
| 493 | salt.runSaltProcessStep(master, 'I@kubernetes:pool', 'service.restart', ['kubelet']) |
| 494 | } |
| 495 | |
| 496 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 497 | def installKubernetesCompute(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 498 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 499 | salt.fullRefresh(master, "*") |
Tomáš Kukrál | e7e2896 | 2017-06-06 11:11:16 +0200 | [diff] [blame] | 500 | |
| 501 | // Bootstrap all nodes |
| 502 | salt.enforceState(master, 'I@kubernetes:pool', 'linux') |
| 503 | salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion') |
| 504 | salt.enforceState(master, 'I@kubernetes:pool', ['openssh', 'ntp']) |
| 505 | |
| 506 | // Create and distribute SSL certificates for services using salt state |
| 507 | salt.enforceState(master, 'I@kubernetes:pool', 'salt.minion.cert') |
| 508 | |
| 509 | // Install docker |
| 510 | salt.enforceState(master, 'I@docker:host', 'docker.host') |
| 511 | |
| 512 | // Install Kubernetes and Calico |
| 513 | salt.enforceState(master, 'I@kubernetes:pool', 'kubernetes.pool') |
| 514 | |
Yuriy Taraday | ab564d7 | 2017-10-11 15:14:35 +0400 | [diff] [blame] | 515 | // Install Tiller and all configured releases |
| 516 | if (salt.testTarget(master, 'I@helm:client')) { |
| 517 | salt.enforceState(master, 'I@helm:client', 'helm') |
| 518 | } |
Tomáš Kukrál | e7e2896 | 2017-06-06 11:11:16 +0200 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 522 | def installDockerSwarm(master) { |
| 523 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 79ecec3 | 2017-02-17 14:36:28 +0100 | [diff] [blame] | 524 | |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 525 | //Install and Configure Docker |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 526 | salt.enforceState(master, 'I@docker:swarm', 'docker.host') |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 527 | salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm') |
| 528 | salt.enforceState(master, 'I@docker:swarm', 'salt.minion.grains') |
| 529 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'mine.update') |
| 530 | salt.runSaltProcessStep(master, 'I@docker:swarm', 'saltutil.refresh_modules') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 531 | sleep(5) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 532 | salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm') |
| 533 | salt.enforceState(master, 'I@docker:swarm:role:manager', 'docker.swarm') |
Jakub Josef | 61463c7 | 2018-02-13 16:10:56 +0100 | [diff] [blame] | 534 | sleep(10) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 535 | salt.cmdRun(master, 'I@docker:swarm:role:master', 'docker node ls') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 536 | } |
| 537 | |
Jiri Broulik | b9a0c59 | 2017-09-05 16:41:48 +0200 | [diff] [blame] | 538 | |
| 539 | def installCicd(master) { |
| 540 | def salt = new com.mirantis.mk.Salt() |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 541 | salt.fullRefresh(master, 'I@jenkins:client or I@gerrit:client') |
Richard Felkl | 9d2cd92 | 2017-11-03 11:49:32 +0100 | [diff] [blame] | 542 | |
Richard Felkl | c1aba9b | 2018-01-02 09:25:20 +0100 | [diff] [blame] | 543 | if (salt.testTarget(master, 'I@aptly:publisher')) { |
| 544 | salt.enforceState(master, 'I@aptly:publisher', 'aptly.publisher',true, null, false, -1, 2) |
| 545 | } |
| 546 | |
Richard Felkl | 6de1676 | 2017-11-20 11:42:28 +0100 | [diff] [blame] | 547 | 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] | 548 | sleep(500) |
Richard Felkl | c1aba9b | 2018-01-02 09:25:20 +0100 | [diff] [blame] | 549 | |
| 550 | if (salt.testTarget(master, 'I@aptly:server')) { |
| 551 | salt.enforceState(master, 'I@aptly:server', 'aptly', true, true, null, false, -1, 2) |
| 552 | } |
| 553 | |
| 554 | if (salt.testTarget(master, 'I@openldap:client')) { |
| 555 | salt.enforceState(master, 'I@openldap:client', 'openldap', true, true, null, false, -1, 2) |
| 556 | } |
Richard Felkl | b6fdec9 | 2017-09-26 10:52:36 +0200 | [diff] [blame] | 557 | |
| 558 | if (salt.testTarget(master, 'I@python:environment')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 559 | salt.enforceState(master, 'I@python:environment', 'python') |
Richard Felkl | b6fdec9 | 2017-09-26 10:52:36 +0200 | [diff] [blame] | 560 | } |
Richard Felkl | c1aba9b | 2018-01-02 09:25:20 +0100 | [diff] [blame] | 561 | |
Richard Felkl | 6e208fc | 2017-12-08 10:18:44 +0100 | [diff] [blame] | 562 | withEnv(['ASK_ON_ERROR=false']){ |
| 563 | retry(2){ |
| 564 | try{ |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 565 | salt.enforceState(master, 'I@gerrit:client', 'gerrit') |
Richard Felkl | 6e208fc | 2017-12-08 10:18:44 +0100 | [diff] [blame] | 566 | }catch(e){ |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 567 | salt.fullRefresh(master, 'I@gerrit:client') |
Richard Felkl | 6e208fc | 2017-12-08 10:18:44 +0100 | [diff] [blame] | 568 | throw e //rethrow for retry handler |
| 569 | } |
| 570 | } |
| 571 | retry(2){ |
| 572 | try{ |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 573 | salt.enforceState(master, 'I@jenkins:client', 'jenkins') |
Richard Felkl | 6e208fc | 2017-12-08 10:18:44 +0100 | [diff] [blame] | 574 | }catch(e){ |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 575 | salt.fullRefresh(master, 'I@jenkins:client') |
Richard Felkl | 6e208fc | 2017-12-08 10:18:44 +0100 | [diff] [blame] | 576 | throw e //rethrow for retry handler |
| 577 | } |
| 578 | } |
| 579 | } |
Jiri Broulik | b9a0c59 | 2017-09-05 16:41:48 +0200 | [diff] [blame] | 580 | } |
| 581 | |
| 582 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 583 | def installStacklight(master) { |
| 584 | def common = new com.mirantis.mk.Common() |
| 585 | def salt = new com.mirantis.mk.Salt() |
| 586 | |
Simon Pasquier | ef4122c | 2017-08-25 15:52:07 +0200 | [diff] [blame] | 587 | // Install core services for K8S environments: |
| 588 | // HAProxy, Nginx and lusterFS clients |
| 589 | // In case of OpenStack, those are already installed |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 590 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
| 591 | salt.enforceState(master, 'I@haproxy:proxy', 'haproxy') |
| 592 | salt.runSaltProcessStep(master, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
Simon Pasquier | ef4122c | 2017-08-25 15:52:07 +0200 | [diff] [blame] | 593 | |
| 594 | if (salt.testTarget(master, 'I@nginx:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 595 | salt.enforceState(master, 'I@nginx:server', 'nginx') |
Simon Pasquier | ef4122c | 2017-08-25 15:52:07 +0200 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | if (salt.testTarget(master, 'I@glusterfs:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 599 | salt.enforceState(master, 'I@glusterfs:client', 'glusterfs.client') |
Simon Pasquier | ef4122c | 2017-08-25 15:52:07 +0200 | [diff] [blame] | 600 | } |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 601 | } |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 602 | |
| 603 | // Launch containers |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 604 | salt.enforceState(master, 'I@docker:swarm:role:master and I@prometheus:server', 'docker.client') |
| 605 | salt.runSaltProcessStep(master, 'I@docker:swarm and I@prometheus:server', 'dockerng.ps') |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 606 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 607 | //Install Telegraf |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 608 | salt.enforceState(master, 'I@telegraf:agent or I@telegraf:remote_agent', 'telegraf') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 609 | |
Dmitry Kalashnik | ebc1e1e | 2017-07-13 14:20:08 +0400 | [diff] [blame] | 610 | // Install Prometheus exporters |
| 611 | if (salt.testTarget(master, 'I@prometheus:exporters')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 612 | salt.enforceState(master, 'I@prometheus:exporters', 'prometheus') |
Dmitry Kalashnik | ebc1e1e | 2017-07-13 14:20:08 +0400 | [diff] [blame] | 613 | } |
| 614 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 615 | //Install Elasticsearch and Kibana |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 616 | salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server') |
| 617 | salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server') |
| 618 | salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server') |
| 619 | salt.enforceState(master, 'I@kibana:server', 'kibana.server') |
| 620 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client') |
| 621 | salt.enforceState(master, 'I@kibana:client', 'kibana.client') |
| 622 | salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb') |
| 623 | salt.enforceState(master, 'I@influxdb:server', 'influxdb') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 624 | |
Ildar Svetlov | 794f89e | 2018-02-14 16:28:53 +0400 | [diff] [blame] | 625 | // Install service for the log collection |
| 626 | if (salt.testTarget(master, 'I@fluentd:agent')) { |
| 627 | salt.enforceState(master, 'I@fluentd:agent', 'fluentd') |
| 628 | } else { |
| 629 | salt.enforceState(master, 'I@heka:log_collector', 'heka.log_collector') |
| 630 | } |
Simon Pasquier | 6301ddd | 2017-09-05 11:56:58 +0200 | [diff] [blame] | 631 | |
Ondrej Smola | 5908ae6 | 2018-01-08 13:42:08 +0100 | [diff] [blame] | 632 | // Install heka ceilometer collector |
| 633 | if (salt.testTarget(master, 'I@heka:ceilometer_collector:enabled')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 634 | salt.enforceState(master, 'I@heka:ceilometer_collector:enabled', 'heka.ceilometer_collector') |
Ondrej Smola | 5908ae6 | 2018-01-08 13:42:08 +0100 | [diff] [blame] | 635 | salt.runSaltProcessStep(master, 'I@heka:ceilometer_collector:enabled', 'service.restart', ['ceilometer_collector'], null, true) |
| 636 | } |
| 637 | |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 638 | // Install galera |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 639 | if (common.checkContains('STACK_INSTALL', 'k8s')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 640 | salt.enforceState(master, 'I@galera:master', 'galera', true, true, null, false, -1, 2) |
| 641 | salt.enforceState(master, 'I@galera:slave', 'galera') |
Martin Polreich | 406f646 | 2017-07-11 11:33:42 +0000 | [diff] [blame] | 642 | |
Martin Polreich | 792f266 | 2017-07-11 13:36:32 +0200 | [diff] [blame] | 643 | // Check galera status |
| 644 | salt.runSaltProcessStep(master, 'I@galera:master', 'mysql.status') |
| 645 | salt.runSaltProcessStep(master, 'I@galera:slave', 'mysql.status') |
| 646 | } |
Martin Polreich | 470925a | 2017-07-06 17:12:59 +0200 | [diff] [blame] | 647 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 648 | //Collect Grains |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 649 | salt.enforceState(master, 'I@salt:minion', 'salt.minion.grains') |
| 650 | salt.runSaltProcessStep(master, 'I@salt:minion', 'saltutil.refresh_modules') |
| 651 | salt.runSaltProcessStep(master, 'I@salt:minion', 'mine.update') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 652 | sleep(5) |
| 653 | |
Ildar Svetlov | 794f89e | 2018-02-14 16:28:53 +0400 | [diff] [blame] | 654 | // Configure Prometheus in Docker Swarm |
| 655 | salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'prometheus', true, false) |
| 656 | |
Ildar Svetlov | 0eec97d | 2018-02-15 10:06:40 +0400 | [diff] [blame] | 657 | //Configure Remote Collector in Docker Swarm for Openstack deployments |
Ildar Svetlov | 794f89e | 2018-02-14 16:28:53 +0400 | [diff] [blame] | 658 | if (!common.checkContains('STACK_INSTALL', 'k8s')) { |
Ildar Svetlov | 0eec97d | 2018-02-15 10:06:40 +0400 | [diff] [blame] | 659 | salt.enforceState(master, 'I@docker:swarm and I@prometheus:server', 'heka.remote_collector', true, false) |
Martin Polreich | 8017f45 | 2017-08-21 16:01:42 +0200 | [diff] [blame] | 660 | } |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 661 | |
| 662 | //Configure Grafana |
Martin Polreich | 305e222 | 2017-07-06 11:33:00 +0200 | [diff] [blame] | 663 | def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 664 | common.prettyPrint(pillar) |
Martin Polreich | 595baef | 2017-07-04 16:11:04 +0200 | [diff] [blame] | 665 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 666 | def stacklight_vip |
| 667 | if(!pillar['return'].isEmpty()) { |
| 668 | stacklight_vip = pillar['return'][0].values()[0] |
| 669 | } else { |
| 670 | common.errorMsg('[ERROR] Stacklight VIP address could not be retrieved') |
| 671 | } |
vrovachev | 1c4770b | 2017-07-05 13:25:21 +0400 | [diff] [blame] | 672 | |
Martin Polreich | 305e222 | 2017-07-06 11:33:00 +0200 | [diff] [blame] | 673 | common.infoMsg("Waiting for service on http://${stacklight_vip}:15013/ to start") |
Martin Polreich | bd7ad22 | 2017-07-06 12:53:51 +0200 | [diff] [blame] | 674 | sleep(120) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 675 | salt.enforceState(master, 'I@grafana:client', 'grafana.client') |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | def installStacklightv1Control(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 679 | def salt = new com.mirantis.mk.Salt() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 680 | |
| 681 | // infra install |
| 682 | // Install the StackLight backends |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 683 | salt.enforceState(master, '*01* and I@elasticsearch:server', 'elasticsearch.server') |
| 684 | salt.enforceState(master, 'I@elasticsearch:server', 'elasticsearch.server') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 685 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 686 | salt.enforceState(master, '*01* and I@influxdb:server', 'influxdb') |
| 687 | salt.enforceState(master, 'I@influxdb:server', 'influxdb') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 688 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 689 | salt.enforceState(master, '*01* and I@kibana:server', 'kibana.server') |
| 690 | salt.enforceState(master, 'I@kibana:server', 'kibana.server') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 691 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 692 | salt.enforceState(master, '*01* and I@grafana:server','grafana.server') |
| 693 | salt.enforceState(master, 'I@grafana:server','grafana.server') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 694 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 695 | def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service') |
| 696 | def alarming_service = alarming_service_pillar['return'][0].values()[0] |
| 697 | |
| 698 | switch (alarming_service) { |
| 699 | case 'sensu': |
| 700 | // Update Sensu |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 701 | salt.enforceState(master, 'I@sensu:server and I@rabbitmq:server', 'rabbitmq') |
| 702 | salt.enforceState(master, 'I@redis:cluster:role:master', 'redis') |
| 703 | salt.enforceState(master, 'I@redis:server', 'redis') |
| 704 | salt.enforceState(master, 'I@sensu:server', 'sensu') |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 705 | default: |
| 706 | // Update Nagios |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 707 | salt.enforceState(master, 'I@nagios:server', 'nagios.server') |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 708 | // Stop the Nagios service because the package starts it by default and it will |
| 709 | // started later only on the node holding the VIP address |
| 710 | salt.runSaltProcessStep(master, 'I@nagios:server', 'service.stop', ['nagios3'], null, true) |
| 711 | } |
| 712 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 713 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client.service') |
| 714 | salt.enforceState(master, 'I@kibana:client', 'kibana.client') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 715 | |
| 716 | sleep(10) |
| 717 | } |
| 718 | |
Martin Polreich | 8663a34 | 2017-06-30 17:33:08 +0200 | [diff] [blame] | 719 | def installStacklightv1Client(master) { |
Tomáš Kukrál | a53b535 | 2017-05-04 11:45:53 +0200 | [diff] [blame] | 720 | def salt = new com.mirantis.mk.Salt() |
| 721 | def common = new com.mirantis.mk.Common() |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 722 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 723 | salt.cmdRun(master, 'I@elasticsearch:client', 'salt-call state.sls elasticsearch.client') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 724 | // salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client', true) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 725 | salt.cmdRun(master, 'I@kibana:client', 'salt-call state.sls kibana.client') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 726 | // salt.enforceState(master, 'I@kibana:client', 'kibana.client', true) |
| 727 | |
| 728 | // Install collectd, heka and sensu services on the nodes, this will also |
| 729 | // generate the metadata that goes into the grains and eventually into Salt Mine |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 730 | salt.enforceState(master, '*', 'collectd') |
| 731 | salt.enforceState(master, '*', 'salt.minion') |
| 732 | salt.enforceState(master, '*', 'heka') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 733 | |
| 734 | // Gather the Grafana metadata as grains |
| 735 | salt.enforceState(master, 'I@grafana:collector', 'grafana.collector', true) |
| 736 | |
| 737 | // Update Salt Mine |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 738 | salt.enforceState(master, '*', 'salt.minion.grains') |
| 739 | salt.runSaltProcessStep(master, '*', 'saltutil.refresh_modules') |
| 740 | salt.runSaltProcessStep(master, '*', 'mine.update') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 741 | |
| 742 | sleep(5) |
| 743 | |
| 744 | // Update Heka |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 745 | salt.enforceState(master, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 746 | |
| 747 | // Update collectd |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 748 | salt.enforceState(master, 'I@collectd:remote_client:enabled:True', 'collectd') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 749 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 750 | def alarming_service_pillar = salt.getPillar(master, 'mon*01*', '_param:alarming_service') |
| 751 | def alarming_service = alarming_service_pillar['return'][0].values()[0] |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 752 | |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 753 | switch (alarming_service) { |
| 754 | case 'sensu': |
| 755 | // Update Sensu |
| 756 | // TODO for stacklight team, should be fixed in model |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 757 | salt.enforceState(master, 'I@sensu:client', 'sensu') |
Kalynovskyi | 3e37011 | 2017-06-26 12:48:23 +0300 | [diff] [blame] | 758 | default: |
| 759 | break |
| 760 | // Default is nagios, and was enforced in installStacklightControl() |
| 761 | } |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 762 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 763 | salt.cmdRun(master, 'I@grafana:client and *01*', 'salt-call state.sls grafana.client') |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 764 | // salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client', true) |
| 765 | |
Marek Celoud | d200cad | 2017-06-07 10:34:46 +0200 | [diff] [blame] | 766 | // Finalize the configuration of Grafana (add the dashboards...) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 767 | salt.enforceState(master, 'I@grafana:client and *01*', 'grafana.client') |
| 768 | salt.enforceState(master, 'I@grafana:client and *02*', 'grafana.client') |
| 769 | salt.enforceState(master, 'I@grafana:client and *03*', 'grafana.client') |
Marek Celoud | d200cad | 2017-06-07 10:34:46 +0200 | [diff] [blame] | 770 | // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10 |
| 771 | |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 772 | // Get the StackLight monitoring VIP addres |
| 773 | //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}') |
| 774 | //vip=${vip:=172.16.10.253} |
| 775 | def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address') |
Jakub Josef | bceaa32 | 2017-06-13 18:28:27 +0200 | [diff] [blame] | 776 | common.prettyPrint(pillar) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 777 | def stacklight_vip = pillar['return'][0].values()[0] |
| 778 | |
| 779 | if (stacklight_vip) { |
| 780 | // (re)Start manually the services that are bound to the monitoring VIP |
| 781 | common.infoMsg("restart services on node with IP: ${stacklight_vip}") |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 782 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd']) |
| 783 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector']) |
| 784 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator']) |
| 785 | salt.runSaltProcessStep(master, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3']) |
Ales Komarek | ef2bab6 | 2017-04-26 11:48:28 +0200 | [diff] [blame] | 786 | } else { |
| 787 | throw new Exception("Missing stacklight_vip") |
| 788 | } |
Tomáš Kukrál | f06ca0f | 2017-02-27 15:18:50 +0100 | [diff] [blame] | 789 | } |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 790 | |
| 791 | |
| 792 | // |
| 793 | // Ceph |
| 794 | // |
| 795 | |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 796 | def installCephMon(master, target='I@ceph:mon') { |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 797 | def salt = new com.mirantis.mk.Salt() |
| 798 | |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 799 | salt.enforceState(master, 'I@ceph:common', 'salt.minion.grains') |
Jiri Broulik | bfc234f | 2017-10-17 15:45:38 +0200 | [diff] [blame] | 800 | |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 801 | // generate keyrings |
| 802 | if (salt.testTarget(master, 'I@ceph:mon:keyring:mon or I@ceph:common:keyring:admin')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 803 | salt.enforceState(master, 'I@ceph:mon:keyring:mon or I@ceph:common:keyring:admin', 'ceph.mon') |
| 804 | salt.runSaltProcessStep(master, 'I@ceph:mon', 'saltutil.sync_grains') |
| 805 | salt.runSaltProcessStep(master, 'I@ceph:mon:keyring:mon or I@ceph:common:keyring:admin', 'mine.update') |
Jiri Broulik | 3c75a6d | 2017-10-06 18:44:37 +0200 | [diff] [blame] | 806 | sleep(5) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 807 | } |
Ondrej Smola | fd5c235 | 2017-08-11 14:25:39 +0200 | [diff] [blame] | 808 | // install Ceph Mons |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 809 | salt.enforceState(master, target, 'ceph.mon') |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 810 | if (salt.testTarget(master, 'I@ceph:mgr')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 811 | salt.enforceState(master, 'I@ceph:mgr', 'ceph.mgr') |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 812 | } |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 813 | } |
| 814 | |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 815 | def installCephOsd(master, target='I@ceph:osd', setup=true) { |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 816 | def salt = new com.mirantis.mk.Salt() |
| 817 | |
| 818 | // install Ceph OSDs |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 819 | salt.enforceState(master, target, 'ceph.osd') |
| 820 | salt.runSaltProcessStep(master, 'I@ceph:osd', 'saltutil.sync_grains') |
| 821 | salt.enforceState(master, target, 'ceph.osd.custom') |
| 822 | salt.runSaltProcessStep(master, 'I@ceph:osd', 'saltutil.sync_grains') |
| 823 | salt.runSaltProcessStep(master, 'I@ceph:osd', 'mine.update') |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 824 | |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 825 | // setup pools, keyrings and maybe crush |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 826 | if (salt.testTarget(master, 'I@ceph:setup') && setup) { |
Jiri Broulik | 07f8de7 | 2017-10-09 14:12:17 +0200 | [diff] [blame] | 827 | sleep(5) |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 828 | salt.enforceState(master, 'I@ceph:setup', 'ceph.setup') |
Tomáš Kukrál | ed27a47 | 2017-08-29 10:26:25 +0200 | [diff] [blame] | 829 | } |
Tomáš Kukrál | 64f8e1c | 2017-08-11 10:32:20 +0200 | [diff] [blame] | 830 | } |
Tomáš Kukrál | 1e5b219 | 2017-08-15 16:58:18 +0200 | [diff] [blame] | 831 | |
Tomáš Kukrál | 5836e3d | 2017-08-25 18:20:55 +0200 | [diff] [blame] | 832 | def installCephClient(master) { |
Tomáš Kukrál | 1e5b219 | 2017-08-15 16:58:18 +0200 | [diff] [blame] | 833 | def salt = new com.mirantis.mk.Salt() |
| 834 | |
| 835 | // install Ceph Radosgw |
Tomáš Kukrál | 5836e3d | 2017-08-25 18:20:55 +0200 | [diff] [blame] | 836 | if (salt.testTarget(master, 'I@ceph:radosgw')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 837 | salt.runSaltProcessStep(master, 'I@ceph:radosgw', 'saltutil.sync_grains') |
| 838 | salt.enforceState(master, 'I@ceph:radosgw', 'ceph.radosgw') |
Alexander Noskov | 229035f | 2017-12-06 00:10:20 +0400 | [diff] [blame] | 839 | } |
| 840 | // setup Keystone service and endpoints for swift or / and S3 |
| 841 | if (salt.testTarget(master, 'I@keystone:client')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 842 | salt.enforceState(master, 'I@keystone:client', 'keystone.client') |
Tomáš Kukrál | 5836e3d | 2017-08-25 18:20:55 +0200 | [diff] [blame] | 843 | } |
Tomáš Kukrál | 1e5b219 | 2017-08-15 16:58:18 +0200 | [diff] [blame] | 844 | } |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 845 | |
| 846 | def connectCeph(master) { |
| 847 | def salt = new com.mirantis.mk.Salt() |
| 848 | |
| 849 | // connect Ceph to the env |
| 850 | if (salt.testTarget(master, 'I@ceph:common and I@glance:server')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 851 | salt.enforceState(master, 'I@ceph:common and I@glance:server', ['ceph.common', 'ceph.setup.keyring', 'glance']) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 852 | salt.runSaltProcessStep(master, 'I@ceph:common and I@glance:server', 'service.restart', ['glance-api', 'glance-glare', 'glance-registry']) |
| 853 | } |
| 854 | if (salt.testTarget(master, 'I@ceph:common and I@cinder:controller')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 855 | salt.enforceState(master, 'I@ceph:common and I@cinder:controller', ['ceph.common', 'ceph.setup.keyring', 'cinder']) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 856 | } |
| 857 | if (salt.testTarget(master, 'I@ceph:common and I@nova:compute')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 858 | salt.enforceState(master, 'I@ceph:common and I@nova:compute', ['ceph.common', 'ceph.setup.keyring']) |
| 859 | salt.runSaltProcessStep(master, 'I@ceph:common and I@nova:compute', 'saltutil.sync_grains') |
| 860 | salt.enforceState(master, 'I@ceph:common and I@nova:compute', ['nova']) |
Jiri Broulik | e57a024 | 2017-10-06 13:38:47 +0200 | [diff] [blame] | 861 | } |
| 862 | } |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 863 | |
| 864 | def installOssInfra(master) { |
| 865 | def common = new com.mirantis.mk.Common() |
| 866 | def salt = new com.mirantis.mk.Salt() |
| 867 | |
Mikhail Ivanov | 788996c | 2017-12-15 14:28:57 +0400 | [diff] [blame] | 868 | if (!common.checkContains('STACK_INSTALL', 'k8s') || !common.checkContains('STACK_INSTALL', 'openstack')) { |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 869 | def orchestrate = new com.mirantis.mk.Orchestrate() |
| 870 | orchestrate.installInfra(master) |
| 871 | } |
| 872 | |
| 873 | if (salt.testTarget(master, 'I@devops_portal:config')) { |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 874 | salt.enforceState(master, 'I@devops_portal:config', 'devops_portal.config') |
| 875 | salt.enforceState(master, 'I@rundeck:client', ['linux.system.user', 'openssh']) |
| 876 | salt.enforceState(master, 'I@rundeck:server', 'rundeck.server') |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 877 | } |
| 878 | } |
| 879 | |
| 880 | def installOss(master) { |
| 881 | def common = new com.mirantis.mk.Common() |
| 882 | def salt = new com.mirantis.mk.Salt() |
| 883 | |
| 884 | //Get oss VIP address |
| 885 | def pillar = salt.getPillar(master, 'cfg01*', '_param:stacklight_monitor_address') |
| 886 | common.prettyPrint(pillar) |
| 887 | |
| 888 | def oss_vip |
| 889 | if(!pillar['return'].isEmpty()) { |
| 890 | oss_vip = pillar['return'][0].values()[0] |
| 891 | } else { |
| 892 | common.errorMsg('[ERROR] Oss VIP address could not be retrieved') |
| 893 | } |
| 894 | |
| 895 | // Postgres client - initialize OSS services databases |
| 896 | timeout(120){ |
| 897 | common.infoMsg("Waiting for postgresql database to come up..") |
Nikolas Britton | 4f62a09 | 2018-02-06 16:56:26 -0600 | [diff] [blame] | 898 | salt.cmdRun(master, 'I@postgresql:client', 'while true; do if docker service logs postgresql_postgresql-db 2>&1 | grep "ready to accept"; then break; else sleep 5; fi; done') |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 899 | } |
| 900 | // XXX: first run usually fails on some inserts, but we need to create databases at first |
| 901 | salt.enforceState(master, 'I@postgresql:client', 'postgresql.client', true, false) |
| 902 | |
| 903 | // Setup postgres database with integration between |
| 904 | // Pushkin notification service and Security Monkey security audit service |
| 905 | timeout(10) { |
| 906 | common.infoMsg("Waiting for Pushkin to come up..") |
| 907 | salt.cmdRun(master, 'I@postgresql:client', "while true; do curl -sf ${oss_vip}:8887/apps >/dev/null && break; done") |
| 908 | } |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 909 | salt.enforceState(master, 'I@postgresql:client', 'postgresql.client') |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 910 | |
| 911 | // Rundeck |
| 912 | timeout(10) { |
| 913 | common.infoMsg("Waiting for Rundeck to come up..") |
| 914 | salt.cmdRun(master, 'I@rundeck:client', "while true; do curl -sf ${oss_vip}:4440 >/dev/null && break; done") |
| 915 | } |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 916 | salt.enforceState(master, 'I@rundeck:client', 'rundeck.client') |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 917 | |
| 918 | // Elasticsearch |
Mikhail Ivanov | fcd55d6 | 2017-12-19 16:51:35 +0400 | [diff] [blame] | 919 | pillar = salt.getPillar(master, 'I@elasticsearch:client', 'elasticsearch:client:server:host') |
| 920 | def elasticsearch_vip |
| 921 | if(!pillar['return'].isEmpty()) { |
| 922 | elasticsearch_vip = pillar['return'][0].values()[0] |
| 923 | } else { |
| 924 | common.errorMsg('[ERROR] Elasticsearch VIP address could not be retrieved') |
| 925 | } |
| 926 | |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 927 | timeout(10) { |
| 928 | common.infoMsg('Waiting for Elasticsearch to come up..') |
Mikhail Ivanov | fcd55d6 | 2017-12-19 16:51:35 +0400 | [diff] [blame] | 929 | salt.cmdRun(master, 'I@elasticsearch:client', "while true; do curl -sf ${elasticsearch_vip}:9200 >/dev/null && break; done") |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 930 | } |
Jakub Josef | 432e9d9 | 2018-02-06 18:28:37 +0100 | [diff] [blame] | 931 | salt.enforceState(master, 'I@elasticsearch:client', 'elasticsearch.client') |
Mikhail Ivanov | 5312d1f | 2017-12-06 17:36:36 +0400 | [diff] [blame] | 932 | } |