ansibleguy / webui

Basic WebUI for using Ansible
https://webui.ansibleguy.net
GNU General Public License v3.0
95 stars 7 forks source link

Problem: Cannot override ANSIBLE_HOST_KEY_CHECKING? #78

Open mathieumd opened 1 month ago

mathieumd commented 1 month ago

Versions

Version 0.0.24.post3

Scope

Ansible (Job Execution)

Issue

Since #60, I'm trying to override the default ANSIBLE_HOST_KEY_CHECKING, as it's set to True by default, but neither EnvironmentFile or Environment in Systemd unit seems to works:

[Service]
#...
EnvironmentFile=/etc/ansibleguy-webui/env.txt
# or
#Environment=ANSIBLE_HOST_KEY_CHECKING=False
#...
grep HOST_KEY /etc/ansibleguy-webui/env.txt
ANSIBLE_HOST_KEY_CHECKING=False

The job is blocking for 1h, then fails:

TASK [Gathering Facts] *********************************************************

The authenticity of host '10.10.10.10 (10.10.10.10)' can't be established.
ED25519 key fingerprint is SHA256:zdG3im0nO9n5+eitxa6sQ7ONMKd5rixs5hPP8Hi0NyA.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

What's the correct way to change ANSIBLE_HOST_KEY_CHECKING?

ansibleguy commented 1 month ago

Please try to supply the env-variable at https://<host>/ui/system/config image

The ansible-runner is actually not inheriting the env-vars from the WebUI service. (as this would also be a security issue)

Maybe the documentation could be improved? Do you have an idea on what to add?

ansibleguy commented 1 month ago

Note: just tested it and it worked

mathieumd commented 1 month ago

I confirm that too.

So maybe the doc should state that Systemd unit EnvironmentFile is not where to put some (which?) environment variables?