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
committerBrenton Leanhardt <bleanhar@redhat.com>2015-11-23 16:32:31 -0500
commit6659d1e4fa14f5100458608337468e513374a385 (patch)
treea1c029bc81da6303a9f275112c9942ef542aad73 /utils/src/ooinstall/openshift_ansible.py
parent7be7104ebe63cd2e91a6004f6f9c8511240d8f28 (diff)
downloadopenshift-6659d1e4fa14f5100458608337468e513374a385.tar.gz
openshift-6659d1e4fa14f5100458608337468e513374a385.tar.bz2
openshift-6659d1e4fa14f5100458608337468e513374a385.tar.xz
openshift-6659d1e4fa14f5100458608337468e513374a385.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):