Create system_ups role

This commit is contained in:
Wojciech Kozlowski 2022-12-04 17:29:43 +01:00
parent 07d5ad3292
commit 2fffbbfd19
5 changed files with 32 additions and 31 deletions

View File

@ -3,5 +3,4 @@
hosts: yggdrasil hosts: yggdrasil
tasks: tasks:
- import_tasks: tasks/hosts/ups.yml
- import_tasks: tasks/hosts/smart.yml - import_tasks: tasks/hosts/smart.yml

View File

@ -1,29 +0,0 @@
- 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

View File

@ -0,0 +1,29 @@
- 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 is changed and
apcupsd_start is not changed

View File

@ -1,7 +1,9 @@
--- ---
- name: "play : system : zfs, smart, ups : yggdrasil" - name: "play : system : ups, smart, zfs : yggdrasil"
hosts: "yggdrasil" hosts: "yggdrasil"
roles: roles:
- role: "system_ups"
tags: "role:system_ups"
- role: "system_zfs" - role: "system_zfs"
tags: "role:system_zfs" tags: "role:system_zfs"