diff options
author | Samuel Munilla <smunilla@redhat.com> | 2015-11-02 08:32:17 -0500 |
---|---|---|
committer | Samuel Munilla <smunilla@redhat.com> | 2015-11-03 11:42:58 -0500 |
commit | 3574beed2b43d5fafbf0b833c1f39bb09cdf947f (patch) | |
tree | 238c514cf286ace156ea9d173a4ee5f162291740 /utils | |
parent | ef6df7220673de40d1c9854e105d7f134232e733 (diff) | |
download | openshift-3574beed2b43d5fafbf0b833c1f39bb09cdf947f.tar.gz openshift-3574beed2b43d5fafbf0b833c1f39bb09cdf947f.tar.bz2 openshift-3574beed2b43d5fafbf0b833c1f39bb09cdf947f.tar.xz openshift-3574beed2b43d5fafbf0b833c1f39bb09cdf947f.zip |
ooinstall: Add check for nopwd sudo
Diffstat (limited to 'utils')
-rw-r--r-- | utils/src/ooinstall/openshift_ansible.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index 4c9d30718..0def72cfd 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -4,6 +4,7 @@ import socket import subprocess +import sys import os import yaml from ooinstall.variants import find_variant @@ -25,7 +26,7 @@ def generate_inventory(hosts): 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'], @@ -46,6 +47,10 @@ def generate_inventory(hosts): 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') |