Skip to content

Commit

Permalink
feat: task decrypt secret
Browse files Browse the repository at this point in the history
  • Loading branch information
janikvonrotz committed Feb 12, 2025
1 parent f13c2f0 commit e63cb67
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions task
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function help() {
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "generate-vault-password" "[vault_id] [password]" "Generate a password file for Ansible vault."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "convert-vault-file" "[vault_id] [path]" "Re-encrypt vault file as single strings."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "encrypt-string" "[vault_id] [key:value] -q" "Generate encrypted string with Ansible Vault."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "decrypt-secret" "[vault_id]" "Decrypt encrypted string."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "install" "" "Install Ansible and dependencies with uv."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "install-exo" "" "Install Exoscale CLI."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "upgrade" "" "Upgrade Ansible and dependencies with uv."
Expand Down Expand Up @@ -70,6 +71,12 @@ function encrypt-string() {
ansible-vault encrypt_string --encrypt-vault-id="$1" --name "$STRING_KEY" "$STRING_VALUE"
}

function decrypt-secret() {
if test -z "$1"; then echo "\$1 is empty"; exit; fi
echo "Enter the encrypted yaml content of your secret and confirm with ctrl + d:"
ansible-vault decrypt --vault-id="$1"
}

function convert-vault-file() {
if test -z "$1"; then echo "\$1 is empty"; exit; fi
if test -z "$1"; then echo "\$1 is empty"; exit; fi
Expand Down

0 comments on commit e63cb67

Please sign in to comment.