# Use "register" local to a playbook (or unset a variable)

**URL:** <https://forum.ansible.com/t/use-register-local-to-a-playbook-or-unset-a-variable/21597>\
**Category:** Ansible Developer\
**Created:** [May 29, 2016, 2:09pm UTC](https://forum.ansible.com/t/use-register-local-to-a-playbook-or-unset-a-variable/21597 "2016-05-29T14:09:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serdyn\_du\_Toit](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Serdyn\_du\_Toit](https://forum.ansible.com/u/Serdyn_du_Toit)\
**Post date:** [May 29, 2016, 2:09pm UTC](https://forum.ansible.com/t/use-register-local-to-a-playbook-or-unset-a-variable/21597/1 "2016-05-29T14:09:13Z")

</div>

Hi,

How can I “register” a variable in a playbook - but in a way that it will no longer be set in subsequent playbooks that get executed.

It seems that if I declare the variable at the top of the playbook, as in this example:

---

<div class="post-metadata">

**Author:** ![Serdyn\_du\_Toit](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Serdyn\_du\_Toit](https://forum.ansible.com/u/Serdyn_du_Toit)\
**Post date:** [May 29, 2016, 9:05pm UTC](https://forum.ansible.com/t/use-register-local-to-a-playbook-or-unset-a-variable/21597/2 "2016-05-29T21:05:22Z")

</div>

Actually - I’m going to rename the variable to “tmp” and just use it every time if I need to “register” something that’s actually only local to the playbook.  
So basically recycling the variable - knowing that its value will be re-set (or fail to be re-set) each time I call a task using “register”. And having the coding convention of always using “tmp” for variables for these - I retain the full variable namespace for proper code.

Still, curious if there are a way to unset variables or maybe even use “register” in a way that is local to a playbook - but my code is working, so I’m happy 🙂
