@Dirk
Right, I expect that. However the host name is the same.
Host with ID 34 is the ‘original’ one created during ‘Create Host’ process. ID 36+37 created during 1st Ansible Roles play and 40+41 created during 2nd Ansible Roles play.
Since the Web UI calls delete by host name, clicking ‘delete’ on any of the host always deletes the first one by ID. i.e. in this case #34
But thanks to your comment this got me thinking that I haven’t saw this behaviour when using FQDN instead of shortnames. Because this instance of Foreman has ‘Append domain names to the host’ set to No. The default is Yes.
So I did some testing and replicated the issue once more with ‘Append domain names to the host’ set to No. Then set ‘Append domain names to the host’ to Yes and tried again. No duplicate hosts this time.