Problem:
Link to older post: 37449.
When I delete a host from Foreman UI (3.17 standalone - no Katello) the corresponding host key is not purged from the /usr/share/foreman-proxy/.ssh/known_hosts file. This affects Foreman REX feature because of host key mismatch when a VM is recreated.
For comparison, I have a legacy Foreman (3.13 standalone - no Katello) instance where the /usr/share/foreman-proxy/.ssh/known_hosts file is purged whenever I delete a host from the Foreman UI:
[root@foreman-prod (Production) ~]$ grep -i delete /var/log/foreman-proxy/proxy.log
2026-05-05T14:13:33 6a71e0d6 [I] Started DELETE /ssh/known_hosts/foo-123456.operations.internal
2026-05-05T14:13:33 6a71e0d6 [I] Finished DELETE /ssh/known_hosts/foo-123456.operations.internal (2.81 ms)
I’ve compared UI settings on both instances but can’t see any related parameter (no ansible plugin instlalled on either instance). On both instances, hosts are not “managed”.
Expected outcome
The /usr/share/foreman-proxy/.ssh/known_hosts file is purged when a host is deleted from Foreman UI.
Foreman and Proxy versions
Foreman 3.17, standalone - no Katello.
Foreman and Proxy plugin versions:
rubygem-foreman_maintain-1.13.6-1.el9.noarch
rubygem-foreman_remote_execution-16.3.1-1.fm3_17.el9.noarch
rubygem-foreman_puppet-9.1.0-1.fm3_17.el9.noarch