# getent group

**URL:** <https://forum.ansible.com/t/getent-group/28469>\
**Category:** Ansible Project\
**Created:** [August 30, 2018, 3:24pm UTC](https://forum.ansible.com/t/getent-group/28469 "2018-08-30T15:24:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinod93pop](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@vinod93pop](https://forum.ansible.com/u/vinod93pop)\
**Post date:** [August 30, 2018, 3:24pm UTC](https://forum.ansible.com/t/getent-group/28469/1 "2018-08-30T15:24:24Z")

</div>

HI team,

I have to check the group via getent if the group is not present I have to create a new group. how can I mention this is when module

---

<div class="post-metadata">

**Author:** ![Andrew\_Latham](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Andrew\_Latham](https://forum.ansible.com/u/Andrew_Latham)\
**Post date:** [August 30, 2018, 3:36pm UTC](https://forum.ansible.com/t/getent-group/28469/2 "2018-08-30T15:36:18Z")

</div>

Try using the examples at [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_conditionals.html?highlight=register#register-variables](https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html?highlight=register#register-variables)

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 30, 2018, 3:43pm UTC](https://forum.ansible.com/t/getent-group/28469/3 "2018-08-30T15:43:15Z")

</div>

You don't need to check if the group exist, the group module will create the group if it doesn't exist and if it exist it will not do anything.

---

<div class="post-metadata">

**Author:** ![vinod93pop](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@vinod93pop](https://forum.ansible.com/u/vinod93pop)\
**Post date:** [August 30, 2018, 3:44pm UTC](https://forum.ansible.com/t/getent-group/28469/4 "2018-08-30T15:44:53Z")

</div>

Thanks Kai this is what I am looking for …
