service now passes 'started' instead of 'running'

other modules don't have to implement this directly
also updated docs to prefer 'started'.
fixes #16145
pull/16166/head
Brian Coca 9 years ago
parent 1b3d6df985
commit 6f36909074

@ -36,7 +36,7 @@ For example, to manage a system service (which requires ``root`` privileges) whe
- name: Ensure the httpd service is running - name: Ensure the httpd service is running
service: service:
name: httpd name: httpd
state: running state: started
become: true become: true
To run a command as the ``apache`` user:: 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 tags: ntp
- name: be sure ntpd is running and enabled - name: be sure ntpd is running and enabled
service: name=ntpd state=running enabled=yes service: name=ntpd state=started enabled=yes
tags: ntp 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 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 - name: ensure postgresql is at the latest version
yum: name=postgresql state=latest yum: name=postgresql state=latest
- name: ensure that postgresql is started - 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, 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 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: tasks:
- name: make sure apache is running - 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 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 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: if 'use' in new_module_args:
del new_module_args['use'] 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) self._display.vvvv("Running %s" % module)
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars)) result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars))
else: else:

Loading…
Cancel
Save