community.general.runit (8.5.0) — module

Manage runit services

Authors: James Sumners (@jsumners)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Controls runit services on remote hosts using the sv utility.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Start sv dnscache, if not running
  community.general.runit:
    name: dnscache
    state: started
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop sv dnscache, if running
  community.general.runit:
    name: dnscache
    state: stopped
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Kill sv dnscache, in all cases
  community.general.runit:
    name: dnscache
    state: killed
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Restart sv dnscache, in all cases
  community.general.runit:
    name: dnscache
    state: restarted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reload sv dnscache, in all cases
  community.general.runit:
    name: dnscache
    state: reloaded
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Use alternative sv directory location
  community.general.runit:
    name: dnscache
    state: reloaded
    service_dir: /run/service

Inputs

    
name:
    description:
    - Name of the service to manage.
    required: true
    type: str

state:
    choices:
    - killed
    - once
    - reloaded
    - restarted
    - started
    - stopped
    description:
    - V(started)/V(stopped) are idempotent actions that will not run commands unless necessary.  V(restarted)
      will always bounce the service (sv restart) and V(killed) will always bounce the
      service (sv force-stop). V(reloaded) will send a HUP (sv reload). V(once) will run
      a normally downed sv once (sv once), not really an idempotent operation.
    type: str

enabled:
    description:
    - Whether the service is enabled or not, if disabled it also implies stopped.
    type: bool

service_dir:
    default: /var/service
    description:
    - directory runsv watches for services
    type: str

service_src:
    default: /etc/sv
    description:
    - directory where services are defined, the source of symlinks to service_dir.
    type: str