Archived
1
This repository has been archived on 2025-08-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
playbookctl/internal/space_creator/static/dd.restore.sh
2024-12-23 01:55:48 +03:00

29 lines
934 B
Bash

#!/bin/bash
# vi: set tabstop=4 shiftwidth=4 noexpandtab :
#------------------------------------------------#
# Модуль получения даты последнего бэкапа, если
# в качесте даты указано "latest". Иначе,
# возвращает переданный параметр.
#
# . . . . . . . . . . . . . . . . . . . . . . . .
# - dd.restore:
# role_path: "{{ role_path }}"
# inventory: name_of_inventory
# datetime: 20240412_231753
# register: res_dd_restore
#------------------------------------------------#
source $1
set -euo pipefail
L_CHANGED=false
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
if [[ "$datetime" == "latest" ]]; then
cd "$role_path/backups/$inventory"
datetime=$(ls -1t | head -1)
fi
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
echo "{ \"changed\": $L_CHANGED, \"inventory\": \"$inventory\", \"datetime\": \"$datetime\" }"