Clear Known Hosts Within AnsibleForms - Strict Host Key Checking #209
Closed
dabenp
started this conversation in
Show and tell
Replies: 1 comment 4 replies
-
thank you for the feedback.
It make my ssh folder persistent and I can set the rights from outside the container. Doesn't that work on your end ? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A small contribution to help those with Host Key Checking Issues.
ISSUE
My settings for host key checking seemed to get ignored no matter where they were applied.
Files edited locally:
Files edited within AnsibleForms docker container:
I even tried to export the environment variable within the container with:
export ANSIBLE_HOST_KEY_CHECKING=False
Edits to all of the above files failed to work and a rebuilt cloud server kept failing to run a form / playbook run because of host_key_checking errors.
Instead, of experimenting further I created a form / playbook that runs locally and clears known hosts within the container.
WORKAROUND - AS ONE COMMAND
Run the following:
docker exec $(docker ps -q -f name=af_app) /bin/sh -c 'truncate -s 0 /root/.ssh/known_hosts'
WORKAROUND - AS BASH FILE
Change directory to /root/ directory:
cd /root/
Create the bash file:
touch clear_known_hosts_ansibleforms.sh
Edit the bash file:
nano clear_known_hosts_ansibleforms.sh
Add the following contents:
Add executable permissions:
chmod +x /root/clear_known_hosts_ansibleforms.sh
Now you can clear known hosts by running the file with:
sh /root/clear_known_hosts_ansibleforms.sh
YOU CAN LEAVE IT HERE IF YOU DON'T WANT IT ADDED INSIDE OF ANSIBLE FORMS GUI!
WORKAROUND - INSIDE ANSIBLE FORMS GUI
To add it as a playbook inside of AnsibleForms create a playbook file:
touch /srv/apps/ansibleforms-docker/data/playbooks/clear_known_hosts_ansibleforms.yaml
Edit it with:
nano /srv/apps/ansibleforms-docker/data/playbooks/clear_known_hosts_ansibleforms.yaml
Add the following:
Now create the form with:
touch /srv/apps/ansibleforms-docker/data/forms/clear_known_hosts_ansibleforms.yaml
Edit the form with:
nano /srv/apps/ansibleforms-docker/data/forms/clear_known_hosts_ansibleforms.yaml
Now add the following:
Hope this helps others having issues with host key checking.
If anyone can indicate how to make host_key_checking=false work that would be very useful.
Beta Was this translation helpful? Give feedback.
All reactions