Compare commits

..

3 Commits

Author SHA256 Message Date
heath effd8336cd renamed hpf 2026-07-24 14:36:34 -05:00
heath 246737d212 renamed .profile 2026-07-24 14:13:54 -05:00
heath aff550d586 renamed ansible-venv.sh 2026-07-24 14:05:46 -05:00
4 changed files with 14 additions and 20 deletions
+14 -20
View File
@@ -29,9 +29,9 @@ GIT_REPO_BRANCH="${1:-"development"}"
GIT_REPO_FILES="${GIT_REPO_BASE}/raw/branch/${GIT_REPO_BRANCH}/files" GIT_REPO_FILES="${GIT_REPO_BASE}/raw/branch/${GIT_REPO_BRANCH}/files"
GIT_REPO_sudoers_d_hpf="${GIT_REPO_FILES}/sudoers_d_hpf" GIT_REPO_sudoers_d_hpf="${GIT_REPO_FILES}/etc/sudoers.d/hpf"
GIT_REPO_ansible_venv_sh="${GIT_REPO_FILES}/profile_d_ansible_venv_sh" GIT_REPO_SKEL_ansible_venv_sh="${GIT_REPO_FILES}/etc/skel/.profile.d/ansible-venv.sh"
GIT_REPO_profile="${GIT_REPO_FILES}/.profile" GIT_REPO_SKEL_profile="${GIT_REPO_FILES}/files/etc/skel/.profile"
GIT_REPO_ansible_pull_sh="${GIT_REPO_FILES}/ansible_pull_sh" GIT_REPO_ansible_pull_sh="${GIT_REPO_FILES}/ansible_pull_sh"
ETC_sudoers_d="/etc/sudoers.d" ETC_sudoers_d="/etc/sudoers.d"
@@ -104,7 +104,11 @@ get_file() {
dest_file_permissions="${4}" dest_file_permissions="${4}"
if [ -e "${dest_file}" ] ; then mv "${dest_file}" "${dest_file}.${TIMESTAMP}" ; fi if [ -e "${dest_file}" ] ; then mv "${dest_file}" "${dest_file}.${TIMESTAMP}" ; fi
curl -o "${dest_file}" "${source_file}" if ! curl -f -o "${dest_file}" "${source_file}" ; then
echo "ERROR - Unable to download \"${source_file}\"" >&2
echo " to \"${dest_file}\"." >&2
exit 4
fi
chown "${dest_file_ownership}" "${dest_file}" chown "${dest_file_ownership}" "${dest_file}"
chmod "${dest_file_permissions}" "${dest_file}" chmod "${dest_file_permissions}" "${dest_file}"
} }
@@ -163,32 +167,22 @@ get_file "${GIT_REPO_sudoers_d_hpf}" "${ETC_sudoers_d_hpf}" "root:root" "u=rw,go
create_directory "${SKEL_profile_d}" "root:root" "u=rwx,go=" create_directory "${SKEL_profile_d}" "root:root" "u=rwx,go="
# Get /etc/skel/.profile.d/ansible-venv.sh # Get /etc/skel/.profile.d/ansible-venv.sh
get_file "${GIT_REPO_ansible_venv_sh}" "${SKEL_ansible_venv_sh}" "root:root" "u=rwx,go=" get_file "${GIT_REPO_SKEL_ansible_venv_sh}" "${SKEL_ansible_venv_sh}" "root:root" "u=rwx,go="
# Get /etc/skel/.profile # Get /etc/skel/.profile
get_file "${GIT_REPO_profile}" "${SKEL_profile}" "root:root" "u=rw,go=r" get_file "${GIT_REPO_SKEL_profile}" "${SKEL_profile}" "root:root" "u=rw,go=r"
# Create the hpf-ans user # Create the hpf-ans user
system_useradd hpf-ans 800 system_useradd hpf-ans 800
add_groups_to_user hpf-sudo-np hpf-ans add_groups_to_user hpf-sudo-np hpf-ans
# Determine HPF_ANS variables now that the user is created # Set HPF_ANS variables now that the user is created
HPF_ANS_HOME="$(as_hpf_ans 'echo "${HOME}"')" HPF_ANS_HOME="$(as_hpf_ans 'echo "${HOME}"')"
HPF_ANS_ansible_venv="${HPF_ANS_HOME}/.ansible-venv" HPF_ANS_ansible_venv="${HPF_ANS_HOME}/.ansible-venv"
HPF_ANS_bin="${HPF_ANS_HOME}/bin" HPF_ANS_bin="${HPF_ANS_HOME}/bin"
HPF_ANS_ansible_pull_sh="${HPF_ANS_bin}/ansible-pull.sh" HPF_ANS_ansible_pull_sh="${HPF_ANS_bin}/ansible-pull.sh"
# Make sure /home/hpf-ans/.ansible-venv exists
echo "HPF_ANS_HOME=\"${HPF_ANS_HOME}\""
echo "HPF_ANS_ansible_venv=\"${HPF_ANS_ansible_venv}\""
echo "HPF_ANS_bin=\"${HPF_ANS_bin}\""
echo "HPF_ANS_ansible_pull_sh=\"${HPF_ANS_ansible_pull_sh}\""
exit 200
# Make sure .ansible-venv exists
as_hpf_ans "if [ ! -d \"${HPF_ANS_ansible_venv}\" ] ; then virtualenv \"${HPF_ANS_ansible_venv}\" ; fi" as_hpf_ans "if [ ! -d \"${HPF_ANS_ansible_venv}\" ] ; then virtualenv \"${HPF_ANS_ansible_venv}\" ; fi"
# Make sure pip is up to date # Make sure pip is up to date
@@ -197,10 +191,10 @@ as_hpf_ans "pip install --upgrade pip"
# Make sure ansible is installed # Make sure ansible is installed
as_hpf_ans "pip install --upgrade ansible" as_hpf_ans "pip install --upgrade ansible"
# Make sure bin exists # Make sure /home/hpf-ans/bin exists
create_directory "${HPF_ANS_bin}" "hpf-ans:hpf-ans" "u=rwx,go=" create_directory "${HPF_ANS_bin}" "hpf-ans:hpf-ans" "u=rwx,go="
# Create ansible-pull.sh # Get /home/hpf-ans/bin/ansible-pull.sh
get_file "${GIT_REPO_ansible_pull_sh}" "${HPF_ANS_ansible_pull_sh}" "hpf-ans:hpf-ans" "u=rwx,go=" get_file "${GIT_REPO_ansible_pull_sh}" "${HPF_ANS_ansible_pull_sh}" "hpf-ans:hpf-ans" "u=rwx,go="
# Make sure log directory exists # Make sure log directory exists