1
0
Fork 0
home-stack-ansible/roles/nut-client/tasks/main.yml

41 lines
808 B
YAML

- name: Install NUT
apt:
update_cache: true
name:
- nut-client
- name: Configure upsmon.conf
template:
src: upsmon.conf
dest: /etc/nut/upsmon.conf
notify:
- Restart nut-client
- name: Configure nut.conf
copy:
src: nut.conf
dest: /etc/nut/nut.conf
notify:
- Restart nut-client
- name: Configure upssched.conf
template:
src: upssched.conf
dest: /etc/nut/upssched.conf
notify:
- Restart nut-client
- name: Configure upssched-cmd
copy:
src: upssched-cmd
dest: /etc/nut/upssched-cmd
mode: '0755'
notify:
- Restart nut-client
- name: Allow nut user to invoke shutdown with sudo
lineinfile:
path: /etc/sudoers
line: 'nut ALL=NOPASSWD: /usr/sbin/shutdown'
regexp: '^nut\s+'
validate: '/usr/sbin/visudo -cf %s'