Giter VIP home page Giter VIP logo

ansible-role-nut's People

Contributors

damfle avatar ntd avatar peterwagenaarnw avatar scrool avatar tobias-richter avatar torstein-eide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ansible-role-nut's Issues

Latest tag

Newest tag is 0.4.0 but the previous one is 1.3.0, should it actually be 1.4.0?

upsmon.conf

The nut role in the upsmon.conf template is always master.
Should not be controlled by nut_role variable?

modern systemd enumerators and services per driver

In modern versions of systemd it is necessary correctly process service names

Error

for example, if Idefine single UPS named "apc"

    nut_ups:
      - name: apc
         ...

got error :

RUNNING HANDLER [ntd.nut : restart nut] **********************************************************************************************************************************
failed: (item=nut-driver) => {"ansible_loop_var": "item", "changed": false, "item": "nut-driver", "msg": "Could not find the requested service nut-driver: host"}

because there are no "nut-driver" service in debian 12, but created named "nut-driver@apc" service.

Workaround

Define additional variable :

    nut_services:        # Name of the services to enable
      - nut-driver@apc
      - nut-monitor
      - nut-server

netclient test.yml example is incomplete

This is a really awesome role. Thank you for making it! Looking at the 1.3.0 version of tests/test.yml as examples for setting up a playbook, there are a few things that seem inaccurate/incomplete for the purposes of user documentation and were confusing. I was interested in setting up netclient mode:

# NetClient only mode
- role: ansible-role-nut
  nut_mode: netclient
  nut_user: monitor
  nut_password: Whatever...
  nut_ups: []
  nut_services:
    - nut-monitor
  1. The role seems to have to be ntd.nut now instead of ansible-role-nut. The test.yml says "ansible-role-nut is the uninstalled name of the ntd.nut role", but it's unclear to me what "uninstalled name" means. Maybe this could just use a little verbiage tweak of something like "Use ntd.nut instead of ansible-role-nut if using this in actual playbooks"?
  2. More importantly, if nut_ups is empty, no MONITOR line will generate in upsmon.conf.
  3. It seems like I should only need to give the name of the remote UPS, but ansible will throw an error if a driver isn't also provided.
  4. Setting nut_role to "slave" is probably a pretty common need for client devices, right? (I don't have extensive NUT experience.) If so, that would be nice to have in the example.

My block ended up looking more like this:

- role: ntd.nut
  nut_host: ipaddress
  nut_user: monitor
  nut_password: monitor
  nut_mode: netclient
  nut_role: slave
  nut_ups: 
    - name: ups
      driver: usbhid
      device: na
      description: pfsense UPS
  nut_services:
    - nut-monitor

Given the differences, maybe this complete example is better for the README than the tests file so that the README contains the current "master" example + one client example.

nut_ups_extra Incorrect Location

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.

Configuration for netclient only mode

Looking at the code, it doesn't look like it is possible to use this role in netclient only mode. (Please correct me if I am wrong) My use case is that I have a NAS running NUT as a server and I would like to configure the rest of my machines as clients. Would it be possible to do something like:

if nut_mode == netclient don't configure nut-driver or nut-server?

Packages Missing for Bullseye

Is it intended to install the nut-monitor GUI package?

I don't think most of the functionality enabled by this role requires the GTK GUI. This package doesn't seem to be available on Debian bullseye, causing the role to fail. Could packages be made configurable or maybe the nut-monitor package should just be excluded.

Error when nut_upsmon_notifycmd is not defined

The code suggests nut_upsmon_notifycmd can be left out, but when ran without this command, the task crashes:

failed: [<host>] (item=upsmon.conf) => {"ansible_loop_var": "item", "changed": false, "item": "upsmon.conf", "msg": "AnsibleUndefinedVariable: 'nut_upsmon_notifycmd' is undefined"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.