You are using lists for every key (comment, group, shell, ...) whereas with
the subelements loop, you can only have a list for the group subkey (as per
your task)


On 20 May 2014 12:05, Joachim Friberg <[email protected]> wrote:

> Hi,
>
> I'm trying to push the limits of "subelements" but I can't figure out how..
> Part of my task/main.yml
> - name: Prepare for Shinken|user
>   user: name={{ item.0.name }}
>         comment={{ item.0.comment }}
>         group={{ item.0.group }}
>         shell={{ item.0.shell }}
>         password={{ item.0.password }}
>         state=present
>         update_password=on_create
>   with_subelements:
>    - users
>    - group
> my var/main.yml
> ---
> users:
>   - name: shinken
>     comment:
>      - "Shinken.user"
>     group:
>      - "shinken"
>     shell:
>      - "/bin/bash"
>     password:
>      -
> "$6$cGTFMo0u$DPyI81Yn/9lFbAVMtTRy0vSXfn00ZaeBPg754BzDx7Aj6B6WZGicfjOjkeY9upT8HPvKV2voQ1SNuWIF2hfEi/"
>
> This is what I get:
> < TASK: shinken | Prepare for Shinken|user >
>  ------------------------------------------
>         \   ^__^
>          \  (oo)\_______
>             (__)\       )\/\
>                 ||----w |
>                 ||     ||
>
>
> failed: [192.168.7.200] => (item=({'comment': ['Shinken.user'],
> 'password':
> ['$6$cGTFMo0u$DPyI81Yn/9lFbAVMtTRy0vSXfn00ZaeBPg754BzDx7Aj6B6WZGicfjOjkeY9upT8HPvKV2voQ1SNuWIF2hfEi/'],
> 'shell': ['/bin/bash'], 'name': 'shinken'}, 'shinken')) => {"failed": true,
> "item": [{"comment": ["Shinken.user"], "name": "shinken", "password":
> ["$6$cGTFMo0u$DPyI81Yn/9lFbAVMtTRy0vSXfn00ZaeBPg754BzDx7Aj6B6WZGicfjOjkeY9upT8HPvKV2voQ1SNuWIF2hfEi/"],
> "shell": ["/bin/bash"]}, "shinken"], "name": "shinken", "rc": 3}
> msg: useradd: invalid shell '[/bin/bash]'
>
>
> FATAL: all hosts have already failed -- aborting
>
>
> It looks like Ansible is not removing the "[]" from the list of elemets.
> How would you do? Is it possible to do as I'm trying?
>
>  --
> 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/f811da11-3cc5-4670-ad5f-05ae0cab9ad5%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/f811da11-3cc5-4670-ad5f-05ae0cab9ad5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAEhzMJBfTN24V4zUj0D%3DDF3q8TmZhfC1_ri1iLTXnsxSENnoJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to