Linux command
ansible-vault 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create
ansible-vault create [secrets.yml]
Encrypt
ansible-vault encrypt [file.yml]
Decrypt
ansible-vault decrypt [secrets.yml]
Edit
ansible-vault edit [secrets.yml]
View
ansible-vault view [secrets.yml]
Encrypt
ansible-vault encrypt_string '[secret_value]' --name '[variable_name]'
Rekey
ansible-vault rekey [secrets.yml]
说明
ansible-vault encrypts sensitive data like passwords, keys, and credentials within Ansible projects. It uses AES256 encryption to protect files while allowing them to be used directly in playbooks. Encrypted files can be edited, viewed, and used in playbooks without manual decryption; ansible-playbook handles decryption automatically when provided with the vault password.
参数
- create _file_
- Create new encrypted file
- encrypt _files_
- Encrypt existing files
- decrypt _files_
- Decrypt files
- edit _file_
- Edit encrypted file in place
- view _file_
- View encrypted file contents
- encrypt_string
- Encrypt a string for embedding
- rekey _files_
- Change encryption password
- --vault-password-file _file_
- File containing vault password
- --vault-id _label_
- Vault identity label
- --ask-vault-pass
- Prompt for vault password
- --new-vault-password-file _file_
- New password file for rekey
FAQ
What is the ansible-vault command used for?
ansible-vault encrypts sensitive data like passwords, keys, and credentials within Ansible projects. It uses AES256 encryption to protect files while allowing them to be used directly in playbooks. Encrypted files can be edited, viewed, and used in playbooks without manual decryption; ansible-playbook handles decryption automatically when provided with the vault password.
How do I run a basic ansible-vault example?
Run `ansible-vault create [secrets.yml]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does create _file_ do in ansible-vault?
Create new encrypted file