On 9/11/20 10:50 AM, tterr...@gmail.com wrote:
> 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

> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c509af8a-5520-443d-aaf5-f0874f9f062fn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/c509af8a-5520-443d-aaf5-f0874f9f062fn%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/291bcafd-be1e-0398-6dd6-e346ffda2ee7%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to