1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/rst/modules/service.rst

33 lines
2.2 KiB
ReStructuredText
Raw Normal View History

.. _service:
service
```````
Controls services on remote machines.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | name of the service |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | no | started | 'started', 'stopped', 'reloaded', or 'restarted'. Started/stopped are |
| | | | idempotent actions that will not run commands unless neccessary. |
| | | | 'restarted' will always bounce the service, 'reloaded' will always reload. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
2012-08-18 02:35:43 +02:00
| pattern | no | | (new in 0.7) 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 |
| | | | service will be assumed to be running. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| enabled | no | | Whether the service should start on boot. Either 'yes' or 'no'. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
2012-08-18 02:35:43 +02:00
Example actions from Ansible :doc:`playbooks`::
service name=httpd state=started
service name=httpd state=stopped
service name=httpd state=restarted
service name=httpd state=reloaded
2012-08-18 02:35:43 +02:00
service name=foo pattern=/usr/bin/foo state=started