ansible-edda/plays/system/roles/ups/tasks/main.yml

30 lines
648 B
YAML

- name: "install acpupsd"
ansible.builtin.apt:
name: "apcupsd"
- name: "apcupsd configuration"
ansible.builtin.copy:
src: "./apcupsd.conf"
dest: "/etc/apcupsd/apcupsd.conf"
mode: 0644
register: system_ups_apcupsd_conf
- name: "enable apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
enabled: true
- name: "start apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
state: "started"
register: system_ups_apcupsd_start
- name: "restart apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
state: "restarted"
when:
system_ups_apcupsd_conf.changed and
not system_ups_apcupsd_start.changed