svc - Manage daemontools services.

New in version 1.9.

Synopsis

  • Controls daemontools services on remote hosts using the svc utility.

Options

parameter required default choices comments
downed
no
  • yes
  • no
Should a 'down' file exist or not, if it exists it disables auto startup. defaults to no. Downed does not imply stopped.
enabled
no
  • yes
  • no
Wheater the service is enabled or not, if disabled it also implies stopped. Make note that a service can be enabled and downed (no auto restart).
name
yes
Name of the service to manage.
service_dir
no /service
directory svscan watches for services
service_src
no
directory where services are defined, the source of symlinks to service_dir.
state
no
  • started
  • stopped
  • restarted
  • reloaded
  • once
  • killed
Started/stopped are idempotent actions that will not run commands unless necessary. restarted will always bounce the svc (svc -t) and killed will always bounce the svc (svc -k). reloaded will send a sigusr1 (svc -1). once will run a normally downed svc once (svc -o), not really an idempotent operation.

Examples

# Example action to start svc dnscache, if not running
 - svc:
    name: dnscache
    state: started

# Example action to stop svc dnscache, if running
 - svc:
    name: dnscache
    state: stopped

# Example action to kill svc dnscache, in all cases
 - svc:
    name: dnscache
    state: killed

# Example action to restart svc dnscache, in all cases
 - svc:
    name: dnscache
    state: restarted

# Example action to reload svc dnscache, in all cases
 - svc:
    name: dnscache
    state: reloaded

# Example using alt svc directory location
 - svc:
    name: dnscache
    state: reloaded
    service_dir: /var/service

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/svc_module.html