REX: Handling existing ssh host keys on rebuild

When a host gets rebuilt, its ssh host keys rotate. When running a job via REX (like ansible roles) the existing host key is not deleted from known_hosts and the REX job fails

Expected outcome:
Host key deleted on host rebuild

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:
What should be the correct procedure? Should I re-register the host? I obviously do not want to lose all my variables ect.

Rebuilt how? From Foreman itself or externally?

Foreman keeps track which proxy was used for remote execution and if a host is rebuilt through foreman, it should wipe the keys on next execution. Or at least with non-ansible remote execution.

Sorry for not being precise: I just toggle build mode on/off and the actual build happens externally.

I tested this now several times and cannot reproduce it: Maybe something odd yesterday? I will file it as such :wink:

Things like that happen, but please do reach out if it comes back.