homeserver/friedhof/mgrote_apcupsd/tasks/main.yml

43 lines
1.1 KiB
YAML
Raw Normal View History

---
- name: install apcupsd packages
ansible.builtin.package:
name:
- apcupsd
- apcupsd-cgi
- apcupsd-doc
state: present
become: true
notify: apc_access_mail
- name: create master config
ansible.builtin.include_tasks: master.yml
when:
- apcupsd_nis_master
- apcupsd_nis_master is defined
- name: create slave config
ansible.builtin.include_tasks: slave.yml
when:
- not apcupsd_nis_master
- apcupsd_nis_master is defined
- name: copy apcupsd file
become: true
ansible.builtin.template:
src: "apcupsd"
dest: "/etc/default/apcupsd"
- name: set mail recipient
become: true
ansible.builtin.lineinfile:
path: /etc/apcupsd/apccontrol #wo
regexp: export SYSADMIN=root #suche nach
line: export SYSADMIN={{ empfaenger_mail }} #ersetze durch...
backrefs: true #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: copy test script
become: true
ansible.builtin.template:
src: "apccontrol.save"
dest: "/etc/apcupsd/apccontrol.save"