homeserver/roles/mgrote.apcupsd/tasks/main.yml

31 lines
1 KiB
YAML
Raw Normal View History

2020-08-18 11:57:53 +02:00
- name: apcupsd installieren
ansible.builtin.apt:
2020-08-18 11:57:53 +02:00
name:
- apcupsd
- apcupsd-cgi
- apcupsd-doc
state: present
become: yes
notify: apc_access_mail
- name: apcupsd kopieren
become: yes
ansible.builtin.template:
2020-08-18 11:57:53 +02:00
src: "apcupsd"
dest: "/etc/default/apcupsd"
- name: empfaenger_mail_setzen
become: yes
ansible.builtin.lineinfile:
2020-08-18 11:57:53 +02:00
path: /etc/apcupsd/apccontrol #wo
regexp: export SYSADMIN=root #suche nach
line: export SYSADMIN={{ empfaenger_mail }} #ersetze durch...
backrefs: yes #verhindert das die zeile bei "nicht zutreffen" am ende der datei angefuegt wird: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html#parameters
- name: apcupsd.conf_kopieren
become: yes
ansible.builtin.template:
2020-08-18 11:57:53 +02:00
src: "apcupsd.conf"
dest: "/etc/apcupsd/apcupsd.conf"
notify: restart_apcupsd #benachrichtigt handlers/main.yml-restart-apcupsd_restart um den dient neuzustarten, nur wenn hier status "changed" ausgeworfen wird"