At least with my version of NUT it seems like the "nut_ups_extra" placed after the ups definitions results in failure to load. Here is a simple play:
---
- name: Nut Play
hosts: all
become: yes
tasks:
- name: Nut
include_role:
name: ntd.nut
vars:
nut_ups:
- name: smt1500rm2u
driver: usbhid-ups
device: auto
description: smt1500rm2u
This produces ups.conf:
# Ansible managed
[smt1500rm2u]
driver = usbhid-ups
port = auto
desc = "smt1500rm2u"
maxretry = 3
This will fail to be loaded, however:
> upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Fatal error: 'maxretry' is not a valid variable name for this driver.
Look in the man page or call this driver with -h for a list of
valid variable names and flags.
By simply moving this directive up higher in the file, it is then correct:
# Ansible managed
maxretry = 3
[smt1500rm2u]
driver = usbhid-ups
port = auto
desc = "smt1500rm2u"
So, at least with my version, it appears that global options such as this need to come before any ups sections otherwise it gets confused and thinks they are part of the UPS config.
At least with my version of NUT it seems like the "nut_ups_extra" placed after the ups definitions results in failure to load. Here is a simple play:
This produces ups.conf:
This will fail to be loaded, however:
By simply moving this directive up higher in the file, it is then correct:
So, at least with my version, it appears that global options such as this need to come before any ups sections otherwise it gets confused and thinks they are part of the UPS config.