summaryrefslogtreecommitdiffstats
path: root/inventory
diff options
context:
space:
mode:
Diffstat (limited to 'inventory')
-rw-r--r--inventory/byo/hosts.aep.example30
-rw-r--r--inventory/byo/hosts.origin.example30
-rw-r--r--inventory/byo/hosts.ose.example30
-rwxr-xr-xinventory/multi_inventory.py75
4 files changed, 122 insertions, 43 deletions
diff --git a/inventory/byo/hosts.aep.example b/inventory/byo/hosts.aep.example
index 8cd4caac4..deeea2e40 100644
--- a/inventory/byo/hosts.aep.example
+++ b/inventory/byo/hosts.aep.example
@@ -62,18 +62,20 @@ deployment_type=atomic-enterprise
# Add additional, insecure, and blocked registries to global docker configuration
# For enterprise deployment types we ensure that registry.access.redhat.com is
# included if you do not include it
-#cli_docker_additional_registries=registry.example.com
-#cli_docker_insecure_registries=registry.example.com
-#cli_docker_blocked_registries=registry.hacker.com
+#openshift_docker_additional_registries=registry.example.com
+#openshift_docker_insecure_registries=registry.example.com
+#openshift_docker_blocked_registries=registry.hacker.com
+# Disable pushing to dockerhub
+#openshift_docker_disable_push_dockerhub=True
# Items added, as is, to end of /etc/sysconfig/docker OPTIONS
#openshift_docker_options="-l warn --ipv6=false"
# Deprecated methods to set --log-driver and --log-opts flags, use openshift_docker_options instead
-#cli_docker_log_driver=json
-#cli_docker_log_options="tag=mailer"
+#openshift_docker_log_driver=json
+#openshift_docker_log_options="tag=mailer"
# Alternate image format string. If you're not modifying the format string and
# only need to inject your own registry you may want to consider
-# cli_docker_additional_registries instead
+# openshift_docker_additional_registries instead
#oreg_url=example.com/aep3/aep-${component}:${version}
# Additional yum repos to install
@@ -132,7 +134,7 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#osm_api_server_args={'max-requests-inflight': ['400']}
# default subdomain to use for exposed routes
-#osm_default_subdomain=apps.test.example.com
+#openshift_master_default_subdomain=apps.test.example.com
# additional cors origins
#osm_custom_cors_origins=['foo.example.com', 'bar.example.com']
@@ -157,6 +159,20 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
# Disable the OpenShift SDN plugin
# openshift_use_openshift_sdn=False
+# Configure SDN cluster network CIDR block. This network block should
+# be a private block and should not conflict with existing network
+# blocks in your infrastructure that pods may require access to.
+# Can not be changed after deployment.
+#osm_cluster_network_cidr=10.1.0.0/16
+
+# Configure number of bits to allocate to each host’s subnet e.g. 8
+# would mean a /24 network on the host.
+#osm_host_subnet_length=8
+
+# Configure master API and console ports.
+#openshift_master_api_port=8443
+#openshift_master_console_port=8443
+
# set RPM version for debugging purposes
#openshift_pkg_version=-3.1.0.0
diff --git a/inventory/byo/hosts.origin.example b/inventory/byo/hosts.origin.example
index fffdcaab4..8963c2ad6 100644
--- a/inventory/byo/hosts.origin.example
+++ b/inventory/byo/hosts.origin.example
@@ -63,18 +63,20 @@ deployment_type=origin
# Add additional, insecure, and blocked registries to global docker configuration
# For enterprise deployment types we ensure that registry.access.redhat.com is
# included if you do not include it
-#cli_docker_additional_registries=registry.example.com
-#cli_docker_insecure_registries=registry.example.com
-#cli_docker_blocked_registries=registry.hacker.com
+#openshift_docker_additional_registries=registry.example.com
+#openshift_docker_insecure_registries=registry.example.com
+#openshift_docker_blocked_registries=registry.hacker.com
+# Disable pushing to dockerhub
+#openshift_docker_disable_push_dockerhub=True
# Items added, as is, to end of /etc/sysconfig/docker OPTIONS
#openshift_docker_options="-l warn --ipv6=false"
# Deprecated methods to set --log-driver and --log-opts flags, use openshift_docker_options instead
-#cli_docker_log_driver=json
-#cli_docker_log_options="tag=mailer"
+#openshift_docker_log_driver=json
+#openshift_docker_log_options="tag=mailer"
# Alternate image format string. If you're not modifying the format string and
# only need to inject your own registry you may want to consider
-# cli_docker_additional_registries instead
+# openshift_docker_additional_registries instead
#oreg_url=example.com/openshift3/ose-${component}:${version}
# Origin copr repo
@@ -137,7 +139,7 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#osm_api_server_args={'max-requests-inflight': ['400']}
# default subdomain to use for exposed routes
-#osm_default_subdomain=apps.test.example.com
+#openshift_master_default_subdomain=apps.test.example.com
# additional cors origins
#osm_custom_cors_origins=['foo.example.com', 'bar.example.com']
@@ -162,6 +164,20 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
# Disable the OpenShift SDN plugin
# openshift_use_openshift_sdn=False
+# Configure SDN cluster network CIDR block. This network block should
+# be a private block and should not conflict with existing network
+# blocks in your infrastructure that pods may require access to.
+# Can not be changed after deployment.
+#osm_cluster_network_cidr=10.1.0.0/16
+
+# Configure number of bits to allocate to each host’s subnet e.g. 8
+# would mean a /24 network on the host.
+#osm_host_subnet_length=8
+
+# Configure master API and console ports.
+#openshift_master_api_port=8443
+#openshift_master_console_port=8443
+
# set RPM version for debugging purposes
#openshift_pkg_version=-1.1
diff --git a/inventory/byo/hosts.ose.example b/inventory/byo/hosts.ose.example
index 233c1c8e2..b931a684d 100644
--- a/inventory/byo/hosts.ose.example
+++ b/inventory/byo/hosts.ose.example
@@ -62,19 +62,21 @@ deployment_type=openshift-enterprise
# Add additional, insecure, and blocked registries to global docker configuration
# For enterprise deployment types we ensure that registry.access.redhat.com is
# included if you do not include it
-#cli_docker_additional_registries=registry.example.com
-#cli_docker_insecure_registries=registry.example.com
-#cli_docker_blocked_registries=registry.hacker.com
+#openshift_docker_additional_registries=registry.example.com
+#openshift_docker_insecure_registries=registry.example.com
+#openshift_docker_blocked_registries=registry.hacker.com
+# Disable pushing to dockerhub
+#openshift_docker_disable_push_dockerhub=True
# Items added, as is, to end of /etc/sysconfig/docker OPTIONS
#openshift_docker_options="-l warn --ipv6=false"
# Deprecated methods to set --log-driver and --log-opts flags, use openshift_docker_options instead
-#cli_docker_log_driver=json
-#cli_docker_log_options="tag=mailer"
+#openshift_docker_log_driver=json
+#openshift_docker_log_options="tag=mailer"
# Alternate image format string. If you're not modifying the format string and
# only need to inject your own registry you may want to consider
-# cli_docker_additional_registries instead
+# openshift_docker_additional_registries instead
#oreg_url=example.com/openshift3/ose-${component}:${version}
# Additional yum repos to install
@@ -133,7 +135,7 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#osm_api_server_args={'max-requests-inflight': ['400']}
# default subdomain to use for exposed routes
-#osm_default_subdomain=apps.test.example.com
+#openshift_master_default_subdomain=apps.test.example.com
# additional cors origins
#osm_custom_cors_origins=['foo.example.com', 'bar.example.com']
@@ -158,6 +160,20 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
# Disable the OpenShift SDN plugin
# openshift_use_openshift_sdn=False
+# Configure SDN cluster network CIDR block. This network block should
+# be a private block and should not conflict with existing network
+# blocks in your infrastructure that pods may require access to.
+# Can not be changed after deployment.
+#osm_cluster_network_cidr=10.1.0.0/16
+
+# Configure number of bits to allocate to each host’s subnet e.g. 8
+# would mean a /24 network on the host.
+#osm_host_subnet_length=8
+
+# Configure master API and console ports.
+#openshift_master_api_port=8443
+#openshift_master_console_port=8443
+
# set RPM version for debugging purposes
#openshift_pkg_version=-3.1.0.0
diff --git a/inventory/multi_inventory.py b/inventory/multi_inventory.py
index 20fc48aa9..57be259f7 100755
--- a/inventory/multi_inventory.py
+++ b/inventory/multi_inventory.py
@@ -25,6 +25,9 @@ class MultiInventoryException(Exception):
'''Exceptions for MultiInventory class'''
pass
+# pylint: disable=too-many-public-methods
+# After a refactor of too-many-branches and placing those branches into
+# their own corresponding function, we have passed the allowed amount of functions(20).
class MultiInventory(object):
'''
MultiInventory class:
@@ -282,35 +285,63 @@ class MultiInventory(object):
else:
return data.get(keys, None)
- def apply_account_config(self, acc_config):
- ''' Apply account config settings
- '''
- results = self.all_inventory_results[acc_config['name']]
- results['all_hosts'] = results['_meta']['hostvars'].keys()
-
+ def apply_extra_vars(self, inventory, extra_vars):
+ ''' Apply the account config extra vars '''
# Extra vars go here
- for new_var, value in acc_config.get('extra_vars', {}).items():
- for data in results['_meta']['hostvars'].values():
+ for new_var, value in extra_vars.items():
+ for data in inventory.values():
self.add_entry(data, new_var, value)
+ def apply_clone_vars(self, inventory, clone_vars):
+ ''' Apply the account config clone vars '''
# Clone vars go here
- for to_name, from_name in acc_config.get('clone_vars', {}).items():
- for data in results['_meta']['hostvars'].values():
+ for to_name, from_name in clone_vars.items():
+ for data in inventory.values():
self.add_entry(data, to_name, self.get_entry(data, from_name))
- # Extra groups go here
- for new_var, value in acc_config.get('extra_groups', {}).items():
- for data in results['_meta']['hostvars'].values():
- results["%s_%s" % (new_var, value)] = copy.copy(results['all_hosts'])
-
- # Clone groups go here
- # Build a group based on the desired key name
- for to_name, from_name in acc_config.get('clone_groups', {}).items():
- for name, data in results['_meta']['hostvars'].items():
+ def apply_extra_groups(self, inventory, extra_groups):
+ ''' Apply the account config for extra groups '''
+ _ = self # Here for pylint. wanted an instance method instead of static
+ for new_var, value in extra_groups.items():
+ for _ in inventory['_meta']['hostvars'].values():
+ inventory["%s_%s" % (new_var, value)] = copy.copy(inventory['all_hosts'])
+
+ def apply_clone_groups(self, inventory, clone_groups):
+ ''' Apply the account config for clone groups '''
+ for to_name, from_name in clone_groups.items():
+ for name, data in inventory['_meta']['hostvars'].items():
key = '%s_%s' % (to_name, self.get_entry(data, from_name))
- if not results.has_key(key):
- results[key] = []
- results[key].append(name)
+ if not inventory.has_key(key):
+ inventory[key] = []
+ inventory[key].append(name)
+
+ def apply_group_selectors(self, inventory, group_selectors):
+ ''' Apply the account config for clone groups '''
+ _ = self # Here for pylint. wanted an instance method instead of static
+ for selector in group_selectors:
+ if inventory.has_key(selector['from_group']):
+ inventory[selector['from_group']].sort()
+ inventory[selector['name']] = inventory[selector['from_group']][0:selector['count']]
+ for host in inventory[selector['from_group']]:
+ if host in inventory[selector['name']]:
+ inventory['_meta']['hostvars'][host][selector['name']] = True
+ else:
+ inventory['_meta']['hostvars'][host][selector['name']] = False
+
+ def apply_account_config(self, acc_config):
+ ''' Apply account config settings '''
+ results = self.all_inventory_results[acc_config['name']]
+ results['all_hosts'] = results['_meta']['hostvars'].keys()
+
+ self.apply_extra_vars(results['_meta']['hostvars'], acc_config.get('extra_vars', {}))
+
+ self.apply_clone_vars(results['_meta']['hostvars'], acc_config.get('clone_vars', {}))
+
+ self.apply_extra_groups(results, acc_config.get('extra_groups', {}))
+
+ self.apply_clone_groups(results, acc_config.get('clone_groups', {}))
+
+ self.apply_group_selectors(results, acc_config.get('group_selectors', {}))
# store the results back into all_inventory_results
self.all_inventory_results[acc_config['name']] = results