# Check Number Of Wheel Group Members

**URL:** <https://forum.ansible.com/t/check-number-of-wheel-group-members/30039>\
**Category:** Ansible Project\
**Created:** [April 2, 2019, 4:22pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039 "2019-04-02T16:22:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Adcock](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Jon\_Adcock](https://forum.ansible.com/u/Jon_Adcock)\
**Post date:** [April 2, 2019, 4:22pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039/1 "2019-04-02T16:22:41Z")

</div>

I’m trying to add a task to my security playbook to ensure that there are no members in the default Linux wheel group. This has turned out to be more difficult than I thought it would be.

Can someone out there help get me started? (ansible 2.7.9)

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 2, 2019, 4:27pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039/2 "2019-04-02T16:27:29Z")

</div>

You can use the `getent` module to do this. Something like:

- getent:  
database: group

- assert:  
that:

- getent\_group.wheel|default([“”, “”, “”])[2] == “”

---

<div class="post-metadata">

**Author:** ![Jon\_Adcock](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Jon\_Adcock](https://forum.ansible.com/u/Jon_Adcock)\
**Post date:** [April 2, 2019, 5:50pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039/3 "2019-04-02T17:50:41Z")

</div>

Thank you for your reply. I am getting what appears to be a formatting error. Here is the task from my playbook, and the error it is generating:

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 2, 2019, 6:22pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039/4 "2019-04-02T18:22:38Z")

</div>

Your formatting doesn’t match mine. Notice the difference of `that` between mine and yours. `that` is ententes to be a list

---

<div class="post-metadata">

**Author:** ![Sebastian\_Meyer](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@Sebastian\_Meyer](https://forum.ansible.com/u/Sebastian_Meyer)\
**Post date:** [April 2, 2019, 6:22pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039/5 "2019-04-02T18:22:54Z")

</div>

You'll need () around the getent and default:

that: (getent\_group.wheel|default(["", "", ""]))[2] == ""

The above should work.

Sebastian

---

<div class="post-metadata">

**Author:** ![Jon\_Adcock](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Jon\_Adcock](https://forum.ansible.com/u/Jon_Adcock)\
**Post date:** [April 2, 2019, 6:52pm UTC](https://forum.ansible.com/t/check-number-of-wheel-group-members/30039/6 "2019-04-02T18:52:44Z")

</div>

That got it ! Thank you for your help.
