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
Ansible2 : roles
and with_items
#12623
Comments
@Ekleog this is not supported syntax. You cannot use with_ loops on roles in this manner, and any loops should be done within the role. If you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:
Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved. Thank you! |
@jimi-c According to ansible-example/language_features/roletest2.yml, this should be supported. Any idea if this worked at one point, but was later removed? We should probably update the example if that's the case. https://github.com/ansible/ansible-examples/blob/master/language_features/roletest2.yml |
I got the same problem, and I found this: http://rogersherman.com/a-simple-how-to-passing-a-loop-to-an-ansible-role/ |
@skinlayers that example using with_items was modified the day after @PumpkinSeed's comment in commit ansible/ansible-examples@f72887a |
Issue Type:
Bug Report
Ansible Version:
Also tested with
v2.0.0-0.2-alpha2
; I can test with any other version of your choice.Ansible Configuration:
I changed
#!/usr/bin/env python
to/usr/bin/env python2
inansible-playbook
.Changes to
/etc/ansible/ansible.cfg
; excluding comment-only hunks, result ofdiff /etc/ansible/ansible.cfg examples/ansible.cfg
:Environment:
Running on Archlinux, managing using
local
connection.Summary:
I am trying to write a role that uses
with_items
along withroles
, with Ansible 2. Unfortunately, theitem
variable does not seem exported.Steps To Reproduce:
Try running the following playbook, that includes a dummy role.
File
vpnclients.yml
File
roles/openvpn-client/tasks/main.yml
Expected Results:
Without the
{{ openvpn_client_server }}
part, I get the expectedcalling for server
output.Actual Results:
Instead, with the
{{ openvpn_client_server }}
part, I get the following error message:The text was updated successfully, but these errors were encountered: