ansible-edda/playbooks/tasks/hosts/ups.yml

30 lines
549 B
YAML

- name: Install acpupsd
apt:
name: apcupsd
- name: Apcupsd configuration
copy:
src: ./filesystem/{{ ansible_hostname }}/etc/apcupsd/apcupsd.conf
dest: /etc/apcupsd/apcupsd.conf
mode: 0644
register: apcupsd_conf
- name: Enable apcupsd
systemd:
name: apcupsd
enabled: yes
- name: Start apcupsd
systemd:
name: apcupsd
state: started
register: apcupsd_start
- name: Restart apcupsd
systemd:
name: apcupsd
state: restarted
when:
apcupsd_conf is changed and
apcupsd_start is not changed