Slavek,

I converted my dicts to lists. :P It didn't take too long with some snappy
regex in vim.

Joanna

On Thu, Oct 13, 2016 at 9:06 AM, Slavek Jurkowski <[email protected]>
wrote:

> 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 a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/4jqKl1v69mI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/52bb457e-6b09-4c66-b619-4cc0074a8eef%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/52bb457e-6b09-4c66-b619-4cc0074a8eef%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Joanna Delaporte
Linux Systems Administrator | Parkland College
[email protected]

-- 
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/CAG5Enc%2Bev%2BJCMrJ964oy1Gdao%3DryBQ7Nywc06ppy4_%2Bx2Q0DVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to