nut_client
nut-client
Role to install nut client to monitor a remote nut-server for local-server Also install this script as dependance :
Role dependancies
No need dependancies anymore
Role Variables
The role can work as it with the default configuration.
Needed
notifynut_method
can be [mail|pushbullet|telegram|pushover|sms] (defaultmail
)notifynut_mailto
mail adresse or alias to send notification (default root)nut_mode
can be [netclient|netserver] netserver is for the server that is attached to UPS by USB for IP card (default netclient)nut_type
can be [slave|master]. Master when the server is attached to UPS by USB. Slave when the server need to connect to another server (default master)nut_ups_name
your ups namenut_ups_ip
your ups server ipnut_ups_port
nut port (default 3493)nut_user
nut user to monitor the upsnut_password
nut password to monitor the ups
Notification
Common
notifynut_logfile
(default/var/log/nutNotify/nutNotify.log
)notifynut_flagfile
(default/var/log/nutNotify/nutShutdown.flag
)notifynut_curlBin
(default/usr/bin/curl
)notifynut_mailBin
(default/usr/bin/mail
)notifynut_subjectDefault
Suject use by all methods if not override (default"$HOSTNAME UPS event $argument on $ups@$server !"
)notifynut_bodyDefault
Message use by all methods if not override (default"UPS event $argument on $ups at $(date +'%d-%m-%y %H:%M:%S')"
)
Need one method at least
notifynut_mailfrom
Mail sendernotifynut_mailto
Mail recipientnotifynut_sms_provider
Betamax/Dellmont provider with sms API like jumblo.comnotifynut_sms_username
Usernamenotifynut_sms_password
Passwordnotifynut_sms_number
GSM number international format +32xxxxxxxxnotifynut_pushbullet_accessToken
Pushbullet token like o.xxxxxxxxxxxxxxxxxxxxxxxxxxxxnotifynut_pushbullet_providerApi
Provider API (default"https://api.pushbullet.com/v2/pushes"
)notifynut_pushbullet_subject
Short subject for pushbullet (default"UPS event $argument"
)notifynut_telegram_accessToken
Telegram tokennotifynut_telegram_chatID
Telegram chat IDnotifynut_telegram_providerApi
Telegram API to change if you use your own server (default"https://api.telegram.org"
)notifynut_telegram_subject
Short subject for pushbullet (default"UPS event $argument"
)notifynut_pushover_appToken
Pushover Application tokennotifynut_pushover_userkey
Pushover User keynotifynut_pushover_providerApi
Provider API (default"https://api.pushover.net/1/messages.json"
)notifynut_pushover_subject
Short subject for pushover (default"UPS event $argument"
)
Doing different notification method in case of event
notifynut_method_online
one method or a list of method in this format(telegram mail)
(default same value of$methodDefault
)notifynut_method_onbatt
idemnotifynut_method_lowbatt
idemnotifynut_method_fsd
idemnotifynut_method_shutdown
idemnotifynut_method_comm
idemnotifynut_method_serveronline
idem
Example Playbook
For clients
- hosts: [homeservers]
remote_user: root
roles:
- role: basic
- role: nut-client
vars:
nut_mode: netclient
nut_type: slave
notifynut_method: pushbullet
notifynut_pushbullet_accessToken: o.xxxxx
#if you don't want notification from clients i.e.
notifynut_method: none
notifynut_method_comm: telegram
notifynut_method_serveronline: mail
For the ups server :
- hosts: [upsserver]
remote_user: root
roles:
- role: basic
- role: nut-client
vars:
nut_mode: netserver
notifynut_method: telegram
notifynut_mailfrom: "NUT $HOSTNAME <[email protected]>"
notifynut_mailto: "[email protected]"
notifynut_telegram_accessToken: xxx
notifynut_telegram_chatID: xxx
# all notifications for the server and special for online i.e.
notifynut_method: telegram
notifynut_method_online: (telegram mail)
License
Author Information
Belgotux MonLinux
Link
See this article about nut UPS notifications for more informations (in french)
Install
ansible-galaxy install belgotux/ansible-role-nut-client
License
gpl-3.0
Downloads
26
Owner