Skip to main content

Add your description here

Project description

ansible-vault-keyring

A simple tool to get and set passwords for ansible vaults using the system keyring.

Installation

Install ansible-vault-keyring using your favorite package manager / method.

For me, using uv I use.

uv tool install ansible-vault-keyring

Usage

Setting a password.

$ ansible-vault-keyring --vault-id my_vault_id --set
Enter password   : foo 
Confirm password : foo

Getting a password.

$ ansible-vault-keyring --vault-id my_vault_id
foo

Recommend usage.

If for example, you want to use the ansible-vault-keyring tool to get two passwords from your keyring, one for a global vault-id, and one for a personal vault-id, you can add this to your ansible.cfg file.

[defaults]
vault_identity_list = global@/path/to/ansible_vault_keyring, personal@/path/to/ansible_vault_keyring

Now when a password is needed by ansible, it will invoke the ansible-vault-keyring tool to get the password from the keyring.

How Ansible fines config files

Ansible will load settings from the first ansible.cfg file it finds from :-

  1. The file in the ANSIBLE_CONFIG environment variable.
  2. The file ansible.cfg file in the current working directory.
  3. The file ~/.ansible.cfg file (in the user's home directory).
  4. The file /etc/ansible/ansible.cfg file (in the system ansible config directory).

Security Considerations.

The file is stored in the system keyring, for example gnome-keyring or OSX-Keychain. It does this using the keyring python package.

This means that the password is stored in plain text in the system keyring, and can be read by anyone with access to the system keyring, but this is true for all passwords stored in a system keyring.

Additionally, the password is passed through the python process running the ansible-vault-keyring tool.

However in reality this is likely to be at least as secure as copying+pasting the passwords from a password manager, and will certainly be better than reusing a password, or writing it on a post it note stuck to your monitor.

Credits

This tool was heavily inspired by vault-keyring-client.py from ansible-community's contrib scripts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansible_vault_keyring-0.1.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

ansible_vault_keyring-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file ansible_vault_keyring-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ansible_vault_keyring-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4732ba65679ebc251f71bf88a5d16143bb436ee1aa636342c7ec08978b95b2aa
MD5 375e5c18e530708e348ff738d2b00f67
BLAKE2b-256 1b0d5940b3e04b0f877dba1114632f0ea4a0614a5714ab2a431e9732d9e96a52

See more details on using hashes here.

File details

Details for the file ansible_vault_keyring-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ansible_vault_keyring-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cad566c3548404b861410709f5c4cee918d95bfc8688d6e3d66caa173de8ae0
MD5 9bec2bd570dfb5bbf20a919e85cbdb9a
BLAKE2b-256 5bb93bd12c4d4076ba868b779981ee74230347a5896ae6e881b8d1c4540e91d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page