summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2015-11-20 10:56:19 -0500
committerSamuel Munilla <smunilla@redhat.com>2015-11-23 18:05:26 -0500
commit296d1283202fe92de3045eab8bbc60db192f3a46 (patch)
tree2533fc2a426ccfcaa6c8a44fc47be21bc85218fe /utils/src/ooinstall
parentd446b2fe458444a88ceffd1d1966d6814b5185b5 (diff)
downloadopenshift-296d1283202fe92de3045eab8bbc60db192f3a46.tar.gz
openshift-296d1283202fe92de3045eab8bbc60db192f3a46.tar.bz2
openshift-296d1283202fe92de3045eab8bbc60db192f3a46.tar.xz
openshift-296d1283202fe92de3045eab8bbc60db192f3a46.zip
Breakup inventory writing
Diffstat (limited to 'utils/src/ooinstall')
-rw-r--r--utils/src/ooinstall/openshift_ansible.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index ec97c4144..ff674153d 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -25,23 +25,9 @@ def generate_inventory(hosts):
base_inventory_path = CFG.settings['ansible_inventory_path']
base_inventory = open(base_inventory_path, 'w')
- base_inventory.write('\n[OSEv3:children]\n')
- base_inventory.write('masters\n')
- base_inventory.write('nodes\n')
- if multiple_masters:
- base_inventory.write('etcd\n')
- if getattr(proxy, 'run_on', False):
- base_inventory.write('lb\n')
-
- base_inventory.write('\n[OSEv3:vars]\n')
- base_inventory.write('ansible_ssh_user={}\n'.format(CFG.settings['ansible_ssh_user']))
- if CFG.settings['ansible_ssh_user'] != 'root':
- base_inventory.write('ansible_become=true\n')
- if multiple_masters:
- base_inventory.write('openshift_master_cluster_method=native\n')
- base_inventory.write("openshift_master_cluster_hostname={}\n".format(proxy.hostname))
- base_inventory.write("openshift_master_cluster_public_hostname={}\n".format(proxy.public_hostname))
+ write_inventory_children(base_inventory, multiple_masters, proxy)
+ write_inventory_vars(base_inventory, multiple_masters, proxy)
# Find the correct deployment type for ansible:
ver = find_variant(CFG.settings['variant'],
@@ -87,6 +73,28 @@ def generate_inventory(hosts):
base_inventory.close()
return base_inventory_path
+def write_inventory_children(base_inventory, multiple_masters, proxy):
+ global CFG
+
+ base_inventory.write('\n[OSEv3:children]\n')
+ base_inventory.write('masters\n')
+ base_inventory.write('nodes\n')
+ if multiple_masters:
+ base_inventory.write('etcd\n')
+ if getattr(proxy, 'run_on', False):
+ base_inventory.write('lb\n')
+
+def write_inventory_vars(base_inventory, multiple_masters, proxy):
+ global CFG
+ base_inventory.write('\n[OSEv3:vars]\n')
+ base_inventory.write('ansible_ssh_user={}\n'.format(CFG.settings['ansible_ssh_user']))
+ if CFG.settings['ansible_ssh_user'] != 'root':
+ base_inventory.write('ansible_become=true\n')
+ if multiple_masters:
+ base_inventory.write('openshift_master_cluster_method=native\n')
+ base_inventory.write("openshift_master_cluster_hostname={}\n".format(proxy.hostname))
+ base_inventory.write("openshift_master_cluster_public_hostname={}\n".format(proxy.public_hostname))
+
def write_host(host, inventory, scheduleable=True):
global CFG