Compare commits

...

7 Commits

2 changed files with 27 additions and 7 deletions

View File

@@ -55,7 +55,11 @@ fi
## Main ##
os="$(cat /etc/os-release)"
os="$os $(uname -a)"
if [[ ! -f /.dockerenv ]]; then
# If we are not in a Docker container, also check what the kernel says.
os="$os $(uname -a)"
# Docker containers use the host kernel which gives an incorrect reading.
fi
echo "Making sure all necessary packages are installed..."
if [[ `which ansible > /dev/null; echo $?` != 0 ]]; then

View File

@@ -805,21 +805,30 @@
}
alias clean-backups="clean-backup"
function_pull_prod_backups: |
export BACKUP="Backup"
export DOCKER="Docker"
export SYSTEM="System"
function pull_prod_backup {
if [[ -z "$1" || ("$1" != "$BACKUP" && "$1" != "$SYSTEM") ]]; then
echo "ERROR: Parameter 1 not correct, expecting '$BACKUP' or '$SYSTEM'."
if [[ -z "$1" || ("$1" != "$DOCKER" && "$1" != "$SYSTEM") ]]; then
echo "ERROR: Parameter 1 not correct, expecting '$DOCKER' or '$SYSTEM'."
return 1
fi
backup_type="$1"
echo "Looking for '*${backup_type}*.zip'"
ls -lh *${backup_type}*.zip 2>/dev/null
status="$?"
if [[ "$status" == "0" ]]; then
echo "File already downloaded, skipping."
return 0
else
echo "File still needed, downloading to local tmp/."
fi
mkdir -pv tmp
scp -P {{ prod_port }} \
{{ prod_user }}@{{ prod_host }}:"$BACKUP_DIR/*${backup_type}*.zip" \
tmp/
if [[ "$?" == "0" ]]; then
echo "Succeeded!"
mv -v "tmp/*${backup_type}*.zip" ./
mv -v tmp/*.zip ./
rmdir -v tmp
else
echo "Failed!"
@@ -830,9 +839,9 @@
dir="ProductionBackups-Pulled`today`"
mkdir -pv "$dir"
cd "$dir"
pull_prod_backup "$BACKUP"
pull_prod_backup "$DOCKER"
pull_prod_backup "$SYSTEM"
du -h *.zip
du -h *.zip | sort -h
status="$?"
cd ..
if [[ "$status" != 0 ]]; then
@@ -998,6 +1007,12 @@
alias reset-prod="load-branch prod main"
alias reset-stage="load-branch stage main"
alias reset-dev="load-branch dev main"
alias_reload_bash: |
alias reload-bash="source ~/.bashrc"
alias bash-reload="reload-bash"
alias shell-reload="reload-bash"
alias reload-shell="reload-bash"
alias reload="reload-bash"
- name: General | Account Management | Users | Files | Common Variable
set_fact:
@@ -1075,6 +1090,7 @@
{{ function_ebook_convert }}
{{ alias_sudo }}
{{ function_load_branch }}
{{ alias_reload_bash }}
- name: General | Account Management | Users | Files | .bashrc
blockinfile: