On Friday, 7 March 2014 01:13:54 UTC+8, Michael DeHaan wrote:
>
> Tyipcially you wouldn't create different host records just to connect to 
> them as different users, but would specify this as "-u" to the playbook 
> execution.
>
> That way if I need to do something for all users in all hosts in the 
environments, I would have to execute playbooks manually per each user. 
This kind of defeats the purpose of automation in my mind.
 

> And while you can keep variables inline with ":vars", I would generally 
> recommend group_vars/ and host_vars/ files for nearly everyone, they are 
> cleaner
> and can also help represent structured data.
>

I understand that and just find it easier to have vars in the same file and 
format as inventory. Need to get used to switching between yaml and 
property files. :)
 

> It's definitely fine to set ansible_ssh_user there, but having hte "-user" 
> as part of the host name is a bit unusual.
>
> Also if you have different environments that are not managed together, I 
> usually recommend seperate inventory files for them, keeps it simpler in 
> most cases.
>

Yes, I already do that, not pointed out for the sake of simpicity.

Regards,
Aleksey Maksimov 

>
>
>
>
> On Wed, Mar 5, 2014 at 10:53 PM, Aleksey Maksimov 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> I am just starting with Ansible and have questions on how to better 
>> structure my inventory file(s).
>>
>> Here is what I have:
>>
>> Multiple hosts, assigned to different environments.
>>
>> test1 -> host1, host2, host3
>> test2 -> host4, host5, host6
>>
>> On each of those hosts I have multiple users, that used to run various 
>> software components and such users have to be configured differently.
>>
>> I've put this to inventory like this:
>>
>> [test1-host1]
>> test1-host1-user1 ansible_ssh_user=user1
>> test1-host1-user2 ansible_ssh_user=user2
>>
>> [test1-host1:vars]
>> ansible_ssh_host=host1_name
>>
>> [test1-host2]
>> test1-host2-user3 ansible_ssh_user=user3
>> test1-host2-user4 ansible_ssh_user=user4
>>
>> [test1-host2]
>> ansible_ssh_host=host2_name
>>
>> Am I doing my inventory right?
>>
>> Regards,
>> Aleksey Maksimov
>>  
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d95c5f06-26ff-4957-b3af-f0deac330f03%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/d95c5f06-26ff-4957-b3af-f0deac330f03%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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/deedfab1-a8dc-48cd-b70d-1f667c186bab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to