runit - Manage runit services

New in version 2.3.

Synopsis

Parameters

Parameter Choices/Defaults Comments
enabled
bool
    Choices:
  • no
  • yes
Whether the service is enabled or not, if disabled it also implies stopped.
name
required
Name of the service to manage.
service_dir Default:
/var/service
directory runsv watches for services
service_src Default:
/etc/sv
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 service (sv restart) and killed will always bounce the service (sv force-stop). reloaded will send a HUP (sv reload). once will run a normally downed sv once (sv once), not really an idempotent operation.

Examples

- name: Start sv dnscache, if not running
  runit:
    name: dnscache
    state: started

- name: Stop sv dnscache, if running
  runit:
    name: dnscache
    state: stopped

- name: Kill sv dnscache, in all cases
  runit:
    name: dnscache
    state: killed

- name: Restart sv dnscache, in all cases
  runit:
    name: dnscache
    state: restarted

- name: Reload sv dnscache, in all cases
  runit:
    name: dnscache
    state: reloaded

- name: Use alternative sv directory location
  runit:
    name: dnscache
    state: reloaded
    service_dir: /run/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

  • James Sumners (@jsumners)

Hint

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