Remove redundant vars FA on PlaybookInclude (#85395)

* The redundant FA declaration was not static, which broke a number of automatic validation behaviors.
* Added tests to assert deferred validation and lack of templating on `import_playbook.vars`.

Co-authored-by: Matt Clay <matt@mystile.com>
This commit is contained in:
Matt Davis
2025-06-26 11:34:29 -07:00
committed by GitHub
co-authored by Matt Clay
parent 29cdba1fee
commit 73369f53af
3 changed files with 18 additions and 1 deletions
@@ -0,0 +1,6 @@
- hosts: localhost
gather_facts: no
tasks:
- name: Verify an imported playbook can see a var it was given
assert:
that: pb_var == 'hello'
@@ -20,3 +20,15 @@
# https://github.com/ansible/ansible/issues/59548
- import_playbook: sub_playbook/sub_playbook.yml
- name: Use set_fact to declare a variable
hosts: localhost
gather_facts: no
tasks:
- set_fact:
a_var_from_set_fact: hello
- name: Verify vars for import_playbook are not templated too early
import_playbook: playbook_using_a_var.yml
vars:
pb_var: "{{ a_var_from_set_fact }}"