Ansible version compatibility
Tested with the Ansible Core >= 2.12.0 versions, and the current development version of Ansible. Ansible Core versions prior to 2.12.0 haven’t been tested.Python version compatibility
This collection depends on the Infisical SDK for Python. Requires Python 3.7 or greater.Installing this collection
You can install the Infisical collection with the Ansible Galaxy CLI:Using this collection
You can either call modules by their Fully Qualified Collection Name (FQCN), such asinfisical.vault.read_secrets, or you can call modules by their short name if you list the infisical.vault collection in the playbook’s collections keyword.
Authentication
The Infisical Ansible Collection supports Universal Auth, OIDC Auth, LDAP Auth, and Token Auth for authenticating against Infisical.Login module (recommended)
The recommended approach is to use thelogin module to authenticate once and reuse the credentials across multiple tasks. This reduces authentication overhead and makes playbooks cleaner. Alternatively, you can still pass credentials directly to each plugin/module if preferred.
Universal Auth
Universal Auth
Using Universal Auth for authentication is the most straight-forward way to get started with using the Ansible collection.To use Universal Auth, you need to provide the Client ID and Client Secret of your Infisical Machine Identity.You can also provide the
auth_method, universal_auth_client_id, and universal_auth_client_secret parameters through environment variables:OIDC Auth
OIDC Auth
To use OIDC Auth, you’ll need to provide the ID of your machine identity, and the OIDC JWT to be used for authentication.You can also provide the
Please note that in order to use OIDC Auth, you must have
1.0.10 or newer of the infisicalsdk package installed.auth_method, identity_id, and jwt parameters through environment variables:LDAP Auth
LDAP Auth
LDAP Auth allows you to authenticate with Infisical using a machine identity configured with an LDAP directory. You need to provide the identity ID and your LDAP username and password.You can also provide the
Please note that in order to use LDAP Auth, you must have
1.0.16 or newer of the infisicalsdk package installed.auth_method, identity_id, username, and password parameters through environment variables:Token Auth
Token Auth
Token Auth is the simplest authentication method that allows you to authenticate directly with an access token. This can be either a Machine Identity Token Auth token or a User JWT token.You can also provide the
Please note that in order to use Token Auth, you must have
1.0.13 or newer of the infisicalsdk package installed.auth_method and token parameters through environment variables:Available plugins and modules
Lookup plugins
infisical.vault.login- Authenticate and return reusable login datainfisical.vault.read_secrets- Read secrets from Infisicalinfisical.vault.read_folders- Read folders from Infisical
Modules
Authentication:infisical.vault.login- Authenticate and return reusable login data
infisical.vault.read_secrets- Read secrets from Infisicalinfisical.vault.create_secret- Create a new secretinfisical.vault.update_secret- Update an existing secretinfisical.vault.delete_secret- Delete a secret
infisical.vault.create_folder- Create a new folderinfisical.vault.read_folders- List folders at a path, or get one by IDinfisical.vault.update_folder- Rename or re-describe an existing folderinfisical.vault.delete_folder- Delete a folder
infisical.vault.create_dynamic_secret- Create a dynamic secret configurationinfisical.vault.get_dynamic_secret- Get a dynamic secret by nameinfisical.vault.update_dynamic_secret- Update a dynamic secretinfisical.vault.delete_dynamic_secret- Delete a dynamic secret
infisical.vault.create_dynamic_secret_lease- Create a lease (generates credentials)infisical.vault.get_dynamic_secret_lease- Get lease detailsinfisical.vault.renew_dynamic_secret_lease- Renew an existing leaseinfisical.vault.delete_dynamic_secret_lease- Delete/revoke a lease
Examples
Reading secrets
Reading secrets with full metadata
Use theraw option to retrieve complete secret metadata including version, creation time, tags, and more:
Using the lookup plugin
Theread_secrets lookup plugin allows for inline secret retrieval. Unlike modules that run on target hosts, lookup plugins run on the Ansible controller during playbook parsing. This is useful for retrieving secrets to use in variable definitions:
Managing secrets (CRUD)
Create, update, and delete secrets programmatically:Managing folders
Folders are the path namespace that thepath option on every secret module addresses. Create a folder before writing secrets into it.
Folder operations require
infisicalsdk version 1.0.17 or newer. The modules fail with a clear message when the installed version is older.read_folders returns only the direct children of path. Set recursive: true to list every folder below it instead.
Set path to the folder’s parent path, not to the folder itself. To rename /services/backend, pass path: "/services".
update_folder targets a folder only by folder_id, never by name, so use read_folders to look the ID up first. It also requires name on every call, so pass the current name when you only want to change the description. delete_folder is more flexible and accepts either an ID or a name through folder_id_or_name.
Reading folders with the lookup plugin
Theread_folders lookup plugin retrieves folders inline, the same way read_secrets does. It returns a plain list rather than the folders key the module returns, and returns a one-element list when you pass folder_id:
Dynamic secrets
Dynamic secrets generate credentials on-demand with automatic expiration. They support various providers like SQL databases, AWS, GCP, Azure, and more. For the full list of supported providers and their configuration options, see the Dynamic Secrets documentation.Creating a dynamic secret
For the full list of supported provider types and their input configurations, see the Dynamic Secrets API Documentation.