Ansible 2.0.0-0.2.alpha2: roles and with_items?

50 views
Skip to first unread message

Leo Gaspard

unread,
Sep 30, 2015, 9:45:06 AM9/30/15
to Ansible Project
Hello,

This being my first post on this mailing list, please tell me if I break
any custom.

I am trying to write a role that uses `with_items` along with `roles`.

However, I am currently stumbling upon a weird thing: I cannot use {{
item }} for role variable definitions.

Here is a MWE:

File vpnclients.yml
==========8<==========
---
- hosts: vpnclients
roles:
- role: openvpn-client
openvpn_client_server: "{{ item }}"
with_items: "{{ groups['vpnservers'] }}"
==========>8==========

File roles/openvpn-client/tasks/main.yml
==========8<==========
---
- debug: msg='calling for server {{ openvpn_client_server }}'
==========>8==========

Error message
==========8<===========
fatal: [hostname]: FAILED! => {"failed": true, "msg": "ERROR! ERROR!
'item' is undefined"}
==========>8==========

Without the {{ openvpn_client_server }} part, it works.

Hoping for any help, and thanking you in advance,

Leo Gaspard

Leo Gaspard

unread,
Sep 30, 2015, 9:45:06 AM9/30/15
to Ansible Project
PS: Same issue with branch devel ; at a89412e ; with as only
modification the replacement of the header of ansible-playbook from
"#!/usr/bin/env python" to "#!/usr/bin/env python2".

Leo Gaspard

unread,
Oct 2, 2015, 1:49:00 AM10/2/15
to ansible...@googlegroups.com
Upping this message once, if I do nothing wrong I'll try filing an issue
on GitHub.
Reply all
Reply to author
Forward
0 new messages