So here’s the issue:
I recently installed ansible on redhat linux . This came with ansible.windows 1.8.0. I used an ansible.windows.template to create a simple j2 like this
inputs.j2:
hello = {{ hello_variable }}
This is an ascii text file, which I have confirmed.
This is called from a role, and in the roles’ defaults/main.yml file I set this
main.yml (variables)
hello_variable: “hello world”
When running on 1.8 (ansible 2.11.*, python 3.6) this had no problems. The file was copied to a target host, and the variable was correctly substituted.
However, I updated to match the other system, updating ansible to ansible [core 2.19.3], ansible.windows 1.14, and python 3.11.
When I did this, the file is still being copied. However, the variable is no longer being substituted.
After a day of looking around and getting little help, I actually dove down into the source of the action plugin
            with self._templar.set_temporary_context(searchpath=searchpath, newline_sequence=newline_sequence,
                                                     block_start_string=block_start_string, block_end_string=block_end_string,
                                                     variable_start_string=variable_start_string, variable_end_string=variable_end_string,
                                                     trim_blocks=trim_blocks, lstrip_blocks=lstrip_blocks,
                                                     available_variables=temp_vars):
                resultant = self._templar.do_template(template_data, preserve_trailing_newlines=True, escape_backslashes=False)
                display.vvv(f"BDP Value of tempvars: {temp_vars}")
                display.vvv(f"BDP Value of template data: {template_data}")
                display.vvv(f"BDP Value of resultant: {resultant}")
I can see the hello_variable in the temp_vars, I can see the template data going in as written, but it comes out into resultant unchanged.
What else is interesting is that the other system , which I am matching (same version of ansible.windows, I have a slightly later version of ansible ) , it still runs as it should – it substitutes correctly with this code. But on my current system, it will not substitute the variable despite obviously being able to find it in temp_vars.
So I’m at a loss. Any ideas? Most likely, I’ve done something crazy in my environment and there’s nothing wrong with the template or variable declarations themselves (they do, after all , work on the other machine). I’m trying to figure out how to get it working on my system again; I’ve already tried re-installing ansible and rolling back to the earlier collections but this did not help.
Any suggestions?