Hi all,

I'm trying to work with vars in a vars file inside a role, and I'm unable 
to make it work. I'm working from 
http://docs.ansible.com/ansible/playbooks_loops.html#standard-loops. Any 
pointers on what I'm doing wrong would be much appreciated.

I'm using 2.1.0 from Git on Debian.


If I have the following task in my role, it works as expected:

---
- name: Add groups
  group: name={{ item.name }} gid={{ item.gid }} state=present
  with_items:
    - { name: 'g1', gid: '1010' }
    - { name: 'g2', gid: '1011' }


However, if I try and use the vars in roles/rolename/vars/mail.yml and 
modify my role, I get the following error:

fatal: [myhost]: FAILED! => {"failed": true, "msg": "'unicode object' has 
> no attribute 'gid'"}
>

If I remove the gid={{{ item.gid }} part of my task, then the message 
changes to  

> fatal: [myhost]: FAILED! => {"failed": true, "msg": "'unicode object' has 
> no attribute 'name'"}
>


tasks/groups.yml
---
- name: Add groups
  group: name={{ item.name }} gid={{ item.gid }} state=present
  with_items: "{{groups}}"


vars/main.yml
groups:
    - { name: 'g1', gid: '1010' }
    - { name: 'g2', gid: '1011' }


Thanks!

-- 
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/db04deb9-3b2b-433f-8090-6c9c5019c6ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to