|
| 1 | +.. _modules_nut: |
| 2 | + |
| 3 | +.. include:: ../_include/head.rst |
| 4 | + |
| 5 | +======================= |
| 6 | +NUT - Network UPS Tools |
| 7 | +======================= |
| 8 | + |
| 9 | +**State:** Unstable |
| 10 | + |
| 11 | +**Tests:** `nut.yml <https://github.com/O-X-L/ansible_opnsense/blob/latest/tests/nut.yml>`_ |
| 12 | + |
| 13 | +**API Docs**: `Plugins - NUT <https://docs.opnsense.org/development/api/plugins/nut.html>`_ |
| 14 | + |
| 15 | +**Service Docs**: `NUT - Network UPS Tools <https://docs.opnsense.org/manual/how-tos/nut.html>`_ |
| 16 | + |
| 17 | +Contribution |
| 18 | +************ |
| 19 | + |
| 20 | +Author: `@wmatusiak <https://github.com/wmatusiak>`_ |
| 21 | + |
| 22 | +If you encounter any issues or have suggestions for improvements, please feel free to contribute to the project. |
| 23 | + |
| 24 | +---- |
| 25 | + |
| 26 | +Prerequisites |
| 27 | +************* |
| 28 | + |
| 29 | +You need to install the NUT plugin: |
| 30 | + |
| 31 | +``` |
| 32 | +os-nut |
| 33 | +``` |
| 34 | +You can also install it using the :ref:`oxlorg.opnsense.package <modules_package>` module. |
| 35 | + |
| 36 | +---- |
| 37 | + |
| 38 | +Functions |
| 39 | +********* |
| 40 | + |
| 41 | +This module allows you to configure the Network UPS Tools on your OPNsense firewall. |
| 42 | + |
| 43 | +NUT is a service that monitors UPS device and shutdown your firewall if the battery level is low. |
| 44 | + |
| 45 | +Parameters |
| 46 | +########## |
| 47 | + |
| 48 | +.. csv-table:: Definition |
| 49 | + :header: "Parameter", "Type", "Required", "Default", "Aliases", "Comment" |
| 50 | + :widths: 15 10 10 10 10 45 |
| 51 | + |
| 52 | + "enabled","boolean","false","true","\-","Enable/disable NUT service" |
| 53 | + "mode","choice","false","standalone","\-","Service mode. One of: 'standalone','netclient'." |
| 54 | + "name","string","false","UPSName","\-","Name for your UPS." |
| 55 | + "listen","list","false","['127.0.0.1','::1']","\-","Addresses this service listen on." |
| 56 | + "admin_password","string","false","Password","\-","Password for admin user 'admin'." |
| 57 | + "monitor_password","string","false","Password","\-","Password for monitoring user 'monuser'." |
| 58 | + "usbhid_enable","boolean","false","false","\-","Enable the USBHID driver." |
| 59 | + "usbhid_args","list","false","['port=auto']","\-","Extra arguments for USBHID driver, e.g. 'port=auto'." |
| 60 | + "apcsmart_enable","boolean","false","false","\-","Enable the APCSMART driver." |
| 61 | + "apcsmart_args","list","false","['port=auto']","\-","Extra arguments for APCSMART driver, e.g. 'port=auto'." |
| 62 | + "apcupsd_enable","boolean","false","false","\-","Enable the APCUPSD controlled devices driver." |
| 63 | + "apcupsd_host","string","false","localhost","\-","Hostname or ip of the remote apcupsd server." |
| 64 | + "apcupsd_port","int","false","\-","\-","Port of the remote apcupsd server (optional)." |
| 65 | + "bcmxcpusb_enable","boolean","false","false","\-","Enable the PowerWare BCMXCPUSB driver." |
| 66 | + "bcmxcpusb_args","list","false","['port=auto']","\-","Extra arguments for WoerWare BCMXCPUSB driver, e.g. 'port=auto'." |
| 67 | + "blazerusb_enable","boolean","false","false","\-","Enable the BlazerUSB driver." |
| 68 | + "blazerusb_args","list","false","['port=auto']","\-","Extra arguments for BlazerUSB driver, e.g. 'port=auto'." |
| 69 | + "blazerser_enable","boolean","false","false","\-","Enable the BlazerSerial driver. Please be aware that this driver needs to run nut-tools as root." |
| 70 | + "blazerser_args","list","false","['port=auto']","\-","Extra arguments for BlazerSerial driver, e.g. 'port=auto'." |
| 71 | + "netclient_enable","boolean","false","false","\-","Enable the Netclient driver" |
| 72 | + "netclient_address","string","false","\-","\-","IP address of the remote NUT server." |
| 73 | + "netclient_port","int","false","3493","\-","TCP port of the remote NUT server." |
| 74 | + "netclient_user","string","false","\-","\-","Usernname of the remote NUT server." |
| 75 | + "netclient_password","string","false","\-","\-","Password of the remote NUT server." |
| 76 | + "qx_enable","boolean","false","false","\-","Enable the OX driver." |
| 77 | + "qx_args","list","false","['port=auto']","\-","Extra arguments for QX driver, e.g. 'port=auto'." |
| 78 | + "riello_enable","boolean","false","false","\-","Enable the Riello driver." |
| 79 | + "riello_args","list","false","['port=auto']","\-","Extra arguments for Riello driver, e.g. 'port=auto'." |
| 80 | + "snmp_enable","boolean","false","false","\-","Enable the SNMP driver." |
| 81 | + "snmp_args","list","false","['community=public']","\-","Extra arguments for SNMP driver, e.g. 'community=public'." |
| 82 | + |
| 83 | +.. include:: ../_include/param_basic.rst |
| 84 | + |
| 85 | +.. include:: ../_include/param_reload.rst |
| 86 | + |
| 87 | +---- |
| 88 | + |
| 89 | +Usages |
| 90 | +****** |
| 91 | + |
| 92 | +This module configures all NUT service settings. |
| 93 | + |
| 94 | +After configuration changes, the service will be reloaded automatically. |
| 95 | + |
| 96 | +---- |
| 97 | + |
| 98 | +Examples |
| 99 | +******** |
| 100 | + |
| 101 | +.. code-block:: yaml |
| 102 | +
|
| 103 | + - hosts: firewalls |
| 104 | + connection: local |
| 105 | + gather_facts: false |
| 106 | + module_defaults: |
| 107 | + group/oxlorg.opnsense.all: |
| 108 | + firewall: 'opnsense.template.oxlorg.net' |
| 109 | + api_credential_file: '/home/guy/.secret/opn.key' |
| 110 | + oxlorg.opnsense.nut: |
| 111 | + # repalce defaults password 'Password' with something random |
| 112 | + admin_password: some random password here |
| 113 | + monitor_password: some random password here |
| 114 | +
|
| 115 | + tasks: |
| 116 | + - name: Configure NUT service with USBHID driver |
| 117 | + oxlorg.opnsense.nut: |
| 118 | + enabled: True |
| 119 | + mode: standalone |
| 120 | + usbhid_enable: True |
| 121 | +
|
| 122 | + - name: Configure NUT service with SNMP driver |
| 123 | + oxlorg.opnsense.nut: |
| 124 | + enabled: True |
| 125 | + mode: standalone |
| 126 | + snmp_enable: True |
| 127 | + snmp_args: |
| 128 | + - community=public |
| 129 | + - port=192.168.1.200 |
| 130 | + - snmp_version=v2c |
| 131 | +
|
| 132 | + - name: Configure NUT service in Netclient mode |
| 133 | + oxlorg.opnsense.nut: |
| 134 | + enabled: Ture |
| 135 | + mode: netclient |
| 136 | + netclient_enable: True |
| 137 | + netclient_address: 192.168.1.100 |
| 138 | + netclient_user: remotemon |
| 139 | + netclient_password: password for remotemon user on 192.168.1.100 NUT server |
| 140 | +
|
| 141 | +---- |
| 142 | + |
| 143 | +Troubleshooting |
| 144 | +*************** |
| 145 | + |
| 146 | +Check Service -> Nut -> Diagnostics view to check UPS status. |
| 147 | + |
| 148 | +You can use :ref:`oxlorg.opnsense.nut_diagnostics <modules_nut>` to acces status from ansible. |
0 commit comments