Comment 2 for bug 2009029

Revision history for this message
Dmitriy Rabotyagov (noonedeadpunk) wrote (last edit ):

After some thinking I've realized that second option is not an option at all. As we want to start service during systemd role runtime, but we also want to restart it afterwards.

So I'm replacing second option with following one:
2. Change systemd role condition to:
"'services_results.item.state is not defined' OR services_results.item.state == 'started'"
https://opendev.org/openstack/ansible-role-systemd_service/src/commit/59736cb4af5330260bb456e454e08e3d1c9da607/handlers/main.yml#L33

UPD: we can't compare to 'stopped' as in case it's state == 'restarted' or 'reloaded' - it will be restarted twice. So then we should compare to 'started'

Eventually more proper fix would be 1st option, but that requires patching of all existing roles. And indeed it's unobvious for usage outside of the osa. And this single condition change should be quite backportable as well.