ansible.service(3) - Linux man page
Name
service - Manage services.
Description
Controls services on remote hosts.
Options
arguments
- Additional arguments provided on the command line
- enabled
- Whether the service should start on boot. Choices: yes,no.
- name
Name of the service.(required)
- pattern
- 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.(Added in Ansible version 0.7.)
- state
started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the service. reloaded will always reload. Choices: started,stopped,restarted,reloaded.."
Examples
Example action to start service httpd, if not running
service: name=httpd state=startedExample action to stop service httpd, if running
service: name=httpd state=stoppedExample action to restart service httpd, in all cases
service: name=httpd state=restartedExample action to reload service httpd, in all cases
service: name=httpd state=reloadedExample action to start service foo, based on running process /usr/bin/foo
service: name=foo pattern=/usr/bin/foo state=startedExample action to restart network service for interface eth0
service: name=network state=restarted args=eth0
Author
Michael DeHaan
See Also
ansible(1), http://ansible.github.com/modules.html#service