# Prevent variable overwrite in skipped tasks

**URL:** <https://forum.ansible.com/t/prevent-variable-overwrite-in-skipped-tasks/17242>\
**Category:** Ansible Project\
**Created:** [January 12, 2015, 3:15pm UTC](https://forum.ansible.com/t/prevent-variable-overwrite-in-skipped-tasks/17242 "2015-01-12T15:15:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill\_Rosenburg](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@Bill\_Rosenburg](https://forum.ansible.com/u/Bill_Rosenburg)\
**Post date:** [January 12, 2015, 3:15pm UTC](https://forum.ansible.com/t/prevent-variable-overwrite-in-skipped-tasks/17242/1 "2015-01-12T15:15:46Z")

</div>

This is the first time I hit wall with ansible after thousands lines of yaml so maybe I’m missing something.

I have a main playbook a.yml:

- include b.yml

- include c.yml  
when: 0 == 1

- debug: var=x

where both b.yml and c.yml set value of ‘x’ variable. I understand that this is by design yet if I have a single role with two separate flows setting same variables I found no way to work around this and skip c.yml entirely.

Did anyone try do hack this directly in ansible source? I need to comment out portion where ansible assigns {‘skipped’: True} to my variable.

Thanks,  
Bill

---

<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:** [January 13, 2015, 1:59pm UTC](https://forum.ansible.com/t/prevent-variable-overwrite-in-skipped-tasks/17242/2 "2015-01-13T13:59:41Z")

</div>

ansible sets registered variables on skipped tasks so you can query  
them for setvar|skipped, I suggest you name the vars differently and  
set a 'x' var depending on the value of those 2.
