summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/cli_installer.py13
-rw-r--r--utils/src/ooinstall/oo_config.py8
-rw-r--r--utils/src/ooinstall/openshift_ansible.py44
3 files changed, 36 insertions, 29 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index d052ad852..9fbb61a46 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -322,9 +322,7 @@ Note: Containerized storage hosts are not currently supported.
else:
host_props['connect_to'] = hostname_or_ip
host_props['preconfigured'] = False
- host_props['master'] = False
- host_props['node'] = False
- host_props['storage'] = True
+ host_props['roles'] = ['storage']
storage = Host(**host_props)
hosts.append(storage)
@@ -512,13 +510,6 @@ def error_if_missing_info(oo_cfg):
sys.exit(1)
oo_cfg.settings['variant_version'] = version.name
- missing_facts = oo_cfg.calc_missing_facts()
- if len(missing_facts) > 0:
- missing_info = True
- click.echo('For unattended installs, facts must be provided for all masters/nodes:')
- for host in missing_facts:
- click.echo('Host "%s" missing facts: %s' % (host, ", ".join(missing_facts[host])))
-
# check that all listed host roles are included
listed_roles = get_host_roles_set(oo_cfg)
configured_roles = set([role for role in oo_cfg.deployment.roles])
@@ -991,7 +982,7 @@ def install(ctx, force, gen_inventory):
# TODO: if there are *new* nodes and this is a live install, we may need the user
# to confirm the settings for new nodes. Look into this once we're distinguishing
# between new and pre-existing nodes.
- if len(oo_cfg.calc_missing_facts()) > 0:
+ if not ctx.obj['unattended'] and len(oo_cfg.calc_missing_facts()) > 0:
confirm_hosts_facts(oo_cfg, callback_facts)
# Write quick installer config file to disk:
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index cfea44b62..e37892c9b 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -56,6 +56,8 @@ class Host(object):
# allowable roles: master, node, etcd, storage, master_lb, new
self.roles = kwargs.get('roles', [])
+ self.other_variables = kwargs.get('other_variables', {})
+
if self.connect_to is None:
raise OOConfigInvalidHostError(
"You must specify either an ip or hostname as 'connect_to'")
@@ -71,7 +73,8 @@ class Host(object):
d = {}
for prop in ['ip', 'hostname', 'public_ip', 'public_hostname', 'connect_to',
- 'preconfigured', 'containerized', 'schedulable', 'roles', 'node_labels']:
+ 'preconfigured', 'containerized', 'schedulable', 'roles', 'node_labels',
+ 'other_variables']:
# If the property is defined (not None or False), export it:
if getattr(self, prop):
d[prop] = getattr(self, prop)
@@ -315,6 +318,9 @@ class OOConfig(object):
for host in self.deployment.hosts:
p_settings['deployment']['hosts'].append(host.to_dict())
+ for name, role in self.deployment.roles.iteritems():
+ p_settings['deployment']['roles'][name] = role.variables
+
try:
p_settings['variant'] = self.settings['variant']
p_settings['variant_version'] = self.settings['variant_version']
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index 8f7cf07e7..bcf06b599 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -49,23 +49,7 @@ def generate_inventory(hosts):
write_inventory_vars(base_inventory, multiple_masters, proxy)
- # Find the correct deployment type for ansible:
- ver = find_variant(CFG.settings['variant'],
- version=CFG.settings.get('variant_version', None))[1]
- base_inventory.write('deployment_type={}\n'.format(ver.ansible_key))
- if 'OO_INSTALL_ADDITIONAL_REGISTRIES' in os.environ:
- base_inventory.write('openshift_docker_additional_registries={}\n'
- .format(os.environ['OO_INSTALL_ADDITIONAL_REGISTRIES']))
- if 'OO_INSTALL_INSECURE_REGISTRIES' in os.environ:
- base_inventory.write('openshift_docker_insecure_registries={}\n'
- .format(os.environ['OO_INSTALL_INSECURE_REGISTRIES']))
- if 'OO_INSTALL_PUDDLE_REPO' in os.environ:
- # We have to double the '{' here for literals
- base_inventory.write("openshift_additional_repos=[{{'id': 'ose-devel', "
- "'name': 'ose-devel', "
- "'baseurl': '{}', "
- "'enabled': 1, 'gpgcheck': 0}}]\n".format(os.environ['OO_INSTALL_PUDDLE_REPO']))
base_inventory.write('\n[masters]\n')
for master in masters:
@@ -133,6 +117,7 @@ def write_inventory_children(base_inventory, multiple_masters, proxy, scaleup):
if not getattr(proxy, 'preconfigured', True):
base_inventory.write('lb\n')
+# pylint: disable=too-many-branches
def write_inventory_vars(base_inventory, multiple_masters, proxy):
global CFG
base_inventory.write('\n[OSEv3:vars]\n')
@@ -162,9 +147,28 @@ def write_inventory_vars(base_inventory, multiple_masters, proxy):
write_proxy_settings(base_inventory)
+ # Find the correct deployment type for ansible:
+ ver = find_variant(CFG.settings['variant'],
+ version=CFG.settings.get('variant_version', None))[1]
+ base_inventory.write('deployment_type={}\n'.format(ver.ansible_key))
+
+ if 'OO_INSTALL_ADDITIONAL_REGISTRIES' in os.environ:
+ base_inventory.write('openshift_docker_additional_registries={}\n'
+ .format(os.environ['OO_INSTALL_ADDITIONAL_REGISTRIES']))
+ if 'OO_INSTALL_INSECURE_REGISTRIES' in os.environ:
+ base_inventory.write('openshift_docker_insecure_registries={}\n'
+ .format(os.environ['OO_INSTALL_INSECURE_REGISTRIES']))
+ if 'OO_INSTALL_PUDDLE_REPO' in os.environ:
+ # We have to double the '{' here for literals
+ base_inventory.write("openshift_additional_repos=[{{'id': 'ose-devel', "
+ "'name': 'ose-devel', "
+ "'baseurl': '{}', "
+ "'enabled': 1, 'gpgcheck': 0}}]\n".format(os.environ['OO_INSTALL_PUDDLE_REPO']))
+
for name, role_obj in CFG.deployment.roles.iteritems():
if role_obj.variables:
- base_inventory.write("{}:vars".format(name))
+ group_name = ROLES_TO_GROUPS_MAP.get(name, name)
+ base_inventory.write("\n[{}:vars]\n".format(group_name))
for variable, value in role_obj.variables.iteritems():
inventory_var = VARIABLES_MAP.get(variable, variable)
if value:
@@ -190,6 +194,7 @@ def write_proxy_settings(base_inventory):
pass
+# pylint: disable=too-many-branches
def write_host(host, inventory, schedulable=None):
global CFG
@@ -204,6 +209,11 @@ def write_host(host, inventory, schedulable=None):
facts += ' openshift_public_hostname={}'.format(host.public_hostname)
if host.containerized:
facts += ' containerized={}'.format(host.containerized)
+ if host.other_variables:
+ for variable, value in host.other_variables.iteritems():
+ facts += " {}={}".format(variable, value)
+ if host.node_labels:
+ facts += ' openshift_node_labels="{}"'.format(host.node_labels)
# Distinguish between three states, no schedulability specified (use default),
# explicitly set to True, or explicitly set to False: