diff --git a/bootstrap.sh b/bootstrap.sh index 4986856..7b8375e 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -29,7 +29,7 @@ system_groupadd () { system_useradd () { if user_exists "$1" "$2" ; then return 0 ; fi system_groupadd "${@}" - useradd -r -u "$2" -g "$2" -s /bin/sh -m "$1" + useradd -r -u "$2" -g "$2" -s /bin/bash -m "$1" rc=$? if [ $rc -ne 0 ] ; then echo "ERROR - Unable to add $1 user! ($rc)" 1>&2 @@ -77,13 +77,23 @@ if [ ! -f "$f" ] ; then chmod u=rw,g=r,o= "$f" fi +# Make sure python3 pip and venv are installed +if which -s apt ; then + apt update + apt install python3-pip python3-venv -y +fi +# Make sure the hpf-ans ansible venv exists +venv_dir=~hpf-ans/.ansible-venv +venv_script="$venv_dir/bin/activate" +if [ ! -f "$venv_script" ] ; then + su --login hpf-ans -c "python3 -m venv \"$venv_dir\"" +fi +# Make sure pip is up to date in .ansible-venv +su --login hpf-ans -c "source \"$venv_script\"; pip install --upgrade pip" - - - -exit 99 -# install ansible -# ansible pull - +# Make sure ansible is installed in .ansible-venv +if ! su --login hpf-ans -c "source \"$venv_script\"; which -s ansible" ; then + su --login hpf-ans -c "source \"$venv_script\"; pip install ansible" +fi