Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

stephenfin
Copy link

SUMMARY

Fixes #80996

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME
  • lib/ansible/modules/template.py
ADDITIONAL INFORMATION

None.

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>
@ansibot ansibot added affects_2.16 docs This issue/PR relates to or includes documentation. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. labels Jun 8, 2023
@@ -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.
Copy link
Member

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'] >>"
Copy link
Member

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.

@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Jun 8, 2023
@sivel
Copy link
Member

sivel commented Jun 8, 2023

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 #jinja2 header.

@sivel
Copy link
Member

sivel commented Jun 13, 2023

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.

@sivel sivel closed this Jun 13, 2023
@stephenfin
Copy link
Author

Awesome. Thank you! 🙏

@stephenfin stephenfin deleted the issue-80996 branch June 17, 2023 02:14
@ansible ansible locked and limited conversation to collaborators Jun 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.16 docs This issue/PR relates to or includes documentation. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emphasise variable_start_string/variable_end_string affects templated vars
5 participants