From: Samuli Silvius Date: Wed, 5 Jun 2019 15:32:16 +0000 (+0300) Subject: Remove the requirement to run aio.sh as root X-Git-Tag: 0.5.0~63^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=540c5b56469b52fdaccee624f582ce1c3e06efe9;p=multicloud%2Fk8s.git Remove the requirement to run aio.sh as root However user needs to be in sudoers without password needed to able to run needed steps with sudo. Issue-ID: MULTICLOUD-672 Change-Id: I798b9dd9dad4175c2b43700bfe801d34b578fe97 Signed-off-by: Samuli Silvius --- diff --git a/docs/bare_metal_provisioning.rst b/docs/bare_metal_provisioning.rst index 934cea82..885ffea3 100644 --- a/docs/bare_metal_provisioning.rst +++ b/docs/bare_metal_provisioning.rst @@ -41,9 +41,7 @@ baremetal/aio.sh ################ This bash script provides an automated process for deploying an All-in-One -Kubernetes cluster. Given that the ansible inventory file created by this -script doesn't specify any information about user and password, it's necessary -to execute this script as root user. +Kubernetes cluster. The following two instructions start the provisioning process. diff --git a/kud/hosting_providers/baremetal/aio.sh b/kud/hosting_providers/baremetal/aio.sh index 5b448183..416a1fef 100755 --- a/kud/hosting_providers/baremetal/aio.sh +++ b/kud/hosting_providers/baremetal/aio.sh @@ -12,11 +12,6 @@ set -o errexit set -o nounset set -o pipefail -if [[ $(whoami) != 'root' ]];then - echo "This bash script must be executed as root user" - exit 1 -fi - aio_dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) cd ${aio_dir}/../vagrant @@ -53,7 +48,7 @@ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys chmod og-wx ~/.ssh/authorized_keys echo "Enabling nested-virtualization" -./node.sh +sudo ./node.sh echo "Deploying KUD project" ./installer.sh | tee kud_installer.log diff --git a/kud/hosting_providers/vagrant/installer.sh b/kud/hosting_providers/vagrant/installer.sh index c37d2746..9312f1eb 100755 --- a/kud/hosting_providers/vagrant/installer.sh +++ b/kud/hosting_providers/vagrant/installer.sh @@ -194,6 +194,7 @@ function _print_kubernetes_info { echo "Admin password: secret" >> $k8s_info_file } +sudo -k # forgot sudo password if ! sudo -n "true"; then echo "" echo "passwordless sudo is needed for '$(id -nu)' user."