I was wondering if I could use Doppler with Ansible. I don’t see any native integrations with Ansible. I know that Ansible has a Hashicorp Vault plugin that uses secrets in Ansible playbooks…
Since there seems to be no native support for Ansible and Doppler I was thinking I could just use the Doppler Cli with the Ansible Shell or command module? Or maybe the raw module? The reason I ask is that I don’t want Ansible to accidentally leak any of my Doppler secrets.
Is their any planned integrations with Ansible in the future?
From taking a quick look at the Ansible docs, you should be able to use Ansible’s built-in support for environment variables with the Doppler CLI by running:
# `DOPPLER_TOKEN` environment variable must be set
doppler run -- ansible-playbook playbook.yml
If triggering the playbook using a GitHub Action, the step could look like:
Then I believe inside your playbook, you can reference a Doppler injected environment variable using:
{{ lookup('env', 'SECRET_FROM_DOPPLER') }}
Let me know if that works as I’m not an Ansible user and need to get across it more.
We don’t yet have an Ansible integration, but I’ve added it to our engineering backlog and will let you know once it’s available (although I can’t offer an ETA at this stage).
Ryan’s answer above currently seems to be the main documentation available for using Doppler with Ansible, so I’m posting this just to update it a little
To read a shell environment variable from within an Ansible script you would use
This would assume that your Doppler configs share the same name as what you’re passing in via your server. Note that I’m not super familiar with usage for that wsl command you’re using, so you may need to tweak the command slightly. The main point is passing in the -c flag to designate which config you want used.
Let me know if that works for you. If not, I’ll see what else I can come up with for you!