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

-- 
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/560B1BF6.3090304%40gaspard.io.
For more options, visit https://groups.google.com/d/optout.

Reply via email to