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’s the use of ansible?
How ansible different from the playbook?
Why are you attracted to science and science fiction?
How can you access a list of ansible_variables?
Compare ansible vs puppet?
What are the ansible modules? Explain the different types.
What is ansible and what makes it stand out from the rest of the configuration management tools?
How can you speed up management inside in ec2?
How do I access shell environment variables?
Can you copy files recursively onto a target host? If yes, how?
How can one generate encrypted passwords for the user module?
What is the difference between a variable name and an environment variable?