0

What are the best practices to be followed wrt security when it comes to SSH authentication (password less, key based, etc.) when setting up Ansible in a new environment with 1000s of machines? Which is the best method of using passwordless SSH in an enterprise environment and why?

1 Answer 1

1

The answer is Key Based SSH

Reasons

  1. You can SSH multiple host machines using the same key or Different keys.
  2. If you reboot your machine while playbook running it again SSH using your provided key so your ansible-playbook runs without occurring any errors.
  3. Also, you get authentication using the appropriate user.

use can use inventory.ini file

example

[hostMachine]
[email protected]  ansible_ssh_user=ubuntu ansible_ssh_private_key_file=/path of your pem file

[ABCDMachine]
[email protected] ansible_ssh_user=ABCD ansible_ssh_private_key_file=/path of your pem file

Command for run ansible-playbook

ansible-playbook -i inventory.ini main.yml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.