Feat: ajoute nut au nas

This commit is contained in:
Bertrand Benjamin 2022-06-03 05:39:23 +02:00
parent 020e81176d
commit 37040f843c
8 changed files with 57 additions and 9 deletions

View File

@ -33,14 +33,17 @@
# - name: Secure ssh
# include_role:
# name: ssh
- name: Set up nfs network shares server
- name: Set up nuts
include_role:
name: nfs_server
name: nut
- name: Set up samba network shares
include_role:
name: samba_server
# - name: Set up nfs network shares server
# include_role:
# name: nfs_server
# - name: Set up samba network shares
# include_role:
# name: samba_server
- name: Install docker
debug:
@ -54,9 +57,6 @@
debug:
msg: Todo
- name: Set up nuts
debug:
msg: Todo
#- name: Set up collectd
# include_role:

View File

@ -0,0 +1,2 @@
---
# defaults file for nut

View File

@ -0,0 +1,6 @@
---
# handlers file for nut
- name: restart nut-server
service:
name: nut-server
state: restarted

View File

@ -0,0 +1,6 @@
---
- name: Debian - Install nut
apt:
name:
- nut
state: present

21
roles/nut/tasks/main.yml Normal file
View File

@ -0,0 +1,21 @@
---
# tasks file for nut
- name: Install os-specific packages
include_tasks: "{{ ansible_os_family | lower }}.yml"
- name: Enable standalone mode for Nut
lineinfile:
path: /etc/nut/nut.conf
regexp: '^MODE='
line: MODE=standalone
notify: restart nut-server
- name: Copy ups.conf
template:
src: ups.conf.j2
dest: /etc/nut/ups.conf
owner: root
group: root
mode: 0644
notify: restart nut-server

View File

@ -0,0 +1,7 @@
maxretry = 3
{% for ups in upss %}
[{{ ups.name }}]
driver = {{ ups.driver }}
port = {{ ups.port }}
{% endfor %}

2
roles/nut/vars/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
# vars file for nut

View File

@ -1 +1,5 @@
---
upss:
- name: eaton650
driver: usbhid-ups
port: auto