1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Dynamically extract php_version & python_version

This commit is contained in:
root 2022-12-21 19:29:04 -05:00
parent 2408a08aa9
commit cc659d0837
17 changed files with 113 additions and 77 deletions

55
runrole
View file

@ -15,7 +15,7 @@ PLAYBOOK=run-one-role.yml
if [ ! -f $PLAYBOOK ]; then
echo "Exiting: IIAB Playbook not found."
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
echo "Please run this in /opt/iiab/iiab (top level of git repo)."
exit 1
fi
@ -28,28 +28,48 @@ if [ $# -eq 0 ] || [ "$2" == "--reinstall" ] || [ "$3" == "--reinstall" ]; then
exit 0
fi
# 2020-08-05: yes /etc/iiab/iiab_state.yml is necessary, but we DON'T
# want to encourage sloppy operators to delete/touch this file.
#
# (The iiab_state.yml file should always be created by ./iiab-install,
# for IIAB's Ansible roles that then auto-populate this file.)
#
# FYI ./iiab-network and ./iiab-configure likewise warn operators (IN RED!)
# if they try to run without the existence of /etc/iiab/iiab_state.yml :
#
# ERROR! vars file /etc/iiab/iiab_state.yml was not found
#
# Needed for Stages 1-3 if not installed yet
#if [ ! -f $IIAB_STATE_FILE ]; then
# touch $IIAB_STATE_FILE
#fi
if [ "$1" == "--reinstall" ]; then
ARGS="$ARGS\"reinstall\":True," # Needs boolean not string so use JSON list
REINSTALL=true
shift
fi
# 4 snippets to guide -> bootstrap -> accelerate role debugging on bare OS's:
mkdir -p /etc/iiab # -p avoids errors, effectively like '|| true'
if [ ! -f /etc/iiab/local_vars.yml ]; then
echo -e "\n\e[1mEXITING: /opt/iiab/iiab/iiab-install REQUIRES /etc/iiab/local_vars.yml\e[0m\n" >&2
echo -e "(1) See http://FAQ.IIAB.IO -> What is local_vars.yml and how do I customize it?" >&2
echo -e "(2) SMALL/MEDIUM/LARGE samples are included in /opt/iiab/iiab/vars" >&2
echo -e "(3) NO TIME FOR DETAILS? RUN INTERNET-IN-A-BOX'S FRIENDLY 1-LINE INSTALLER:\n" >&2
echo -e ' https://download.iiab.io\n' >&2
exit 1
fi
# In comparison, ./iiab-network and ./iiab-configure warn operators (IN RED)
# if run without the existence of /etc/iiab/iiab_state.yml
if [ ! -f $IIAB_STATE_FILE ]; then # touch $IIAB_STATE_FILE
echo -e "\n\e[1mCreating... $IIAB_STATE_FILE\e[0m"
cat > $IIAB_STATE_FILE << EOF
# DO *NOT* MANUALLY EDIT THIS, THANKS!
# IIAB does NOT currently support uninstalling apps/services.
EOF
fi
if ! [[ $(command -v ansible) ]]; then
echo -e "\n\e[1mPlease install Ansible, by running:\n\nsudo /opt/iiab/iiab/scripts/ansible\e[0m\n"
exit 1
fi
mkdir -p /etc/ansible/facts.d
cp scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact
ROLE_VAR=$1 # Ansible role name & var name sometimes differ :/
if [ $1 == "calibre-web" ]; then
ROLE_VAR=calibreweb
@ -105,6 +125,7 @@ if ! $INSTALL; then
ARGS="$ARGS\"${ROLE_VAR}_install\":True,"
fi
if [ $# -eq 2 ]; then
export ANSIBLE_LOG_PATH="$2"
else