Fix formatting of set_fact for ansible_become_pass #758
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a problem that causes
Incorrect sudo password
under specific circumstances:server.yml
(notdeploy.yml
)sshd_permit_root_login: false
so the
remote-user
role does aset_fact
ofansible_user: "{{ admin_user }}"
I can only produce in context (not in a separate playbook for debugging). To reproduce:
Yields:
It appears that with Ansible 2.2.1.0,
ansible_become_pass
is being submitted to the server as{% raw %}exa{{mple_password{% endraw %}
which is anIncorrect sudo password
.This PR makes Trellis submit the correct value of
new_var
(no{% raw %}
tags submitted to server).This PR moves the
{% raw %}
wrapper to the outer edges of theansible_become_pass
definition. In a group_vars context, that would cause the wrapper's contents to no longer be templated. But this does not hold true in theset_fact
context.Here's my best guess at how to articulate the contrast:
{% raw %}
wrapper appearing in here prevents the wrapper's contents from being templated later at time of consumption.set_fact
task context has an initial phase of "consuming" the variables present, then switches into a "load up the YAML" phase when it loads up the facts. A{% raw %}
wrapper appearing in the task context seems irrelevant for the duration of the task's initial "consuming" phase. For that moment, the{% raw %}
string is just a meaningless string, not a jinja control structure, so the vars among the wrapper's contents are consumed/templated first, before anything else.