Bulk Clear Host status

Context

On our Foreman instance we have many hosts which status is set to “Error” because at some point there was a failed puppet run.

Let’s take one example:

As we can see the last failed puppet execution occurred 3 months ago (current date is 2025-06-24) and since then all hourly puppet runs have been successful:

Question

Is there a way to clear all hosts statuses at once using either the API, foreman-rake or something else ?

I already checked the API doc and found this endpoint:

DELETE /api/hosts/:id/status/:type # doesn't allow to clear the global status.

I also found this post which suggests to run a command that won’t fail but I was looking for a direct approach: Remote Execution plugin, clear failed host.

However, I don’t think this last suggestion would solve anything, as I mentioned earlier, on these hosts many puppet runs have run successfully since the failed execution.

Distribution and version:
Foreman 2.41

Execution status is not the one originating from Puppet, this would be Configuration. So I would also recommend simply running a job on all systems.