diff options
author | Brenton Leanhardt <bleanhar@redhat.com> | 2015-11-03 13:14:15 -0500 |
---|---|---|
committer | Brenton Leanhardt <bleanhar@redhat.com> | 2015-11-03 13:14:15 -0500 |
commit | 83ad242cfbea6e715c964b8ebb74db3c011df502 (patch) | |
tree | 238c514cf286ace156ea9d173a4ee5f162291740 /utils/src | |
parent | 769a2e15cb505c53aab5953735566e6657dd17c3 (diff) | |
parent | 3574beed2b43d5fafbf0b833c1f39bb09cdf947f (diff) | |
download | openshift-83ad242cfbea6e715c964b8ebb74db3c011df502.tar.gz openshift-83ad242cfbea6e715c964b8ebb74db3c011df502.tar.bz2 openshift-83ad242cfbea6e715c964b8ebb74db3c011df502.tar.xz openshift-83ad242cfbea6e715c964b8ebb74db3c011df502.zip |
Merge pull request #774 from smunilla/localssh
oo-install: Support running on the host to be deployed
Diffstat (limited to 'utils/src')
-rw-r--r-- | utils/src/ooinstall/openshift_ansible.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index 3306271c8..0def72cfd 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -2,7 +2,9 @@ # 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 sys import os import yaml from ooinstall.variants import find_variant @@ -16,13 +18,15 @@ 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') 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_sudo=true\n') + base_inventory.write('ansible_become=true\n') # Find the correct deployment type for ansible: ver = find_variant(CFG.settings['variant'], @@ -41,6 +45,14 @@ 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 or host.public_hostname == installer_host + for host in hosts): + no_pwd_sudo = subprocess.call(['sudo', '-v', '--non-interactive']) + if no_pwd_sudo == 1: + print 'The atomic-openshift-installer requires sudo access without a password.' + sys.exit(1) + base_inventory.write("ansible_connection=local\n") + base_inventory.write('\n[masters]\n') masters = (host for host in hosts if host.master) for master in masters: |