No I want to send the IP address of "server" as a command line argument to 
a script which is be run on "client"
client and server are 2 separate nodes - not the host on which ansible is 
running.

{{ inventory_hostname }} has all hosts in it. I'm looking for a particular 
host from the group "server" out of them.
On Friday, 19 December 2014 18:12:21 UTC+5, Matt Martz wrote:
>
> I believe you are looking for the inventory_hostname variable.
>
> I also tend to use this in combination with ansible_ssh_host for 
> completeness, such as:
>
> {{ ansible_ssh_host|default(inventory_hostname) }}
>
> On Friday, December 19, 2014, Fazal-e-Rehman Khan <[email protected] 
> <javascript:>> wrote:
>
>> Dear All,
>>
>> My hosts file looks like this.
>>
>> [client]
>> 192.168.1.23
>>
>> [server]
>> 192.168.1.24
>>
>> [exchange]
>> 192.168.1.25
>>
>> In my playbook, I want to run a script on a remote machine ("client" in 
>> my case) which requires the IP address of the other remote machine (server) 
>> as an cmd line argument to that script. My playbook looks like this.
>>
>> hosts: client
>> tasks:
>>    - shell: myscript.sh {{ server }} {{ somevalue }}
>>
>> What should I do? Please help.
>>
>> Regards,
>> Fazal-e-Rehman Khan
>>
>>  -- 
>> 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/b4f0839b-e89f-428a-9162-86f310dbcb3b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/b4f0839b-e89f-428a-9162-86f310dbcb3b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>
>

-- 
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/08122bf8-71e7-472c-8c6a-0f14d920507e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to