I've discovered behavior that seems to indicate that Ansible's handling of variables and facts is even more brittle than I had originally guessed. I hope that's not the case; I hope I'm just being dense.
Could someone verify whether the following behavior is intended? If so, I'll just go back to using Bash scripts.
$ ansible-playbook -i=localhost, play1.yml
ERROR! 'test_fact' is undefined
$ cat play1.yml
# play1.yml
---
- hosts: localhost
tasks:
- set_fact: test_fact='hello'
- include: "{{ test_fact }}"
$ ansible-playbook -i=localhost, play2.yml
ERROR! 'test_fact' is undefined
$ cat play2.yml
# play2.yml
---
- hosts: localhost
vars:
test_fact: 'hello'
- include: "{{ test_fact }}"