simoncaron.nut
Ansible 角色:NUT
在基于Debian的系统上安装和配置 NUT(网络不间断电源工具)。
角色变量
可用的变量如下列出,并附有默认值(见 defaults/main.yml
):
nut_managed_config: true
如果设置为 false,则后面的选项将无效,也就是说 /etc/nut/
下的所有更改将由你负责。这在配置复杂时通常是可取的。
nut_host: localhost
nut_user: monitor
nut_password: 任意密码...
主要用于配置监视用户。在 NUT 的上下文中,用户并不是 UNIX 管理员所熟悉的典型用户。
nut_ups:
- name: UPS
driver: riello_ups
device: /dev/ttyUSB0
description: 一些描述信息
extra: |
maxretry = 10
retrydelay = 1
name
是一个任意字符串,必须唯一标识 UPS。
driver
依赖于你的硬件,必须是 可用的 NUT 驱动程序 之一。确保你服务器上安装的 NUT 版本有该特定驱动可用。
device
是 UPS 监听的设备(通常是 USB 端口或串行设备)。
description
是可选的,通常是一个用于调试和报告的任意字符串。
extra
是可选的多行文本,将逐字插入到相关配置文件的全局部分。
其他较少使用的可选变量:
nut_mode: standalone # `man 5 nut.conf` 模式指令
nut_powervalue: 1 # `man 5 upsmon.conf` 监视指令,powervalue 字段
nut_role: master # `man 5 upsmon.conf` 监视指令,类型字段
nut_services: # 要启用的服务名称
- nut-driver
- nut-monitor
- nut-server
示例剧本
- hosts: all
roles:
- role: ntd.nut
nut_ups:
- name: riello
driver: riello_usb
device: /dev/ups
description: iPlug 800
更多示例,请参见 tests/test.yml
。
许可证
MIT
作者信息
该角色由 Nicola Fontana(ntd@entidi.it)于2016年创建。