42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
---
|
|
- name: install apcupsd packages
|
|
ansible.builtin.package:
|
|
name:
|
|
- apcupsd
|
|
- apcupsd-cgi
|
|
- apcupsd-doc
|
|
state: present
|
|
become: yes
|
|
notify: apc_access_mail
|
|
|
|
- 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
|
|
become: yes
|
|
ansible.builtin.template:
|
|
src: "apcupsd"
|
|
dest: "/etc/default/apcupsd"
|
|
|
|
- name: set mail recipient
|
|
become: yes
|
|
ansible.builtin.lineinfile:
|
|
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: copy test script
|
|
become: yes
|
|
ansible.builtin.template:
|
|
src: "apccontrol.save"
|
|
dest: "/etc/apcupsd/apccontrol.save"
|