skillfed

ansible-vault

R/W an ansible-vault yaml file

ansible-vault v4.1.0 204.5K downloads/30d#9,605 on PyPI54
Copyleft license GPL-3.0-or-later Active released

What it is and what it does

ansible-vault is a Python library for reading and writing Ansible vault-encrypted YAML files outside of the Ansible CLI. It wraps the vault encryption/decryption functionality, letting you load encrypted vault data into Python objects and serialize modified data back to encrypted vault format.

The package depends on ansible-core and PyYAML, making it suitable for automation scripts, configuration management tools, or applications that need to work with Ansible vault files programmatically. It's been actively maintained since 2015 and is marked production-stable, with recent updates through 2026.

Use it for:

  • Decrypt Ansible vault files in Python scripts to access secrets without invoking the Ansible CLI
  • Automate vault file updates by loading, modifying, and re-encrypting YAML configuration data
  • Integrate Ansible vault decryption into CI/CD pipelines or deployment automation tools
  • Build configuration management tools that need to read and write encrypted Ansible vault data

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Reads and writes Ansible vault-encrypted YAML files programmatically, allowing you to load encrypted vault data and dump data back to encrypted vault format.

Yes, if you need to work with Ansible vault files from Python code. The package is actively maintained, has low install friction, and no known vulnerabilities. However, the GPL-3.0-or-later copyleft license means you cannot use it in proprietary closed-source projects without licensing the entire work under GPL.

Install

ansible-vault on PyPI

pip

pip install ansible-vault

uv

uv add ansible-vault

poetry

poetry add ansible-vault

Installing ansible-vault

Before you install

Low friction installation with only two runtime dependencies (ansible-core and PyYAML). Actively maintained with a recent commit in April 2026 and stable production status.

License in practice

Licensed under GPL-3.0-or-later (copyleft). Any derivative work or distribution must also be licensed under a compatible GPL version, which may restrict use in proprietary projects.

Quickstart

pip install ansible-vault

from ansible_vault import Vault

vault = Vault('password')
data = vault.load(open('vault.yml').read())
vault.dump(data, open('vault.yml', 'w'))

Verify before relying

  • Whether the package works with Ansible versions beyond those implied by ansible-core dependency
  • Performance characteristics when handling large vault files
  • Whether password handling supports environment variables or external key management systems

Package facts

License GPL-3.0-or-later (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — ansible-core, PyYAML
Maintenance actively maintained — 456 days since the last release
Last repo commit
First released
Downloads 204,499/month — #9,605 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ansible_vault-4.1.0-py3-none-any.whl

Development Status :: 5 - Production/StableProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

ansible vault yaml encryptionread write encrypted ansible vaultansible vault python libraryvault file encryption decryptionansible vault password protection
ansible-integrationsecrets-managementencryption

More Cryptography packages