Article about known_hosts:
What is known_hosts File in Linux
- Here is a video tutorial
Scripts and configuration files are available
here:
Working recommended solution, but only in the environment that is not compromised.
- Cleanup known_hosts in /home/user/.ssh directory
- Run the ansible playbook with the below command:
1
|
ansible-playbook ssh-session.yaml
|
- Break it with ctrl+c
- Run the below command:
- Check the result in known_hosts
- You will see all the entries added by ssh.
- Run the ansible playbook with the below command one more time:
1
|
ansible-playbook ssh-session.yaml
|
- Type yes few times and then break it with ctrl+c
- Check the result in the screen.
- Cleanup known_hosts in /home/user/.ssh directory and then run the ansible playbook with the below command:
1
|
ansible-playbook ssh-session.yaml --ssh-common-args='-o StrictHostKeyChecking=no'
|
Problem is solved.
Working solution that I do not recommend
- Cleanup known_hosts in /home/user/.ssh directory
- Display global variables with the below command:
- Perform the below command:
1
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
- Connect using ssh to the remote host
- Run the ansible playbook with the below command:
1
|
ansible-playbook ssh-session.yaml
|
- Check the result in known_hosts
- See do you have entries added into known_hosts
Solution that I have found in the Internet that I really do not recommend
- Run the ansible playbook with the below command:
1
|
ansible-playbook ssh-keyscan.yaml
|
- Check the result in known_hosts
- Get rid of unecessary entries in known_hosts
- Run the ansible playbook with the below command:
1
|
ansible-playbook ssh-session.yaml
|
- Watch the mentioned video to understand what happened and why.