cjiljw
Last Updated: April 17, 2019
·
1.244K
· 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:

#!/bin/sh
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:

[defaults]
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 🎉.

24 Responses
Add your response

30437

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

7 months ago ·
30496

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/

7 months ago ·
30723

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

7 months ago ·
30743

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/

7 months ago ·
31000

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

6 months ago ·
31011

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/

6 months ago ·
31086

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

6 months ago ·
31145

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

6 months ago ·
31155

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.

6 months ago ·
31185

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

5 months ago ·
31268

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

5 months ago ·
31361

<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.

5 months ago ·
31528

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

4 months ago ·
31561

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

https://www.essaycorp.com/biology-assignment-help

3 months ago ·
31606

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

3 months ago ·
31690

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

3 months ago ·
31771

The article is interesting and useful. I tried it and found it really useful.
https://www.chhatrapatishivray.com/2018/12/shivaji-maharaj-peoples-king.html

3 months ago ·
31853

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/!

about 2 months ago ·
32059

<a href="https://monetarymarkets.com/what-is-ipo/" target="_blank">what is IPO</a> The article is interesting and useful. I tried it and found it really useful. Thank you very much.

29 days ago ·
32169

Great article thanks for sharing it's very useful https://www.dissertationpros.co.uk/

28 days ago ·
32174

Harry Ramos is a digital marketing strategist and creative content writer.
https://www.ukessaytigers.co.uk/

28 days ago ·
32289
  1. Want to garner exceptional top-notch grade using your law coursework writing? Without any further ado, install the services of Coursework Square to assist you in this regard. We are a leading name in terms of qualitative writing and we induce nothing but professional perfection in our coursework writings. Thus, order right away!
8 days ago ·
32457

Great Information sharing. I am very happy to read this article. Thanks for giving us go through info. I appreciate your work. https://dissertationeducators.co.uk/services/proofreading-editing.php

7 days ago ·
32543

Thanks for providing this amazing information. I think we can expect better success with these tips. http://www.waiometra.com/

about 1 hour ago ·