Compare commits
3 Commits
main
...
117821b738
| Author | SHA256 | Date | |
|---|---|---|---|
| 117821b738 | |||
| 0e3f78b695 | |||
| ba750bed89 |
+6
-6
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
####
|
####
|
||||||
#### WARNING:
|
#### WARNING:
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
GIT_REPO_BASE="https://gitea.admin-a.hpetersenfamily.com/heath/ansible"
|
GIT_REPO_BASE="https://gitea.admin-a.hpetersenfamily.com/heath/ansible"
|
||||||
GIT_REPO="${GIT_REPO_BASE}.git"
|
GIT_REPO="${GIT_REPO_BASE}.git"
|
||||||
GIT_REPO_sudoers_d_hpf="${GIT_REPO_BASE}/raw/branch/main/files/etc_sudoers_d_hpf"
|
GIT_REPO_BRANCH="${1:-"production"}"
|
||||||
GIT_REPO_ansible_pull_sh="${GIT_REPO_BASE}/raw/branch/main/files/home_hpf_ans_bin_ansible_pull_sh"
|
GIT_REPO_sudoers_d_hpf="${GIT_REPO_BASE}/raw/branch/${GIT_REPO_BRANCH}/files/etc_sudoers_d_hpf"
|
||||||
|
GIT_REPO_ansible_pull_sh="${GIT_REPO_BASE}/raw/branch/${GIT_REPO_BRANCH}/files/home_hpf_ans_bin_ansible_pull_sh"
|
||||||
|
|
||||||
ETC_sudoers_d_hpf="/etc/sudoers.d/hpf"
|
ETC_sudoers_d_hpf="/etc/sudoers.d/hpf"
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ add_groups_to_user () {
|
|||||||
|
|
||||||
# $command_line
|
# $command_line
|
||||||
as_hpf_ans () {
|
as_hpf_ans () {
|
||||||
su --login hpf-ans -c "if [ -r \"${HPF_ANS_activate}\" ] ; then source \"${HPF_ANS_activate}\" ; fi ; ${1}"
|
su --login hpf-ans --command "if [ -r \"${HPF_ANS_activate}\" ] ; then source \"${HPF_ANS_activate}\" ; fi ; ${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -150,4 +150,4 @@ mkdir -p "${ANSIBLE_PULL_SH_LOG_DIR}"
|
|||||||
chown hpf-ans:root "${ANSIBLE_PULL_SH_LOG_DIR}"; chmod ug=rwx,o= "${ANSIBLE_PULL_SH_LOG_DIR}"
|
chown hpf-ans:root "${ANSIBLE_PULL_SH_LOG_DIR}"; chmod ug=rwx,o= "${ANSIBLE_PULL_SH_LOG_DIR}"
|
||||||
|
|
||||||
# Run ansible-pull to finish up
|
# Run ansible-pull to finish up
|
||||||
as_hpf_ans "bin/ansible-pull.sh bootstrap.yml"
|
as_hpf_ans "$HPF_ANS_ansible_pull_sh --branch ${GIT_REPO_BRANCH} bootstrap.yml"
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# - Fix branch to check out
|
# - Process command line
|
||||||
|
GIT_REPO_BRANCH="production"
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
echo "Usage: $0 [--branch <branch name>]"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--branch)
|
||||||
|
shift 1
|
||||||
|
if [ $# -eq 0 ] ; then echo "$0: ERROR - Branch not specified." ; exit 1 ; fi
|
||||||
|
GIT_REPO_BRANCH="$1"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# - Include ansible virtual environment
|
||||||
. "${HOME}/.ansible-venv/bin/activate"
|
. "${HOME}/.ansible-venv/bin/activate"
|
||||||
|
|
||||||
SCRIPT_NAME="$(basename "${0}")"
|
SCRIPT_NAME="$(basename "${0}")"
|
||||||
@@ -23,5 +39,5 @@ if ! flock -n 9 ; then echo " - ERROR - Another copy of ${SCRIPT_NAME} is alread
|
|||||||
|
|
||||||
# - Do our work
|
# - Do our work
|
||||||
echo
|
echo
|
||||||
ansible-pull --only-if-changed --url "${GIT_REPO}" --checkout main "${@}"
|
ansible-pull --only-if-changed --url "${GIT_REPO}" --checkout "${GIT_REPO_BRANCH}" "${@}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user