# Ansible for etcd - roles, user, role-based authentication

**URL:** <https://forum.ansible.com/t/ansible-for-etcd-roles-user-role-based-authentication/45685>\
**Category:** Get Help\
**Created:** [April 15, 2026, 9:03am UTC](https://forum.ansible.com/t/ansible-for-etcd-roles-user-role-based-authentication/45685 "2026-04-15T09:03:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [April 15, 2026, 9:03am UTC](https://forum.ansible.com/t/ansible-for-etcd-roles-user-role-based-authentication/45685/1 "2026-04-15T09:03:43Z")

</div>

I am aware of the [community.general.etcd3](https://docs.ansible.com/projects/ansible/latest/collections/community/general/etcd3_module.html) module, which apparently only has a narrow set of abilities.

> Sets or deletes values in etcd3 cluster using its v3 API.

I want to use etcd3 for managing postgres via Patroni, so the setting of values in etcd is not my concern, because that is handled by Patroni.

What I currently need to achieve is setting up `roles`, `users` and `role-based authentication` for my running etcd-cluster.

I guess this can be achieved via `shell` and/or `command` (\*) TASKS but I was wondering whether there is a more ansible-ish way to approach this.

```bash
(*)
etcdctl role add ...
etcdctl user add ...
etcdctl role grant-permission ...
etcdctl --user root auth enable

```

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [April 16, 2026, 7:46am UTC](https://forum.ansible.com/t/ansible-for-etcd-roles-user-role-based-authentication/45685/2 "2026-04-16T07:46:23Z")

</div>

Hi @dulhaver

Yes, you could go the approach of the command module as you mentioned. Another option be to look into using the etcd [gRPC API](https://etcd.io/docs/v3.5/learning/api/) and interact with that via a gRPC Python library in your own module.

---

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [April 18, 2026, 8:33am UTC](https://forum.ansible.com/t/ansible-for-etcd-roles-user-role-based-authentication/45685/3 "2026-04-18T08:33:56Z")

</div>

> [@dbrennand](#):
>
> look into using the etcd [gRPC API](https://etcd.io/docs/v3.5/learning/api/) and interact with that via a gRPC Python library in your own module

thx. I am not capable of that I’m afraid. Will go with the `command`/`shell` approach then for now.
