Skip to main content
You can find the Infisical Ansible collection on Ansible Galaxy. This Ansible Infisical collection includes a variety of Ansible content to help automate the management of Infisical services. This collection is maintained by the Infisical team.

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 have not 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:
The python module dependencies are not installed by ansible-galaxy. They can be manually installed using pip:

Using this collection

You can either call modules by their Fully Qualified Collection Name (FQCN), such as infisical.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. The recommended approach is to use the login 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.
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:
To use OIDC Auth, you’ll need to provide the ID of your machine identity, and the OIDC JWT to be used for authentication.
Please note that in order to use OIDC Auth, you must have 1.0.10 or newer of the infisicalsdk package installed.
You can also provide the auth_method, identity_id, and jwt parameters through environment variables:
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.
Please note that in order to use LDAP Auth, you must have 1.0.16 or newer of the infisicalsdk package installed.
You can also provide the auth_method, identity_id, username, and password parameters through environment variables:
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.
Please note that in order to use Token Auth, you must have 1.0.13 or newer of the infisicalsdk package installed.
Your token is returned as-is in login_data.access_token so it can be reused in later tasks. As a result, Ansible no longer masks it, and it can appear in:
  • Verbose output (-v/-vvv)
  • Log files (ANSIBLE_LOG_PATH)
  • CI/CD logs
Always set no_log: true on the login task, as shown above, to keep the token out of output and logs.
You can also provide the auth_method and token parameters through environment variables:

Available Plugins and Modules

Lookup Plugins

  • infisical.vault.login - Authenticate and return reusable login data
  • infisical.vault.read_secrets - Read secrets from Infisical

Modules

Authentication:
  • infisical.vault.login - Authenticate and return reusable login data
Static Secrets:
  • infisical.vault.read_secrets - Read secrets from Infisical
  • infisical.vault.create_secret - Create a new secret
  • infisical.vault.update_secret - Update an existing secret
  • infisical.vault.delete_secret - Delete a secret
Dynamic Secrets:
  • infisical.vault.create_dynamic_secret - Create a dynamic secret configuration
  • infisical.vault.get_dynamic_secret - Get a dynamic secret by name
  • infisical.vault.update_dynamic_secret - Update a dynamic secret
  • infisical.vault.delete_dynamic_secret - Delete a dynamic secret
Dynamic Secret Leases:
  • infisical.vault.create_dynamic_secret_lease - Create a lease (generates credentials)
  • infisical.vault.get_dynamic_secret_lease - Get lease details
  • infisical.vault.renew_dynamic_secret_lease - Renew an existing lease
  • infisical.vault.delete_dynamic_secret_lease - Delete/revoke a lease

Examples

Reading Secrets

Reading secrets with full metadata

Use the raw option to retrieve complete secret metadata including version, creation time, tags, and more:

Using the Lookup Plugin

The read_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:

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.

Getting and Using Dynamic Secret Credentials

To use a dynamic secret, you need to create a lease which generates the actual credentials:

Managing Leases

Updating and Deleting Dynamic Secrets

Troubleshoot