Hello,
I'm trying to create a new string from the keys of a dictionary in a Ninja
2 template. But the variable I'm updating in the for loop seems to reset
when the for loop finishes... The following piece of template is just a
test to try demonstrate my issue:
{% set ssh_allowusers = 'root' %}
{% for x in dictusers %}
{{ssh_allowusers }} + {{ x }}
{% set ssh_allowusers = ssh_allowusers ~ ' ' ~ x %}
{{ssh_allowusers }}
{% endfor %}
Post Loop: {{ssh_allowusers }}
dict_users:
dictusers:
willemdh:
shell: /bin/zsh
groups: wheel
shortname: Willem
ansi:
shell: /bin/sh
groups: sysusers,wheel
shortname: Willem
But output is:
root + ansi
root ansi
root ansi + willemdh
root ansi willemdh
Post Loop: root
Why would the variable reset to 'root' after the loop?
Grtz
Willem
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/bee0d51a-a834-452c-b6af-2da168789e32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.