How to edit host deletion workflow

Good Morning
Problem:
I need to edit the workflow of the host deletion. Currently when a host is deleted from Foreman, the “dhcpd.leases” file from our DHCP server must be edited.
In fact I just want to add a task inside the host deletion workflow.
I found a lot of doc on the host provisionning workflow but nothing on the host deletion workflow
Expected outcome:
Could you please give me some advises to help me to go ahead,

Foreman and Proxy versions:
1.16.2
Foreman and Proxy plugin versions:
Name Version
foreman-tasks 0.10.9
foreman_column_view 0.3.0
foreman_default_hostgroup 4.0.1
foreman_dhcp_browser 0.0.7
foreman_docker 3.2.1
foreman_host_rundeck 0.0.2
foreman_monitoring 0.1.3
foreman_remote_execution 1.3.7
foreman_snapshot_management 1.3.0
foreman_templates 5.0.1
puppetdb_foreman 3.1.2
Other relevant data:

Why? Foreman deletes the entry in there. Note the leases is append-only file, it will not disappear until the next restart or squash which happens once per hour by default I think. Read man page of ISC DHCP for more info.

Foreman would only skip DHCP deletion in case Subnet - Proxies - DHCP Proxy is unset for the host’s subnet.

Dear Izap,

Thanks for your informations, I’ll work on that to better understand what happen and I will come back to you if needed. Again a big thanks.

Futhermore I was also looking to understand the usual way to edit the host deletion workflow. Another task that I’m assigned is to add to the host deletion workflow the deletion of the node from the backup middleware and then the linked batchJob from the batch scheduler middleware. FOr this I really need to understand how and where the deletion workflow is triggered.

Thanks a lot for your help
Wish you a great week
Best regards

For those who would search for the same functionnality :slight_smile:

I found that plugin “Foreman Hooks” which allow to add post tasks after the standard host deletion.

Going ahead, staying available
Best regards