ansible-edda/plays/roles/system_ups/tasks/main.yml

30 lines
604 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: apcupsd_conf
- name: "enable apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
enabled: true
- name: "start apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
state: "started"
register: apcupsd_start
- name: "restart apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
state: "restarted"
when:
apcupsd_conf.changed and
not apcupsd_start.changed