" am running a playbook that connects to* remote host A*, and would like to
know if it is possible to run a *delegate_to:* command on the *remote host*
*A."*

The delegate_to keyword is there to supply a different host to run on than
one being traversed by Ansible's host loop.   If you are looping over the
playbook on A, and want to run the command on A, you would leave off the
delegate_to entirely.

I'm perhaps not understanding the question though.




On Tue, Aug 19, 2014 at 12:38 AM, Mike Trienis <[email protected]>
wrote:

> Hi All,
>
> I am running a playbook that connects to* remote host A*, and would like
> to know if it is possible to run a *delegate_to:* command on the *remote
> host* *A. *The use case is that I have two different types of
> environments, one that relies on /etc/hosts to resolve the domain, and
> another type of environment that uses DNS to resolve the domain. So if I
> run delegate_to: "my.host.com", it will either resolve to 127.0.0.1 in
> the case of a single instance, or it will resolve the public IP address in
> the case for a remote machine.
>
> - name: start all three mongodb services
>   delegate_to: "{{ item.host }}"
>   shell: creates=/var/lock/subsys/mongod-{{ item.name }}
> /etc/init.d/mongod-{{ item.name }} start
>   with_flattened:
>     - replication_servers
>
> Any help would be appreciated
>
> --
> 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/c196e116-ce13-4ca6-b169-f01fac80ff3c%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/c196e116-ce13-4ca6-b169-f01fac80ff3c%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%2BnsWgzO1YPdbBQLqDQ37ME6%2BYdkWyz4uLcTatcQRQFSQpcncw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to