A possible scenario might be:
The script of ansible playbook might be:
It looks great and awesome, but the problem is that if supervisorctl's config is updated, then the app will be restarted TWICE in a short time! Why?
According to ansible's document, behavior of state: restarted
will be:
When state = restarted, the module will call
supervisorctl update
then callsupervisorctl restart
. – Ansible Doc
And the behavior of supervisorctl update
is:
Reload config and add/remove as necessary, and will restart affected programs – Supervisord Doc
Record whether the config supervisor is changed, then call update xor restart according to tis flag: