0
votes

I have setup an ansible environment with a control machine (centos) and 3 other remote hosts (centos). Everything is fine with regards to the actual functioning but I want it to work a little seamlessly I guess. I have setup the ssh authentication using #ssh-key-gen on my master server and then used #ssh-copy-id to all my 3 hosts for the passphrase and it works.

Now each time I run my ansible command to these servers it asks me for passphrase and only then the command completes. I dont want that to happen. I tried defining that in my hosts file as you see below but that hasnt worked. I even tried with the vars and it doesnt work with that as well. When i run the command #ansible servers -m ping it asks me for the ssh passphrase and the it runs...

[servers]

10.0.0.1 ansible_ssh_user=root ansible_ssh_private_key_file=/home/ansible/.ssh/id_rsa

Thanks A

1
This question is off-topic for StackOverflow. You can either generate keys without a passphrase or use an SSH agent. Besides, do some research on your own; here's one of the top results in Google: unix.stackexchange.com/questions/12195/…techraf

1 Answers

1
votes

Now each time I run my ansible command to these servers it asks me for passphrase and only then the command completes. I dont want that to happen.

  1. Generate your ssh key without passphrase.

or

  1. Setup ssh key agent.

This is a bit off-topic for SO