Joanna,

Did you find any solution to this? I'm facing the same issue and it sure 
sucks!

Thanks!

On Wednesday, June 29, 2016 at 1:43:39 PM UTC-5, Joanna Delaporte wrote:
>
> Here's my version: ansible 2.2.0 (devel 87928ff56b) last updated 
> 2016/06/22 13:32:23 (GMT -500)
>
> I'm not sure if this is a bug, or misplaced syntax. When I attempt to use 
> a dictionary, referencing the key of the dictionary and a subelement, I get 
> the error
> FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'key'"}
>
> Here is my task:
>   - name: Add users to groups
>     shell: 'ipa group-add-member {{item.1}} --users={{item.0.key}}'
>     with_subelements:
>     - '{{staff|default([])}}'
>     - 'extragroups'
>     - skip_missing: yes
>
>
> If I use item.0 instead of item.0.key, it tries to pass in the entire 
> dictionary object rather than just the key, and the command spits back a 
> "too many arguments" error, which is expected. I need just the username, eg 
> the argument I want to pass is --users=user1. Is there a reason I cannot 
> access it with item.0.key?
>
> My dict object looks like this:
> ---
> staff:
>   user1:
>     uid: 
>     firstname: 
>     lastname:  
>     comment: ""
>     gid: 
>     shell: /bin/bash
>     passwordhash: ""
>     primarygroup: 
>     extragroups: ['code']
>   user2:
>     uid: 
>     firstname: 
>     lastname: 
>     comment: ""
>     gid: 
>     shell: /bin/bash
>     passwordhash: ""
>     primarygroup: 
>     extragroups: ['dm', 'code']
>
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/52bb457e-6b09-4c66-b619-4cc0074a8eef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to