as long as the server group only has 1 ip:

hosts: client
tasks:
   - shell: myscript.sh {{ groups['server'] }} {{ somevalue }}

On Fri, Dec 19, 2014 at 8:30 AM, Fazal-e-Rehman Khan
<[email protected]> wrote:
> 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]>
>> 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.
>>> 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/f4ccc7ed-e769-40f3-861a-a01d538f6d33%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca

-- 
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/CAJ5XC8krGbyd373TP_svmN-g1dFGKmP1Lv5gdQC1YdEWCboSLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to