How do I keep secret data in my playbook?
Answer / Shahzad Alam
To store sensitive data such as passwords and API keys securely in your Ansible playbooks, you can use encrypted variables:n1. Create a vault password: Run the command `ansible-vault create <playbook_name>` to generate an encrypted file.n2. Add secret data to the vault file: Edit the created file and add sensitive information within vault-wrapped blocks, which look like this: ```n---!nvault | ansible-vaultnmysecret:n username: myusernamen password: mypasswordn```n3. Encrypt the file: Save and exit the vault file, then run `ansible-vault encrypt <playbook_name>` to encrypt it.n4. Use the encrypted playbook: When you run your Ansible commands, provide the vault password when prompted.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is ansible?
Explain callback_plugin in ansible?
What are ansible vaults?
How would you access a variable of the first host in a group?
Write a playbook to create a backup of a file in the remote servers before copy.
What is the way to access shell environment variables in ansible?
How do I generate crypted passwords for the user module?
What is ansible role?
Does ansible support aws?
What are playbooks in ansible?
Why is ‘{{ }}’ notation used?
When should I use {{ }}?