community.general.runit 模块 – 管理 runit 服务
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您使用的是 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定:community.general.runit
。
概要
使用 sv 实用程序控制远程主机上的 runit 服务。
参数
参数 |
注释 |
---|---|
服务是否已启用,如果禁用,则也意味着已停止。 选项
|
|
要管理的服务名称。 |
|
runsv 监视服务的目录 默认值: |
|
定义服务的目录,指向 service_dir 的符号链接的源。 默认值: |
|
选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全 |
可以在 |
|
支持:无 |
在 diff 模式下,将返回有关已更改(或可能需要在 |
示例
- name: Start sv dnscache, if not running
community.general.runit:
name: dnscache
state: started
- name: Stop sv dnscache, if running
community.general.runit:
name: dnscache
state: stopped
- name: Kill sv dnscache, in all cases
community.general.runit:
name: dnscache
state: killed
- name: Restart sv dnscache, in all cases
community.general.runit:
name: dnscache
state: restarted
- name: Reload sv dnscache, in all cases
community.general.runit:
name: dnscache
state: reloaded
- name: Use alternative sv directory location
community.general.runit:
name: dnscache
state: reloaded
service_dir: /run/service