summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall/openshift_ansible.py
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2015-11-23 11:56:27 -0500
committerSamuel Munilla <smunilla@redhat.com>2015-11-23 18:05:27 -0500
commitc148283d1731d08fbfd4446af88450c5983c7b7a (patch)
tree9079cceb4c68d71f25ff95783e5674f3879bf0b0 /utils/src/ooinstall/openshift_ansible.py
parentac6bc198d469315e7fec2452211c13d37abca795 (diff)
downloadopenshift-c148283d1731d08fbfd4446af88450c5983c7b7a.tar.gz
openshift-c148283d1731d08fbfd4446af88450c5983c7b7a.tar.bz2
openshift-c148283d1731d08fbfd4446af88450c5983c7b7a.tar.xz
openshift-c148283d1731d08fbfd4446af88450c5983c7b7a.zip
Handling preconfigured load balancers
The preconfigured load balancers, previously denoted by having 'run_on' set to false, cannot have their facts gathered which results in a stack trace. Later when we write out the inventory we have to fake out the hostname and just use 'connect_to'. We're likely going to have the concept of other types of "plug-in" hosts where we don't run ansible. We should make sure we abstract this properly so it's easy to add additional types of hosts. Also in the commit: - Renamed 'run_on' to 'preconfigured' and inverted the logic as needed - Output tally of Masters and Nodes as well as remaining Masters required for HA - Minor rewording in a few places - Currently only prompting for the load balancer after all other hosts have been entered - Removed spurious echo
Diffstat (limited to 'utils/src/ooinstall/openshift_ansible.py')
-rw-r--r--utils/src/ooinstall/openshift_ansible.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index 86c707b17..ed1ba2c77 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -19,7 +19,7 @@ def generate_inventory(hosts):
global CFG
masters = [host for host in hosts if host.master]
nodes = [host for host in hosts if host.node]
- proxy = next((host for host in hosts if host.master_lb), None)
+ proxy = determine_proxy_configuration(hosts)
multiple_masters = len(masters) > 1
base_inventory_path = CFG.settings['ansible_inventory_path']
@@ -66,13 +66,24 @@ def generate_inventory(hosts):
scheduleable = False
write_host(node, base_inventory, scheduleable)
- if getattr(proxy, 'run_on', False):
+ if not getattr(proxy, 'preconfigured', True):
base_inventory.write('\n[lb]\n')
write_host(proxy, base_inventory)
base_inventory.close()
return base_inventory_path
+def determine_proxy_configuration(hosts):
+ proxy = next((host for host in hosts if host.master_lb), None)
+ if proxy:
+ if proxy.hostname == None:
+ proxy.hostname = proxy.connect_to
+ proxy.public_hostname = proxy.connect_to
+ print('asd09o')
+ return proxy
+
+ return None
+
def write_inventory_children(base_inventory, multiple_masters, proxy):
global CFG
@@ -81,7 +92,7 @@ def write_inventory_children(base_inventory, multiple_masters, proxy):
base_inventory.write('nodes\n')
if multiple_masters:
base_inventory.write('etcd\n')
- if getattr(proxy, 'run_on', False):
+ if not getattr(proxy, 'preconfigured', True):
base_inventory.write('lb\n')
def write_inventory_vars(base_inventory, multiple_masters, proxy):