# Consul + Patroni + Vault

**URL:** <https://discuss.hashicorp.com/t/consul-patroni-vault/10097>\
**Category:** Consul\
**Created:** [June 17, 2020, 7:53pm UTC](https://discuss.hashicorp.com/t/consul-patroni-vault/10097 "2020-06-17T19:53:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikebell90](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mikebell90/32/8067_2.png) [@mikebell90](https://discuss.hashicorp.com/u/mikebell90)\
**Post date:** [June 17, 2020, 7:53pm UTC](https://discuss.hashicorp.com/t/consul-patroni-vault/10097/1 "2020-06-17T19:53:06Z")

</div>

We are looking at using Patroni, which offers great cross-DC avaialbility and failover.  
One of the options is to store config data in Consul.

The issue is of course PASSWORDS.

We also have Vault, but in this case, things “Seem backwards”

We could use Consul Template to post render changes including the password, but we’d rather have Consul directly pull via some embed tag the password from vault. Does such a plugin exist? Suggestions?

---

<div class="post-metadata">

**Author:** ![Wolfsrudel](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/wolfsrudel/32/28465_2.png) [@Wolfsrudel](https://discuss.hashicorp.com/u/Wolfsrudel)\
**Post date:** [June 17, 2020, 8:58pm UTC](https://discuss.hashicorp.com/t/consul-patroni-vault/10097/2 "2020-06-17T20:58:10Z")

</div>

Which passwords? If for the user `postgres`, `replication` and maybe `pg_rewind` it won’t be possible but using consul-template. I know for passwords in the `patroni.yaml` it’s only possible to use plain-text or environment variables (e.g. in the systemd unit file).

> <https://github.com/zalando/patroni/issues/887#issuecomment-443754961>
>
> Hello guys,
> I'm having some trouble trying to not pass my passwords in plain text at the patroni.yml file.
> I've already deployed patroni...

If you want to use Vault for the application accounts, you should use the dynamic secrets:

> **[Dynamic Secrets: Database Secrets Engine | Vault - HashiCorp Learn](https://learn.hashicorp.com/vault/secrets-management/sm-dynamic-secrets)**
>
> Vault can dynamically generate secrets on-demand for some systems.

**EDIT:** Now I see what yo want to achieve.  
Not the whole configuration of Patroni is stored in the dcs. I have spent lots of hours getting familiar with Patroni and the dynamic configuration in dcs, file or environment variables, and trust me, only cluster related things are stored in consul. If you keep the whole configuration in dcs the configuration is the same on every node and you’ll have to restart every Patroni on every node instead of having kind of freedom to configure and reload them one by one.  
The documentation is not that clear for this use case:

[https://patroni.readthedocs.io/en/latest/dynamic\_configuration.html](https://patroni.readthedocs.io/en/latest/dynamic_configuration.html)

---

<div class="post-metadata">

**Author:** ![samantha-ot](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/samantha-ot/32/8071_2.png) [@samantha-ot](https://discuss.hashicorp.com/u/samantha-ot)\
**Post date:** [June 17, 2020, 11:10pm UTC](https://discuss.hashicorp.com/t/consul-patroni-vault/10097/3 "2020-06-17T23:10:36Z")

</div>

I’m Mike’s co-worker. My goal was to build an adjunct user management tool along side patroni using the existing consul cluster. Sadly, the dynamic secrets engine doesn’t meet our needs, and I want to keep this as much within the existing environment as possible. It seemed like a great marriage to have the consul kv store point to vault secrets, but I’ll work around it.
