mirror of https://github.com/ansible/ansible.git
template lookup: fix regression when templating hostvars (#64070)
This fixes a regression that was caused by switching from copy() to
deepcopy() when 'saving' variables before templating. Since HostVars
did not implement the __deepcopy__() method, deepcopy returned incorrect
results when host vars were present in the variables.
Fixes #63940
(cherry picked from commit cd8ce16d48)
pull/64756/head
parent
26e8474f6d
commit
c44cd68aa2
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- template lookup - fix regression when templating hostvars (https://github.com/ansible/ansible/issues/63940)
|
||||
@ -0,0 +1 @@
|
||||
h1 ansible_connection=local host_var=foo
|
||||
@ -0,0 +1,10 @@
|
||||
- hosts: h1
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- set_fact:
|
||||
templated_foo: "{{ lookup('template', 'template.in') }}"
|
||||
|
||||
- name: Test that the hostvar was templated correctly
|
||||
assert:
|
||||
that:
|
||||
- templated_foo == "foo\n"
|
||||
@ -0,0 +1 @@
|
||||
{{hostvars['h1'].host_var}}
|
||||
Loading…
Reference in New Issue