hash_merge would only merge hashes, not lists.

So if you instead had users keyed such that they were in the hash based on
the username, that would work.

users:
    dev:
       name: dev
       groups: ['dev']
       uid: 2001

etc

The extra "name" may also be redundant, but this should get you on the
right track.




On Fri, Aug 8, 2014 at 2:36 PM, <[email protected]> wrote:

> I have a playbook with a role that creates users that are defined in
> group_vars/all, similar to this role
> https://galaxy.ansible.com/list#/roles/51.  When I define a user in the
> host_vars/foo it takes over precedence and does not add the users I have in
> group_vars/all.  I have set hash_behaviour = merge in my ansible.cfg.  Is
> this expected behavior? My use case is I have my sysadmin users defined in
> group_vars/all that should be present on all hosts and I want to give
> access to a dev on the foo host only. Is there a better way to approach
> this?
>
> group_vars/all
>
> users:
>  - username: sysadmin
>    name: sysadmin
>    groups: ['sysadmin']
>    uid: 1001
>    ssh_key:
>      - "ssh-rsa AAAA.....ZZZZ"
>
> host_vars/foo
>
> users:
>  - username: dev
>    name: dev
>    groups: ['dev']
>    uid: 2001
>    ssh_key:
>      - "ssh-rsa AAAA.....ZZZZ"
>
> 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/ebf7b51e-808a-4aed-a4f2-98f63e980b81%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ebf7b51e-808a-4aed-a4f2-98f63e980b81%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/CA%2BnsWgyNma42DRzmRyVLBbFnnbKTSaRVv3V21Sd8CCD96iYSSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to