summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2015-10-30 09:50:11 -0400
committerSamuel Munilla <smunilla@redhat.com>2015-11-03 11:42:58 -0500
commitb41bca63682e11e2522540567c2bcf1d146e5d03 (patch)
tree76834ed6717febf2c36ba6c9030a411dea8be725
parent769a2e15cb505c53aab5953735566e6657dd17c3 (diff)
downloadopenshift-b41bca63682e11e2522540567c2bcf1d146e5d03.tar.gz
openshift-b41bca63682e11e2522540567c2bcf1d146e5d03.tar.bz2
openshift-b41bca63682e11e2522540567c2bcf1d146e5d03.tar.xz
openshift-b41bca63682e11e2522540567c2bcf1d146e5d03.zip
oo-install: Support running on the host to be deployed
This adds a check to see if the host the installer is running on is one of the hosts to be installed and sets i ansible_connection=local ansible_sudo=no in the inventory file.
-rw-r--r--utils/src/ooinstall/openshift_ansible.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index 3306271c8..bb1003ad6 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -2,6 +2,7 @@
# repo. We will work on these over time.
# pylint: disable=bad-continuation,missing-docstring,no-self-use,invalid-name,global-statement,global-variable-not-assigned
+import socket
import subprocess
import os
import yaml
@@ -16,6 +17,8 @@ def set_config(cfg):
def generate_inventory(hosts):
print hosts
global CFG
+
+ installer_host = socket.gethostname()
base_inventory_path = CFG.settings['ansible_inventory_path']
base_inventory = open(base_inventory_path, 'w')
base_inventory.write('\n[OSEv3:children]\nmasters\nnodes\n')
@@ -41,6 +44,10 @@ def generate_inventory(hosts):
if 'OO_INSTALL_STAGE_REGISTRY' in os.environ:
base_inventory.write('oreg_url=registry.access.stage.redhat.com/openshift3/ose-${component}:${version}\n')
+ if any(host.hostname == installer_host for host in hosts):
+ base_inventory.write("ansible_connection=local\n")
+ base_inventory.write("ansible_sudo=no\n")
+
base_inventory.write('\n[masters]\n')
masters = (host for host in hosts if host.master)
for master in masters: