New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emphasise variable_start_string
/variable_end_string
affects templated vars
#80997
Conversation
Setting e.g. the 'variable_start_string' and 'variable_end_string' parameters of the 'ansible.builtin.template' module will affect evaluation of any templated variables defined in the same step. Add an example demonstrating this along with notes for each of '*_start_string' and '*_end_string' parameters. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Closes: ansible#80996
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
@@ -48,35 +48,43 @@ class ModuleDocFragment(object): | |||
block_start_string: | |||
description: | |||
- The string marking the beginning of a block. | |||
- This will affect evaluation of templated variables in the same step. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would just add this once, to the notes:
section
variable_start_string: "<<" | ||
variable_end_string: ">>" | ||
vars: | ||
vip_address: "<< hostvars['controller-00']['ansible_host'] >>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is NOT limited to vars defined in task, but to ANY vars used in the template, no matter where they are defined.
I think we may be starting to question this behavior. I might recommend holding off on merging this PR until we can decide whether we want to change the behavior to align with the |
I'm going to close this as resolved by #81005 That PR changes the behavior so that this arguments only affect the template itself and not dependent variables. |
Awesome. Thank you! 🙏 |
SUMMARY
Fixes #80996
ISSUE TYPE
COMPONENT NAME
lib/ansible/modules/template.py
ADDITIONAL INFORMATION
None.