.. _service: service `````````````````````````````` .. versionadded:: 0.1 Controls services on remote hosts. .. raw:: html
parameter | required | default | choices | comments |
---|---|---|---|---|
pattern | no | If the service does not respond to the status command, name a substring to look for as would be found in the output of the ps command as a stand-in for a status result. If the string is found, the servie will be assumed to be running. (added in Ansible 0.7) | ||
state | no |
|
started, stopped, reloaded, restarted. Started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the service. reloaded will always reload. | |
enabled | no |
|
Whether the service should start on boot. | |
name | yes | Name of the service. |
Example action from Ansible Playbooks
service name=httpd state=started
Example action from Ansible Playbooks
service name=httpd state=stopped
Example action from Ansible Playbooks
service name=httpd state=restarted
Example action from Ansible Playbooks
service name=httpd state=reloaded
Example action from Ansible Playbooks
service name=foo pattern=/usr/bin/foo state=started