summaryrefslogtreecommitdiffstats
path: root/utils/src
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2015-11-20 10:56:19 -0500
committerSamuel Munilla <smunilla@redhat.com>2015-11-20 15:05:09 -0500
commitdf620266882dbf5bede4c5778b29a9e70778b02a (patch)
tree0fa7625581d142485ecb4b241608763f998f8dca /utils/src
parent26fd8b9488f8b334eecac113dac4789412587f21 (diff)
downloadopenshift-df620266882dbf5bede4c5778b29a9e70778b02a.tar.gz
openshift-df620266882dbf5bede4c5778b29a9e70778b02a.tar.bz2
openshift-df620266882dbf5bede4c5778b29a9e70778b02a.tar.xz
openshift-df620266882dbf5bede4c5778b29a9e70778b02a.zip
Breakup inventory writing
Diffstat (limited to 'utils/src')
-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