Commit 4ba6e61d authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis
Browse files

deploy: Add roles module



This is used to get the target component for each node.
It has a role-component mapping and should be used like:

NS = roles.get(constants.NS, ctx)

where the ctx is a Context() with proper node, role, cluster, setup.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 2d0a73fe
...@@ -13,41 +13,37 @@ ...@@ -13,41 +13,37 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from snfdeploy.components import * from snfdeploy import constants
from snfdeploy import components
ROLES = {
"ns": [HW, SSH, DDNS, NS, DNS, APT],
"db": [HW, SSH, DNS, APT, DB],
"mq": [HW, SSH, DNS, APT, MQ],
"nfs": [HW, SSH, DNS, APT, NFS],
"astakos": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, Astakos],
"pithos": [
HW, SSH, DNS, APT, Apache,
Gunicorn, Common, WEB, PithosBackend, Archip, Pithos
],
"cyclades": [
HW, SSH, DNS, APT,
Apache, Gunicorn, Common, WEB, Cyclades, VNC, PithosBackend, Archip
],
"cms": [HW, SSH, DNS, APT, Apache, Gunicorn, Common, WEB, CMS],
"stats": [
HW, SSH, DNS, APT,
Apache, Gunicorn, Common, WEB, Collectd, Stats
],
"client": [HW, SSH, DNS, APT, Kamaki, Burnin],
"ganeti": [
HW, SSH, DNS, DDNS, APT, Mount,
Ganeti, ExtStorage, Archip, ArchipGaneti, Network
],
"master": [
HW, SSH, DNS, DDNS, APT, Mount, Ganeti, Master, Network,
],
"snf-ganeti": [
PithosBackend, Image, GTools, GanetiCollectd
],
}
CONFLICTS = { _ROLE_MAP = {
Mount: [NFS], constants.NS: components.NS,
CMS: [Astakos, Pithos, Cyclades] constants.NFS: components.NFS,
constants.DB: components.DB,
constants.MQ: components.MQ,
constants.ASTAKOS: components.Astakos,
constants.CYCLADES: components.Cyclades,
constants.PITHOS: components.Pithos,
constants.CMS: components.CMS,
constants.STATS: components.Stats,
constants.MASTER: components.Master,
constants.VMC: components.VMC,
constants.CLIENT: components.Client,
constants.DEV: components.GanetiDev,
constants.ROUTER: components.Router,
} }
def _get_role_map(role):
if role in _ROLE_MAP:
return _ROLE_MAP[role]
else:
return getattr(components, role)
def get(role, ctx):
assert role and ctx
c = _get_role_map(role)
ctx.role = role
return c(ctx=ctx)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment