# Whitespace in comma-delimited lists

**URL:** <https://forum.ansible.com/t/whitespace-in-comma-delimited-lists/21544>\
**Category:** Ansible Project\
**Created:** [May 24, 2016, 3:32pm UTC](https://forum.ansible.com/t/whitespace-in-comma-delimited-lists/21544 "2016-05-24T15:32:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Ricky](https://forum.ansible.com/u/Ricky)\
**Post date:** [May 24, 2016, 3:32pm UTC](https://forum.ansible.com/t/whitespace-in-comma-delimited-lists/21544/1 "2016-05-24T15:32:59Z")

</div>

I was hunting down the cause to an error message I received when adding a user to some groups.

> ```auto
> - name: users | create app remote user
> user:
> name: "{{ app_remote_user }}"
> groups: adm, wheel
> createhome: yes
> 
> ```

The error message was:

> msg: Group wheel does not exist

This error message was not true in the sense that the target system definitely had a wheel group, but I noticed the extra space in the error message, so the fix was:

> ```auto
> - name: users | create app remote user
> user:
> name: "{{ app_remote_user }}"
> groups: adm,wheel
> createhome: yes
> 
> ```

My question: Is this a bug in Ansible’s interpretation of the groups parameter value?

---

<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:** [May 25, 2016, 2:47pm UTC](https://forum.ansible.com/t/whitespace-in-comma-delimited-lists/21544/2 "2016-05-25T14:47:20Z")

</div>

`groups` for the user module are handled differently than most other modules allowing multiple values. It explicitly requires a comma separated string, and only splits on commas and doesn’t strip the value.

It has been brought up before that the way it is handled is not ideal, but never been fixed. I’m not sure if there is a bug filed or not.

So right now, we’ll just call it a “well known feature” 😉

But there are improvements that could be made. Especially by setting that parameter as a `list`, and not relying on a comma delimited string for things.
