Create system_ups role
This commit is contained in:
parent
07d5ad3292
commit
2fffbbfd19
@ -3,5 +3,4 @@
|
||||
hosts: yggdrasil
|
||||
|
||||
tasks:
|
||||
- import_tasks: tasks/hosts/ups.yml
|
||||
- import_tasks: tasks/hosts/smart.yml
|
||||
|
@ -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
|
29
plays/roles/system_ups/tasks/main.yml
Normal file
29
plays/roles/system_ups/tasks/main.yml
Normal 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
|
@ -1,7 +1,9 @@
|
||||
---
|
||||
- name: "play : system : zfs, smart, ups : yggdrasil"
|
||||
- name: "play : system : ups, smart, zfs : yggdrasil"
|
||||
hosts: "yggdrasil"
|
||||
roles:
|
||||
- role: "system_ups"
|
||||
tags: "role:system_ups"
|
||||
- role: "system_zfs"
|
||||
tags: "role:system_zfs"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user