Services are not restarted if the only change is systemd unit
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
systemd_service role handles changed unit restart only when service state is not provided in the structure:
https:/
This behaviour is valid, as we might want to have state: stopped, which does not require service restart and will be handled here:
https:/
We also can't provide state: restarted, as then service will be restarted even when it doesn't need to be.
Let's take uwsgi role as example. 2 possible solutions to solve that bug would be:
1. Add "systemd service changed" to listen. That will result in uwsgi handlers restart the service when unit is changed
https:/
2. Remove state from service definition. This will allow systemd handler to restart service whenever needed.
https:/
I'm inclined to follow first step. As I assume that during initial bootstrap we might want to have services started, but we also need to restart them afterwards. But during initial bootstrap we don't see issues, as changed systemd unit is not the only change, so role handlers are also triggered.
If I understand correctly, option 1. requires to add a fix to all roles that use of ansible- role-systemd_ service, right? If so, it won't solve the issue for people who use that role outside OSA.
Maybe we can change:
- 'services_ results. item.state is not defined'
to:
- services_ results. item.state is not defined or services_ results. item.state != 'stopped'
?