-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"service_facts" module cannot report whether a service is enabled or not if it is in "failed" state #81115
Comments
Files identified in the description: If these files are incorrect, please update the |
+label affects_2.14 |
For some reason the state and status fields are messed up when a service has failed. |
+label affects_2.16
|
Summary
I use a playbook that handles failures and restarts a service if it is enabled on a server, and does nothing if it is disabled. To detect whether the playbook should take action on the service, it relies on the
service_facts
module.The playbook was working fine under Ansible 2.9.27, however it has stopped working under Ansible 2.14.2 if the service enters a failed state in systemd (for example, in case it crashes). Under Ansible 2.14.2, the
service_facts
module sets thestatus
attribute tofailed
and, as a result, it is no longer possible to figure out from existing service facts whether the playbook should act on the service or not. As a workaround, I had to manually invokesystemctl is-enabled foo.service
with thecommand
module.git bisect
command has identified that this commit has introduced the error: 82bab063I may have code the playbook incorrectly. By reading the existing documentation about the
service_facts
module, I could not figure out the attribute that says whether a service is configured to start at boot time or not, nor the attribute that says whether the service is currently running or not. The definitions ofstatus
andstate
attributes don't seem clear.Issue Type
Bug Report
Component Name
service_facts
Ansible Version
Configuration
OS / Environment
CentOS Stream 9
Steps to Reproduce
This is a minimal playbook that reproduces the issue.
This is the script used with
git bisect
.Expected Results
After invoking the
service_facts
module to get information about a service that has entered a failed state on a managed host, it should be possible to identify whether a service is enabled or not (that is, whether a service is configured to start at boot time or not).Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: