Not sure if you want to, but technically possible:

[pirates]
alias1 ansible_ssh_host=foo.example.com ansible_ssh_user=westley

[mercenaries]
alias2 ansible_ssh_host=foo.example.com ansible_ssh_user=inigo

Just don't write plays that target "hosts: all" in that case, as you'll
work on servers twice.




On Fri, May 23, 2014 at 3:57 AM, Robin Speekenbrink <
[email protected]> wrote:

> Michael,
>
> Thanks for the response. This clears up why all variables would be used.
> How then would i achieve my goal of having two seperate logins per machine?
> (one on the psysical host and the other on the environment inside it?)
> The IP adress would be the same, the hostname could be the same and i'd
> hate to have to register seperate DNS entries just to alter the SSH-port ;)
>
> Thanks in advance!
>
> Robin
>
> Op donderdag 15 mei 2014 00:17:20 UTC+2 schreef Michael DeHaan:
>>
>> "But when calling ansible containers the information from the hosts are
>> used.. "
>>
>> This is correct.  Variables are brought in from all the groups a host is
>> a member of, not just the hosts you are selecting.
>>
>> Imagine you have hosts grouped by function (webservers, dbservers),
>> datacenter (phoenix, atlanta), and also hardware type (dell3200, ibm286),
>> etc.
>>
>> Some hardware information might come from the hardware group, but you
>> selected the webserver group to configure.
>>
>> Thus variables should come from all sources.
>>
>>
>>
>>
>>
>>
>> On Wed, May 14, 2014 at 3:38 AM, Robin Speekenbrink <
>> [email protected]> wrote:
>>
>>> Just a quick question:
>>> I have a docker container running an SSH daemon on a host running an SSH
>>> deamon both with different users and ports... Thus my invenvory looks
>>> something like this:
>>> [hosts:vars]
>>> ansible_ssh_user=hroot
>>> ansible_ssh_port=2221
>>>
>>> [hosts]
>>> host1
>>> host2
>>>
>>> [containers:vars]
>>> ansible_ssh_user=croot
>>> ansible_ssh_port=2222
>>>
>>> [containers]
>>> host1
>>> host2
>>>
>>> But when calling ansible containers the information from the hosts are
>>> used..
>>>
>>> Another thing in my situation: the hosts lists themselves (host1 and
>>> host2 in my example) should be dynamic since the're running in an
>>> autoscaling EC2 cloud :D
>>> Am i doing it wrong? :)
>>>
>>> Thanks!
>>>
>>> Robin
>>>
>>> --
>>> 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/4e07df6a-c680-48c9-956d-
>>> 8ac45638947b%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/4e07df6a-c680-48c9-956d-8ac45638947b%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/4d748b4d-199c-44d9-a2d1-ec6219ab4863%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/4d748b4d-199c-44d9-a2d1-ec6219ab4863%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%2BnsWgx6AFi274s6BtuCUM4owT3c-ocGbcDeh-tv43tbuVOcCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to