On this page
svc – Manage daemontools services
Synopsis
- Controls daemontools services on remote hosts using the svc utility.
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| downed 
        boolean
        | 
 | 
        Should a 'down' file exist or not, if it exists it disables auto startup. Defaults to no. Downed does not imply stopped.
        | 
| enabled 
        boolean
        | 
 | 
        Whether the service is enabled or not, if disabled it also implies stopped. Take note that a service can be enabled and downed (no auto restart).
        | 
| name 
        string / required
        | 
        Name of the service to manage.
        | |
| service_dir 
        string
        | Default: 
        "/service"
        | 
        Directory svscan watches for services
        | 
| service_src 
        string
        | Default: 
        "/etc/service"
        | 
        Directory where services are defined, the source of symlinks to service_dir.
        | 
| state 
        string
        | 
 | Started/stoppedare idempotent actions that will not run commands unless necessary.restartedwill always bounce the svc (svc -t) andkilledwill always bounce the svc (svc -k).reloadedwill send a sigusr1 (svc -1).oncewill 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 guaranteed to have no backward incompatible interface changes going forward. [stableinterface]
- This module is maintained by the Ansible Community. [community]
Authors
- Brian Coca (@bcoca)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.8/modules/svc_module.html