svc - Manage daemontools services

New in version 1.9.

Synopsis

Parameters

Parameter Choices/Defaults Comments
downed
bool
    Choices:
  • no ←
  • yes
Should a 'down' file exist or not, if it exists it disables auto startup. defaults to no. Downed does not imply stopped.
enabled
bool
    Choices:
  • no
  • yes
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
required
Name of the service to manage.
service_dir Default:
/service
directory svscan watches for services
service_src
directory where services are defined, the source of symlinks to service_dir.
state
    Choices:
  • killed
  • once
  • reloaded
  • restarted
  • started
  • stopped
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

- name: Start svc dnscache, if not running
  svc:
    name: dnscache
    state: started

- name: Stop svc dnscache, if running
  svc:
    name: dnscache
    state: stopped

- name: Kill svc dnscache, in all cases
  svc:
    name: dnscache
    state: killed

- name: Restart svc dnscache, in all cases
  svc:
    name: dnscache
    state: restarted

- name: Reload svc dnscache, in all cases
  svc:
    name: dnscache
    state: reloaded

- name: Using alternative 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.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Brian Coca (@bcoca)

Hint

If you notice any issues in this documentation you can edit this document to improve it.