ntd / ansible-role-nut

Ansible role to install and configure Nework UPS tools on Debian
MIT License
11 stars 16 forks source link

Configuration for netclient only mode #6

Closed Shamazo closed 3 years ago

Shamazo commented 3 years ago

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?

ntd commented 3 years ago

What do you mean with "don't configure nut-driver or nut-server"? If you do not configure any UPS, ups.conf will be basically empty.

Shamazo commented 3 years ago

Sorry if I was unclear, I only started using NUT a few days ago.

My understanding is that in netclient mode ups.conf does not need to be updated (since no ups is attached to the client) and the nut-driver and nut-server services do not need to be running, only nut-monitor.

ntd commented 3 years ago

ups.conf does not need to be updated

This would break the "idempotent" contract of ansible. Furthermore, if the service is not started, then the configuration files are ignored anyway.

nut-driver and nut-server services do not need to be running

Actually you can disable or enable all 3 services together with nut_enable_services. Allowing which service should be enabled could be useful though, so I just pushed a e4e395a in the dev branch to add this feature.

In tests/test.yml file I just added a NetClient only mode example that should be similar to what you want: could you test it please?

Shamazo commented 3 years ago

Thank you for the commit :). I tested it and it worked for me.