Last Updated: February 11, 2019
· koen

Use macOS keychain for Ansible vault passwords

Since version 1.7, Ansible allows the vault password file to be a script, which made me think that it should be able to make this work with the macOS keychain. And so I did:

I created ~/.bin/ansible-vault-pass with the following content:

NAME=$(basename "$PWD" | sed -e 's/ /-/g')
security find-generic-password -a ansible_vault_$NAME -w

And made it executable:

chmod +x ~/.bin/ansible-vault-pass

Configured ansible in ansible.cfg:

vault_password_file = ~/.bin/ansible-vault-pass

And added a password for my vault to the keychain:

security add-generic-password -a ansible_vault_my-project -s ansible -w P4ssw0rd

The "account" (-a) of the password is ansible_value_ combined with the directory name from which the Ansible command was invoked. I'm still thinking about maybe a username file in the directory to prevent any directory renames and such.

And now I can run all my Ansible commands without ever entering my password 🎉.

18 Responses
Add your response


The article is interesting and useful. I tried it and found it really useful. Thank you very much. https://wifinamesfunny.com

6 months ago ·

I am making a program for unique and very strong passwords generator which will be unbreakable but i need little help or advice any person have experience? http://www.DissertationHouse.co.uk/

6 months ago ·

I am still considering the username file in the directory to prevent any directory renaming etc https://www.dissertationstore.co.uk/.

5 months ago ·

Uk Students Assignment Help services are continue visible at the StudentsAssignmentHelp.com that's best destination for you. We are continue working quality work for all our clients and make sure that all their academic needs are fulfilled. We gives a varied range of academic writing help at a low price. https://www.studentsassignmenthelp.com/uk/

5 months ago ·

Great post for those who are interested in this sphere all necessary information is well-explained. http://www.axivasichem.com

4 months ago ·

Great Information sharing. I am very happy to read this article. Thanks for giving us go through info. I appreciate your work. http://www.axivafilters.com/products/lab-filtration/filtration/glass-fiber-filter/

4 months ago ·

Thanks for providing this amazing information. I think we can expect better success with these tips. https://web-cart.com/

4 months ago ·

Great post for individuals who are interested in this sphere all essential facts is nicely-defined. https://mentorshouse.co.uk/

3 months ago ·

MacOs keychain is good for those who don’t remember their password and username and it is also save but one thing is I also wanted to use this for me because the same problem happened to me I didn’t remember my passwords but I don’t how it works and I need help to work on this as I am now working on https://www.assignmentmaster.co.uk/hnd-assignment/ and also include this in my assignment writing.

3 months ago ·

am making a program for unique and very strong passwords generator which will be unbreakable but i need little help or advice any person have experience? https://apkmodsgames.com

3 months ago ·

I think that this will be better options and all passwords will be easily manageable using your tips and guidelines. https://www.theacademicpapers.co.uk/dissertation-writing-services-uk.php

3 months ago ·

<a href="https://adaway.pro/">open source android app</a> |
<a href="https://droid4x.online/">droi4x offline installer</a>
Tubi Tv: Do you love watching movies and TV series? Are you searching for an app that lets you watch your favorite shows and movies for free? If yes, then you are in the right place. In today’s post, we will be discussing Tubi TV. Tubi (a.k.a. TubiTV) is a movie and TV streaming service that you can download and use for absolutely free.

about 2 months ago ·

The professional Financial Accounting Homework Help by Experts at EssayCorp.com. Our team always work hard to offer you the best academic services at an affordable price. We always make sure you get your assignments by or within deadline. https://www.essaycorp.com/financial-accounting-homework-help

29 days ago ·

The professional Biology Assignment Help by Experts at EssayCorp is popular among students, as we deliver assessment on or before deadline and that too at an affordable price. We have a flock of adept writers scattered across the world to give you a swift yet effective experience. For more details email us at contact@essaycorp.com


29 days ago ·

Take me back to the mountainside. Under the northern lights, chasing after the stars When we are full of life and the night is calm, there is no fear like http://fivenightsonline.com

28 days ago ·

Vault is a helpful feature of Ansible that allows you to store secrets within your configuration management repository. Rather than storing sensitive in plain text documents, Vault transparently manages encrypted files. When you need to edit a file, Vault prompts you for a password used to decrypt the document. https://www.ukassignment.co.uk/dissertation-writing-services

7 days ago ·

The article is interesting and useful. I tried it and found it really useful.

7 days ago ·

Hi! Do not have any confidence in a writing and critical thinking skills? Solution is on this website https://qualitycustomessays.com/buy-business-plan-writing/!

7 days ago ·