On Tuesday, February 25, 2014 8:58:26 AM UTC-8, Petr Sukharev wrote:
>
> Hello!
>
> I am newby in ansible world, but i like this tool and i try to use in my
> enviroment..
> I have some question about user managment, and can't get solution :(
> I have several projects (test, developer, production and same) I make
> separate folders for this projects with contain hosts, main.yml,
> ansible.cfg and roles folder... I try to add user accounts by adding
> special role- user_ssh, like this:
>
>> - name: Add ssh user
>> user: name={{ item.user }} shell={{ item.shell }} groups='admins'
>> with_items:
>> - $ssh_users
>
>
> Variable ssh_users i use in play-book and use it for any host grous. It
> looks like this:
>
>> - hosts: apps
>> vars:
>> - ssh_users:
>> - $user1
>> - $user2
>>
> In next group (db for example) i use different values for ssh_users
> variable (like user1 and user3)
>
>
1) You are mixing old style variables with new style variables... (replace
$var with {{ var }})
2) in your play you have item.name and item.shell but you are only passing
in a single variable
try something like this for your variables...
vars:
ssh_users:
- {{ name: user1, shell: /bin/ksh }}
- {{ name: user2, shell: /bin/bash }}
I hope that this helps,
Adam
>
>
--
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/c2a24f2e-10ac-466e-8aa2-b6d28baf1f0a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.