Prevent variable overwrite in skipped tasks

349 views
Skip to first unread message

Bill Rosenburg

unread,
Jan 12, 2015, 10:15:46 AM1/12/15
to ansible...@googlegroups.com
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


Brian Coca

unread,
Jan 13, 2015, 8:59:44 AM1/13/15
to ansible...@googlegroups.com
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.


--
Brian Coca
Reply all
Reply to author
Forward
0 new messages