How to configure slaves with custom ssh port in Ansible

Ssh service is using the port 22 by default for all Linux servers. Ansible does not requires any additional port configuration for such slave servers.

But some times ssh port might be changed from default as the part of security configurations.

In such situations, we need to specify the port number aloing with the ipaddress in Ansible hosts file to avoid connection error.

[my_server]
slaveserverip:sshport

Here the slaveserverip and sshport need to be replaced accordingly.

If the ansible is using inventory files, same kind of modification is required there also.

That's all…

Leave a Reply

Your email address will not be published. Required fields are marked *