Ansible change ssh port in playbook


Here is the inventory file

and my playbook is look like this:

In role de-servers-setup role the ssh port is changed from 22 to 8888, so when the last task is called it fails because it cannot connect to host through 22 port. How to overcome this ssh port change?


In the role de-server-setup add a task to change the ansible_port host variable.

Leave a Reply