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 does ansible work?
What is the way to access shell environment variables in ansible?
How would you install ansible on a centos system?
How do I loop over a list of hosts in a group, inside of a template?
How do I handle python pathing not having a python 2.x in /usr/bin/python on a remote machine?
What are ad-hoc commands?
How can you connect other devices within ansible?
What are the ansible modules? Explain the different types.
What is ansible role and how are they different from the playbook?
How do I see all the inventory vars defined for my host?
How can you create a lamp stack and deploy a webpage by using ansible?
How do I speed up management inside ec2?