service now passes 'started' instead of 'running'
other modules don't have to implement this directly also updated docs to prefer 'started'. fixes #16145
This commit is contained in:
parent
1b3d6df985
commit
6f36909074
4 changed files with 8 additions and 4 deletions
|
@ -36,7 +36,7 @@ For example, to manage a system service (which requires ``root`` privileges) whe
|
|||
- name: Ensure the httpd service is running
|
||||
service:
|
||||
name: httpd
|
||||
state: running
|
||||
state: started
|
||||
become: true
|
||||
|
||||
To run a command as the ``apache`` user::
|
||||
|
|
|
@ -215,7 +215,7 @@ Below is an example tasks file that explains how a role works. Our common role
|
|||
tags: ntp
|
||||
|
||||
- name: be sure ntpd is running and enabled
|
||||
service: name=ntpd state=running enabled=yes
|
||||
service: name=ntpd state=started enabled=yes
|
||||
tags: ntp
|
||||
|
||||
Here is an example handlers file. As a review, handlers are only fired when certain tasks report changes, and are run at the end
|
||||
|
|
|
@ -126,7 +126,7 @@ the web servers, and then the database servers. For example::
|
|||
- name: ensure postgresql is at the latest version
|
||||
yum: name=postgresql state=latest
|
||||
- name: ensure that postgresql is started
|
||||
service: name=postgresql state=running
|
||||
service: name=postgresql state=started
|
||||
|
||||
You can use this method to switch between the host group you're targeting,
|
||||
the username logging into the remote servers, whether to sudo or not, and so
|
||||
|
@ -274,7 +274,7 @@ the service module takes ``key=value`` arguments::
|
|||
|
||||
tasks:
|
||||
- name: make sure apache is running
|
||||
service: name=httpd state=running
|
||||
service: name=httpd state=started
|
||||
|
||||
The **command** and **shell** modules are the only modules that just take a list
|
||||
of arguments and don't use the ``key=value`` form. This makes
|
||||
|
|
|
@ -55,6 +55,10 @@ class ActionModule(ActionBase):
|
|||
if 'use' in new_module_args:
|
||||
del new_module_args['use']
|
||||
|
||||
# for backwards compatibility
|
||||
if new_module_args['state'] == 'running':
|
||||
new_module_args['state'] = 'started'
|
||||
|
||||
self._display.vvvv("Running %s" % module)
|
||||
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue