From c2074c0404131c23045fb2ecf6afa71a187fe9c9 Mon Sep 17 00:00:00 2001 From: Samuel Munilla Date: Thu, 11 Aug 2016 15:04:33 -0400 Subject: a-o-i: Automatically Label Nodes as Infra In interactive mode, automatically label nodes as infrastructure nodes. Two cases are covered: 1) If all nodes are masters, all hosts are labeled infra 2) If dedicated nodes are defined, the first two (or one) nodes are labeled as infra --- utils/src/ooinstall/cli_installer.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'utils') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index bc15e41d5..2975592a1 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -613,6 +613,7 @@ https://docs.openshift.com/enterprise/latest/admin_guide/install/prerequisites.h if not oo_cfg.deployment.hosts: oo_cfg.deployment.hosts, roles = collect_hosts(oo_cfg) + set_infra_nodes(oo_cfg.deployment.hosts) for role in roles: oo_cfg.deployment.roles[role] = Role(name=role, variables={}) @@ -757,6 +758,16 @@ def get_hosts_to_run_on(oo_cfg, callback_facts, unattended, force, verbose): return hosts_to_run_on, callback_facts +def set_infra_nodes(hosts): + if all(host.is_master() for host in hosts): + infra_list = hosts + else: + nodes_list = [host for host in hosts if host.is_node()] + infra_list = nodes_list[:2] + + for host in infra_list: + host.node_labels = "{'region': 'infra'}" + @click.group() @click.pass_context -- cgit v1.2.3