How do I handle different machines needing different user accounts or ports to log in with?
Answer / Kumar Sourav
To handle situations where different machines require different user accounts and/or ports for logging in using Ansible, you can create specific inventory entries for each machine and override the default settings:n1. Define custom inventory entries: In your inventory file, define separate entries for each machine with their respective user account and port.nExample:nhost1:n ansible_user: myusernamen ansible_port: 2222nhost2:n ansible_user: anotherusernamen ansible_port: 3333nn2. Use the custom inventory entries in your playbook: When running tasks, Ansible will use the specified user account and port for each machine.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to create encrypted files using ansible?
What are ansible vaults?
Enlist the differences between variable name and environment variables.
How do I handle python pathing not having a python 2.x in /usr/bin/python on a remote machine?
When should I use {{ }}?
Explain different modules in ansible.
How can one interpolate variables or dynamic variable names?
Desired to gain proficiency on ansible?
What features does the ansible tower provide?
How do I copy files recursively onto a target host?
How do I configure a jump host to access servers that I have no direct access to?
How to keep secret data in a playbook?