Can I throttle a task with delay?

I have an inventory containing a few dozens hosts.

I have a short playbook that configures a monitoring service on a single server. I build the contents of a per host config for the monitoring service and then I upload it to the monitoring service and restart the service in order for it to read the new config. This means that all tasks run against each host (as normal) except the last two that are delegated to the monitoring server (upload and restart).

The issue is that systemd complains if there are too many restarts. I have managed to solve this by raising the number of permitted restarts per second in systemd. But, still, restarts may run too fast that systemd will run up to 5 restarts in parallel (I am using the linear strategy with default forks). For this reason, I set throttle to 1 for this task. However, still, subsequent restarts may run too fast in sequence that they somehow overlap and systemd errors out.

My question is if there is a way to have throttle with a delay among hosts. I considered creating a block that contains the systemd-restart tasks plus a sleep tasks and set throttle there. But I was looking for sth more elegant at the task level.

I have an inventory containing a few dozens hosts.

I have a short playbook that configures a monitoring service on a single server. I build the contents of a per host
config for the monitoring service and then I upload it to the monitoring service and restart the service in order for it
to read the new config. This means that all tasks run against each host (as normal) except the last two that are
delegated to the monitoring server (upload and restart).

The issue is that systemd complains if there are too many restarts. I have managed to solve this by raising the number
of permitted restarts per second in systemd. But, still, restarts may run too fast that systemd will run up to 5
restarts in parallel (I am using the linear strategy with default forks). For this reason, I set throttle to 1 for this
task. However, still, subsequent restarts may run too fast in sequence that they somehow overlap and systemd errors out.

My question is if there is a way to have throttle with a delay among hosts. I considered creating a block that contains
the systemd-restart tasks plus a sleep tasks and set throttle there. But I was looking for sth more elegant at the task
level.

I would use a Ansible handler that restarts the monitoring service after all changes are complete.
Doesn't make sense to me to restart it after each upload.

Reference:

https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#handlers-running-operations-on-change

Regards
        Racke

Yes, handlers make sense. But what if I want to make requests that have a rate limit, e.g 1req / sec?