2021-02-07 12:46:03 +01:00
---
- name : install apcupsd packages
2021-01-02 10:30:54 +01:00
ansible.builtin.package :
2020-08-18 11:57:53 +02:00
name :
- apcupsd
- apcupsd-cgi
- apcupsd-doc
state : present
become : yes
notify : apc_access_mail
2021-02-07 12:46:03 +01:00
- name : create master config
include_tasks : master.yml
when :
- apcupsd_nis_master
- apcupsd_nis_master is defined
- name : create slave config
include_tasks : slave.yml
when :
- not apcupsd_nis_master
- apcupsd_nis_master is defined
- name : copy apcupsd file
2020-08-18 11:57:53 +02:00
become : yes
2020-11-21 19:41:19 +01:00
ansible.builtin.template :
2020-08-18 11:57:53 +02:00
src : "apcupsd"
dest : "/etc/default/apcupsd"
2021-02-07 12:46:03 +01:00
- name : set mail recipient
2020-08-18 11:57:53 +02:00
become : yes
2020-11-21 19:41:19 +01:00
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
2021-02-07 12:46:03 +01:00
- name : copy test script
2020-08-18 11:57:53 +02:00
become : yes
2020-11-21 19:41:19 +01:00
ansible.builtin.template :
2021-02-07 12:46:03 +01:00
src : "apccontrol.save"
dest : "/etc/apcupsd/apccontrol.save"