fix to not resolve HOME/tilde until user is created
This commit is contained in:
+6
-16
@@ -10,9 +10,7 @@ GIT_REPO="${GIT_REPO_BASE}.git"
|
||||
GIT_REPO_ETC_SUDOERS_D_HPF="${GIT_REPO_BASE}/raw/branch/main/etc_sudoers_d_hpf"
|
||||
GIT_REPO_HOME_HPF_ANS_BIN_ANSIBLE_PULL_SH="${GIT_REPO_BASE}/raw/branch/main/home_hpf_ans_bin_ansible-pull.sh"
|
||||
|
||||
HPF_ANS_BIN_DIR=~hpf
|
||||
|
||||
VENV_DIRECTORY=~hpf-ans/.ansible-venv
|
||||
VENV_DIRECTORY="\${HOME}/.ansible-venv"
|
||||
VENV_ACTIVATE="${VENV_DIRECTORY}/bin/activate"
|
||||
|
||||
ANSIBLE_PULL_LOG="/var/log/ansible-pull.log"
|
||||
@@ -70,11 +68,6 @@ as_hpf_ans () {
|
||||
su --login hpf-ans -c "if [ -r \"${VENV_ACTIVATE}\" ] ; then source \"${VENV_ACTIVATE}\" ; fi ; ${1}"
|
||||
}
|
||||
|
||||
# $file_name
|
||||
backup_file () {
|
||||
mv "${1}" "${1}.backup-$(date "+%Y%m%d%H%M%S")"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
#### PROCESS
|
||||
@@ -107,7 +100,7 @@ add_groups_to_user "hpf-sudo-np" hpf-ans
|
||||
|
||||
# Create /etc/sudoers.d/hpf
|
||||
f="/etc/sudoers.d/hpf"
|
||||
backup_file "${f}"
|
||||
rm "${f}" 2>/dev/null
|
||||
curl -o "$f" "${GIT_REPO_ETC_SUDOERS_D_HPF}"
|
||||
chown root:root "$f"
|
||||
chmod u=rw,g=r,o= "$f"
|
||||
@@ -122,15 +115,12 @@ as_hpf_ans "pip install --upgrade pip"
|
||||
as_hpf_ans "pip install ansible"
|
||||
|
||||
# Create ~hpf-ans/bin directory
|
||||
d=~hpf-ans/bin
|
||||
if [ ! -d "${d}" ] ; then
|
||||
as_hpf_ans "mkdir -p \"${d}\""
|
||||
as_hpf_ans "chown hpf-ans:hpf-ans \"${d}\"; chmod ug=rwx,o= \"${d}\""
|
||||
fi
|
||||
d="\${HOME}/bin"
|
||||
as_hpf_ans "mkdir -p \"${d}\"; chown hpf-ans:hpf-ans \"${d}\"; chmod ug=rwx,o= \"${d}\""
|
||||
|
||||
# Create ~hpf-ans/bin/ansible-pull.sh
|
||||
f=~hpf-ans/bin/ansible-pull.sh
|
||||
backup_file "${f}"
|
||||
f="\${HOME}/bin/ansible-pull.sh"
|
||||
as_hpf_ans "rm \"${f}\" 2>/dev/null"
|
||||
as_hpf_ans "curl -o \"${f}\" \"${GIT_REPO_HOME_HPF_ANS_BIN_ANSIBLE_PULL_SH}\""
|
||||
as_hpf_ans "chown hpf-ans:hpf-ans \"${f}\"; chmod ug=rwx,o= \"${f}\""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user