File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ help-table() {
3131 printf " $column " ' decrypt-file' ' [path]' ' Decrypt Ansible Vault file.'
3232 printf " $column " ' encrypt-file' ' [vault_id] [path]' ' Encrypt file with Ansible Vault.'
3333 printf " $column " ' encrypt-string' ' [vault_id] [key:value] -q' ' Generate encrypted string with Ansible Vault.'
34- printf " $column " ' generate-vault-password' ' [vault_id] [password]' ' Generate a password file for Ansible vault.'
34+ printf " $column " ' generate-encrypted-string' ' [vault_id] [key] -q' ' Generate encrypted string for key with Ansible Vault.'
35+ printf " $column " ' generate-vault-password' ' [vault_id] [password]' ' Generate a password file for Ansible Vault.'
3536 printf " $column " ' show-vault-file' ' [vault_id] [path]' ' Show content of encrypted strings or fully encrypted vault file.'
3637 # Setup
3738 printf " $column " ' install' ' ' ' Install Ansible and dependencies with uv.'
@@ -214,6 +215,15 @@ encrypt-string() {
214215 ansible-vault encrypt_string --encrypt-vault-id=" $1 " --name " $string_key " " $string_value "
215216}
216217
218+ generate-encrypted-string () {
219+ if [[ -z " $1 " ]]; then echo ' $1 is empty' ; exit ; fi
220+ if [[ -z " $2 " ]]; then echo ' $2 is empty' ; exit ; fi
221+ local string_key=" $2 "
222+ local string_value=" $( pwgen -c 20 1) "
223+
224+ encrypt-string " $1 " " ${string_key} : $string_value "
225+ }
226+
217227convert-vault-file () {
218228 if [[ -z " $1 " ]]; then echo ' $1 is empty' ; exit ; fi
219229 if [[ -z " $2 " ]]; then echo ' $2 is empty' ; exit ; fi
You can’t perform that action at this time.
0 commit comments