update..
This commit is contained in:
@@ -14,8 +14,6 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
VAULT_PASS_FILE="${HOME}/.vault-pass"
|
||||
|
||||
########################################
|
||||
# Hilfe anzeigen
|
||||
########################################
|
||||
@@ -43,7 +41,6 @@ Options:
|
||||
-h, --help Show this help and exit
|
||||
|
||||
Notes:
|
||||
- Vault password file: ${VAULT_PASS_FILE}
|
||||
- Simple "key: value" YAML lines will be converted.
|
||||
- Already encrypted (!vault) entries are preserved.
|
||||
- Full vault-encrypted files (ANSIBLE_VAULT header) are detected.
|
||||
@@ -64,12 +61,6 @@ vencr() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Prüfen ob Vault-Passwortdatei existiert
|
||||
if [[ ! -r "$VAULT_PASS_FILE" ]]; then
|
||||
echo "Vault password file not readable: $VAULT_PASS_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
########################################
|
||||
# Optionales Output-File (-o)
|
||||
########################################
|
||||
@@ -133,8 +124,7 @@ vencr() {
|
||||
done < <(
|
||||
printf '%s' "$value" |
|
||||
ansible-vault encrypt_string \
|
||||
--stdin-name "$key" \
|
||||
--vault-password-file "$VAULT_PASS_FILE"
|
||||
--stdin-name "$key"
|
||||
)
|
||||
|
||||
else
|
||||
@@ -157,9 +147,7 @@ vencr() {
|
||||
fi
|
||||
|
||||
# Fall C: Normale Datei → komplett verschlüsseln (in-place)
|
||||
ansible-vault encrypt \
|
||||
--vault-password-file "$VAULT_PASS_FILE" \
|
||||
"$f"
|
||||
ansible-vault encrypt "$f"
|
||||
|
||||
echo "Encrypted file in-place: $f" >&2
|
||||
return 0
|
||||
@@ -193,10 +181,9 @@ vencr() {
|
||||
fi
|
||||
|
||||
# Ausgabe als YAML-kompatibler !vault Block
|
||||
printf '%s' "$str" |
|
||||
ansible-vault encrypt_string \
|
||||
--stdin-name "$name" \
|
||||
--vault-password-file "$VAULT_PASS_FILE"
|
||||
echo "Hallo"
|
||||
printf '%s' "$str" | ansible-vault encrypt_string --stdin-name "$name"
|
||||
|
||||
}
|
||||
|
||||
########################################
|
||||
|
||||
Reference in New Issue
Block a user