mirror of
https://github.com/cwchristerw/tjas-infra
synced 2025-09-04 02:23:22 +00:00
Beautification of Protect script
This commit is contained in:
35
protect.sh
35
protect.sh
@@ -5,21 +5,35 @@ nounderline=`tput rmul`
|
||||
bold=$(tput bold)
|
||||
normal=$(tput sgr0)
|
||||
|
||||
echo "${bold}PVJJK 1.VOS Niinisalo / TJAS Infra / Protect${normal}"
|
||||
echo "${bold}"
|
||||
echo "
|
||||
.-') _ ('-. .-')
|
||||
( OO) ) ( OO ).-. ( OO ).
|
||||
/ '._ ,--. / . --. /(_)---\_)
|
||||
|'--...__) .-')| ,| | \-. \ / _ |
|
||||
'--. .--'( OO |(_|.-'-' | |\ :\` \`.
|
||||
| | | \`-'| | \| |_.' | '..\`''.)
|
||||
| | ,--. | | | .-. |.-._) \\
|
||||
| | | '-' / | | | |\ /
|
||||
\`--' \`-----' \`--' \`--' \`-----'
|
||||
"
|
||||
echo "
|
||||
PVJJK 1.VOS NIINISALO
|
||||
TIETOJÄRJESTELMÄASENTAJIEN INTRA
|
||||
PROTECT SCRIPT
|
||||
"
|
||||
echo -n "${normal}"
|
||||
action=$1
|
||||
|
||||
encrypt() {
|
||||
echo "${underline}Encrypting...${nounderline}"
|
||||
execute "ansible-vault encrypt --vault-id $1@vault/$1" $1
|
||||
}
|
||||
|
||||
decrypt() {
|
||||
echo "${underline}Decrypting...${nounderline}"
|
||||
execute "ansible-vault decrypt --vault-id $1@vault/$1" $1
|
||||
}
|
||||
|
||||
list() {
|
||||
echo "${underline}Listing...${nounderline}"
|
||||
i=0
|
||||
for file in inventories/$1/group_vars/* inventories/$1/host_vars/*;
|
||||
do
|
||||
@@ -41,18 +55,23 @@ for file in inventories/$2/group_vars/* inventories/$2/host_vars/*;
|
||||
|
||||
case $action in
|
||||
encrypt)
|
||||
echo "${underline}Encrypting...${nounderline}"
|
||||
encrypt pvjjk-1vos-niinisalo
|
||||
;;
|
||||
decrypt)
|
||||
echo "${underline}Decrypting...${nounderline}"
|
||||
decrypt pvjjk-1vos-niinisalo
|
||||
;;
|
||||
list)
|
||||
echo "${underline}Listing...${nounderline}"
|
||||
list pvjjk-1vos-niinisalo
|
||||
;;
|
||||
help)
|
||||
echo "encrypt, decrypt, list"
|
||||
;;
|
||||
*)
|
||||
echo "..."
|
||||
echo "${underline}HELP${nounderline}"
|
||||
echo "encrypt - Encrypt Files"
|
||||
echo "decrypt - Decrypt Files"
|
||||
echo "list - List Files"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "\n\n\n"
|
||||
|
Reference in New Issue
Block a user