2023-10-25 22:26:17 +02:00
---
- 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
2023-10-31 11:37:50 +01:00
line : export SYSADMIN={{ my_mail }} #ersetze durch...
2023-10-25 22:26:17 +02:00
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"