# Automaticly register task results for the next task

**URL:** <https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048>\
**Category:** Ansible Developer\
**Created:** [December 19, 2015, 9:15am UTC](https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048 "2015-12-19T09:15:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [December 19, 2015, 9:15am UTC](https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048/1 "2015-12-19T09:15:09Z")

</div>

Hello,

Would it make sense to have task results be automatically registered for every task under a pre-defined name? This would eliminate all the “register” lines with ad-hoc names used just for the next task.

Users wishing to persist the results for more than the next task could still use “register” to specify a name. Otherwise the results from the previous task get thrown out on moving on to the next one. That way, all current playbooks would continue to work as expected.

Regards,  
Giovanni

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [December 19, 2015, 11:25am UTC](https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048/2 "2015-12-19T11:25:08Z")

</div>

​IIRC there has been some discussion on the idea of a default "last  
registered​" kind of register some (longer) time ago. I believe it was  
concluded to not go that way, but I don't remember the details.

---

<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:** [December 19, 2015, 3:42pm UTC](https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048/3 "2015-12-19T15:42:48Z")

</div>

I believe in the end, “explicit is better than implicit” was the main idea behind leaving it as requiring explicit registering.

I still stand behind this decision.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [December 19, 2015, 4:52pm UTC](https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048/4 "2015-12-19T16:52:50Z")

</div>

I've been thinking of adding `ansible_task_results` as this would be  
needed for the 'rescue' side of a block, the proposal we removed was a  
$\_ similar thing that would give access to the "current tasks's  
reigster data". This would be slightly different, but still I prefer  
explicit declarations.

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [December 19, 2015, 10:36pm UTC](https://forum.ansible.com/t/automaticly-register-task-results-for-the-next-task/20048/5 "2015-12-19T22:36:25Z")

</div>

I think the implicit register would be a light cognitive load while making things easier and the code cleaner (without any backward compatibility issues maybe?), but I understand the benefits of doing things explicitly and maybe that’s not worth compromising.

Thanks for filling me in on the background context for this. Much appreciated. Btw, v2.0 is looking seriously good 🙂

Giovanni
