Files
ansible/bootstrap.sh
T
2026-07-03 14:01:12 -05:00

44 lines
777 B
Bash

#!/bin/sh
system-groupadd () {
sudo groupadd -r -g $2 $1
rc = $?
if [ $rc -ne 0 ] ; then
echo "ERROR - Unable to add $1 group! ($rc)" 1>&2
exit 1
fi
}
system-useradd () {
system-groupadd "${@}"
sudo 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
exit 2
fi
}
# Create system group hpf-sudo for normal sudo users
system-groupadd hpf-sudo 700
# Create system group hpf-sudo-np for special sudo users that don't require a password
system-groupadd hpf-sudo-np 701
# Create the Ansible user
system-useradd hpf-ans 800
usermod -aG hpf-sudo-np hpf-ans
# Add hpf-ans authorized keys
# Add hpf-ans sudoers
# Add sudoers entries