Specifying SSH port in Ansible Inventory

There may be some instances where you set a custom port for SSH on your network device. If ssh port for hosts is different than the default port 22, it can be specified in the inventory file with colon (:) after hostname.

#vi inventory
# Inventory file for Ansible
 [XE]
ios-xe-mgmt.cisco.com:8181
ios-xe-mgmt-latest.cisco.com:8181
 [XR]
sbx-iosxr-mgmt.cisco.com:8181


Comments

Popular posts from this blog

Ansible-Playbook to display output of multiple show commands (using stdout_lines with Loop)

Filtering Routes in BGP using Route-maps and Prefix-list

Ansible-playbook for backing up running config of Cisco IOS

Ansible Playbook for Network OS Upgrade with pre and post checks

Cisco ASA Active/Active Failover Configuration

VMware NSX Traffic Flow — East-West & North-South

Export or Backup Azure Network Security Groups into CSV using PowerShell

Get Model Number and Serial number of Cisco devices using ios_facts module