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

30 lines
648 B
YAML
Raw Normal View History

2022-12-04 17:29:43 +01:00
- name: "install acpupsd"
ansible.builtin.apt:
name: "apcupsd"
- name: "apcupsd configuration"
ansible.builtin.copy:
src: "./apcupsd.conf"
dest: "/etc/apcupsd/apcupsd.conf"
mode: 0644
2022-12-08 23:19:54 +01:00
register: system_ups_apcupsd_conf
2022-12-04 17:29:43 +01:00
- name: "enable apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
enabled: true
- name: "start apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
state: "started"
2022-12-08 23:19:54 +01:00
register: system_ups_apcupsd_start
2022-12-04 17:29:43 +01:00
- name: "restart apcupsd"
ansible.builtin.systemd:
name: "apcupsd"
state: "restarted"
when:
2022-12-08 23:19:54 +01:00
system_ups_apcupsd_conf.changed and
not system_ups_apcupsd_start.changed