summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall/openshift_ansible.py
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2015-12-01 10:48:53 -0500
committerSamuel Munilla <smunilla@redhat.com>2016-03-09 08:11:37 -0500
commit2ce2f905275acd7ec4cda7fa072ba385208f30d1 (patch)
tree2ac82d2b9f86b04064a0cc2d0f0fbcf1444b29a6 /utils/src/ooinstall/openshift_ansible.py
parent72fbab29392f7b4697a440f406d6873941086d7d (diff)
downloadopenshift-2ce2f905275acd7ec4cda7fa072ba385208f30d1.tar.gz
openshift-2ce2f905275acd7ec4cda7fa072ba385208f30d1.tar.bz2
openshift-2ce2f905275acd7ec4cda7fa072ba385208f30d1.tar.xz
openshift-2ce2f905275acd7ec4cda7fa072ba385208f30d1.zip
First attempt at NFS setup
Diffstat (limited to 'utils/src/ooinstall/openshift_ansible.py')
-rw-r--r--utils/src/ooinstall/openshift_ansible.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index 3a135139b..04cccf89d 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -21,13 +21,14 @@ def generate_inventory(hosts):
nodes = [host for host in hosts if host.node]
new_nodes = [host for host in hosts if host.node and host.new_host]
proxy = determine_proxy_configuration(hosts)
+ storage = determine_storage_configuration(hosts)
multiple_masters = len(masters) > 1
scaleup = len(new_nodes) > 0
base_inventory_path = CFG.settings['ansible_inventory_path']
base_inventory = open(base_inventory_path, 'w')
- write_inventory_children(base_inventory, multiple_masters, proxy, scaleup)
+ write_inventory_children(base_inventory, multiple_masters, proxy, storage, scaleup)
write_inventory_vars(base_inventory, multiple_masters, proxy)
@@ -73,11 +74,16 @@ def generate_inventory(hosts):
base_inventory.write('\n[lb]\n')
write_host(proxy, base_inventory)
+
if scaleup:
base_inventory.write('\n[new_nodes]\n')
for node in new_nodes:
write_host(node, base_inventory)
+ if storage:
+ base_inventory.write('\n[nfs]\n')
+ write_host(storage, base_inventory)
+
base_inventory.close()
return base_inventory_path
@@ -87,11 +93,15 @@ def determine_proxy_configuration(hosts):
if proxy.hostname == None:
proxy.hostname = proxy.connect_to
proxy.public_hostname = proxy.connect_to
- return proxy
- return None
+ return proxy
+
+def determine_storage_configuration(hosts):
+ storage = next((host for host in hosts if host.storage), None)
+
+ return storage
-def write_inventory_children(base_inventory, multiple_masters, proxy, scaleup):
+def write_inventory_children(base_inventory, multiple_masters, proxy, storage, scaleup):
global CFG
base_inventory.write('\n[OSEv3:children]\n')
@@ -103,6 +113,8 @@ def write_inventory_children(base_inventory, multiple_masters, proxy, scaleup):
base_inventory.write('etcd\n')
if not getattr(proxy, 'preconfigured', True):
base_inventory.write('lb\n')
+ if storage:
+ base_inventory.write('nfs\n')
def write_inventory_vars(base_inventory, multiple_masters, proxy):
global CFG