Hi Raphael,

Is the host you are trying to delegate the task to part of your inventory?

My next try would be to add this host in the inventory and specify the
custom port for this particular host as a host variable. An example can be
found here:
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#assigning-a-variable-to-one-machine-host-variables

I hope that helps!

Regards, Juerg

On Thu, Feb 25, 2021 at 9:30 PM Raphael Ebner <[email protected]>
wrote:

> Hi Community,
>
> I need to delegate one task in my play to another remote linux ssh host
> with delegate_to. So far so good. But now the problem: my remote host has a
> custom ssh port. When running the play I always get "Failed to connect to
> the host via ssh: ssh: connect to host x.x.x.x port 22: Connection timed
> out". How can I specify at task level a custom ssh port for delegate_to?
>
> I already tried: "delegate_to: IP:PORT" and setting "ansible_port: PORT"
> at task level, but without success.
>
> May someone has an idea how to handle this problem?
>
> Regards,
> Raphael
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/fbd59df7-f298-4f7a-90a0-64b7f94f8a24n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/fbd59df7-f298-4f7a-90a0-64b7f94f8a24n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

Jürg Ritter, RHCE
Consultant

Red Hat Switzerland <https://www.redhat.com/>

Europaallee 41

CH-8021 Zürich

[email protected]
M: +41-(0)79-715-09-90
<https://www.redhat.com/>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFjmT8nonYqPhZHCAO9WO41cv_M7iwFpQU-j0%2BrG76%2Bud_WQ4w%40mail.gmail.com.

Reply via email to