Controls services on remote hosts. Supported init systems include BSD init, OpenRC, SysV, Solaris SMF, systemd, upstart.

Options

namedescriptionrequiredchoices
name Name of the service. true
state C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload. B(At least one of state and enabled are required.)
  • started
  • stoppedrestartedreloaded
sleep If the service is being C(restarted) then sleep this many seconds between the stop and start command. This helps to workaround badly behaving init scripts that exit immediately after signaling a process to stop.
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 I(ps) command as a stand-in for a status result. If the string is found, the service will be assumed to be running.
enabled Whether the service should start on boot. B(At least one of state and enabled are required.)
  • yes
  • no
runlevel For OpenRC init scripts (ex: Gentoo) only. The runlevel that this service belongs to.
arguments Additional arguments provided on the command line

Author

Ansible Core Team ,Michael DeHaan