diff --git a/bootstrap.sh b/bootstrap.sh index c467b18..4986856 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -17,7 +17,7 @@ user_exists () { # $group_name $group_number system_groupadd () { if group_exists "$1" "$2" ; then return 0 ; fi - echo groupadd -r -g "$2" "$1" + groupadd -r -g "$2" "$1" rc=$? if [ $rc -ne 0 ] ; then echo "ERROR - Unable to add $1 group! ($rc)" 1>&2 @@ -29,7 +29,7 @@ system_groupadd () { system_useradd () { if user_exists "$1" "$2" ; then return 0 ; fi system_groupadd "${@}" - echo useradd -r -u "$2" -g "$2" -s /bin/sh -m "$1" + useradd -r -u "$2" -g "$2" -s /bin/sh -m "$1" rc=$? if [ $rc -ne 0 ] ; then echo "ERROR - Unable to add $1 user! ($rc)" 1>&2 @@ -39,7 +39,7 @@ system_useradd () { # $groups $user_name add_groups_to_user () { - echo usermod -aG "$1" "$2" + usermod -aG "$1" "$2" rc=$? if [ $rc -ne 0 ] ; then echo "ERROR - Unable to add groups ($1) to user ($2)! ($rc)" 1>&2 @@ -68,8 +68,22 @@ system_groupadd hpf-sudo-np 701 system_useradd hpf-ans 800 add_groups_to_user "hpf-sudo-np" hpf-ans -# Create /etc/sudoers.d/hpetersenfamily +# Create /etc/sudoers.d/hpf f="/etc/sudoers.d/hpf" -echo curl -o "$f" "https://gitea.admin-a.hpetersenfamily.com/heath/ansible/raw/branch/main/etc_sudoers_d_hpf" -echo chown root:root "$f" -echo chmod u=rw,g=r,o= "$f" +if [ ! -f "$f" ] ; then + curl -s -o "$f" \ + "https://gitea.admin-a.hpetersenfamily.com/heath/ansible/raw/branch/main/etc_sudoers_d_hpf" + chown root:root "$f" + chmod u=rw,g=r,o= "$f" +fi + + + + + + + +exit 99 +# install ansible +# ansible pull +