patternMinor
Ansible service module running state utility
Viewed 0 times
moduleutilityrunningservicestateansible
Problem
Ansible v2.5 introduced a new "running" state for the service module, the doc is not saying anything about it.
started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the service. reloaded will always reload. At least one of state and enabled are required. Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn't normally.
I presume it checks if the service is running and starts it if not, but this is exactly what the started state does.
What differs the running state from the started state ?
started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the service. reloaded will always reload. At least one of state and enabled are required. Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn't normally.
I presume it checks if the service is running and starts it if not, but this is exactly what the started state does.
What differs the running state from the started state ?
Solution
It's deprecated in favor of started.
TASK [Test postfix is running]
**************************************************************
[DEPRECATION WARNING]: state=running is deprecated. Please use
state=started. This feature will be removed in version 2.7.
Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.Code Snippets
TASK [Test postfix is running]
**************************************************************
[DEPRECATION WARNING]: state=running is deprecated. Please use
state=started. This feature will be removed in version 2.7.
Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.Context
StackExchange DevOps Q#4338, answer score: 5
Revisions (0)
No revisions yet.