# group\_by vs. register for OS decision

**URL:** <https://forum.ansible.com/t/group-by-vs-register-for-os-decision/13643>\
**Category:** Ansible Project\
**Created:** [October 9, 2013, 2:04pm UTC](https://forum.ansible.com/t/group-by-vs-register-for-os-decision/13643 "2013-10-09T14:04:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hakim\_greenland](https://avatars.discourse-cdn.com/v4/letter/h/2acd7d/32.png) [@hakim\_greenland](https://forum.ansible.com/u/hakim_greenland)\
**Post date:** [October 9, 2013, 2:04pm UTC](https://forum.ansible.com/t/group-by-vs-register-for-os-decision/13643/1 "2013-10-09T14:04:56Z")

</div>

Hello list,

I have a question concerning the group\_by example on git

[https://github.com/ansible/ansible-examples/blob/master/language\_features/group\_by.yml](https://github.com/ansible/ansible-examples/blob/master/language_features/group_by.yml)

I would like to see the register example too:

"

```auto

# Additionally, we can use the 'register' keyword in Ansible to set similar variables
# and use those for grouping. This is not shown in this example.
"

But could not find any. I am trying to migrate a quite complex ansible setup from the old only_if stuff to when. 
My OS specific task decisions have been based on only_if until now, and I would prefer for now to go on with something similar like the when statement for OS decisions. 
I am still using playbook includes.

Thanks...

```

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 9, 2013, 2:20pm UTC](https://forum.ansible.com/t/group-by-vs-register-for-os-decision/13643/2 "2013-10-09T14:20:46Z")

</div>

[http://ansibleworks.com/docs/playbooks\_best\_practices.html#operating-system-and-distribution-variance](http://ansibleworks.com/docs/playbooks_best_practices.html#operating-system-and-distribution-variance)
