Create system_smart role
This commit is contained in:
parent
2fffbbfd19
commit
c3328ddbf4
@ -1,6 +0,0 @@
|
||||
---
|
||||
- name: Configure yggdrasil extras
|
||||
hosts: yggdrasil
|
||||
|
||||
tasks:
|
||||
- import_tasks: tasks/hosts/smart.yml
|
@ -1,29 +0,0 @@
|
||||
- name: Install smartmontools
|
||||
apt:
|
||||
name: smartmontools
|
||||
|
||||
- name: Smartd configuration
|
||||
copy:
|
||||
src: ./filesystem/{{ ansible_hostname }}/etc/smartd.conf
|
||||
dest: /etc/smartd.conf
|
||||
mode: 0644
|
||||
register: smartd_conf
|
||||
|
||||
- name: Enable smartmontools
|
||||
systemd:
|
||||
name: smartmontools
|
||||
enabled: yes
|
||||
|
||||
- name: Start smartmontools
|
||||
systemd:
|
||||
name: smartmontools
|
||||
state: started
|
||||
register: smartd_start
|
||||
|
||||
- name: Restart smartmontools
|
||||
systemd:
|
||||
name: smartmontools
|
||||
state: restarted
|
||||
when:
|
||||
smartd_conf is changed and
|
||||
smartd_start is not changed
|
29
plays/roles/system_smart/tasks/main.yml
Normal file
29
plays/roles/system_smart/tasks/main.yml
Normal file
@ -0,0 +1,29 @@
|
||||
- name: "install smartmontools"
|
||||
ansible.builtin.apt:
|
||||
name: "smartmontools"
|
||||
|
||||
- name: "smartd configuration"
|
||||
ansible.builtin.copy:
|
||||
src: "./smartd.conf"
|
||||
dest: "/etc/smartd.conf"
|
||||
mode: 0644
|
||||
register: smartd_conf
|
||||
|
||||
- name: "enable smartmontools"
|
||||
ansible.builtin.systemd:
|
||||
name: "smartmontools"
|
||||
enabled: true
|
||||
|
||||
- name: "start smartmontools"
|
||||
ansible.builtin.systemd:
|
||||
name: "smartmontools"
|
||||
state: "started"
|
||||
register: smartd_start
|
||||
|
||||
- name: "restart smartmontools"
|
||||
ansible.builtin.systemd:
|
||||
name: "smartmontools"
|
||||
state: "restarted"
|
||||
when:
|
||||
smartd_conf.changed and
|
||||
not smartd_start.changed
|
@ -25,5 +25,5 @@
|
||||
name: "apcupsd"
|
||||
state: "restarted"
|
||||
when:
|
||||
apcupsd_conf is changed and
|
||||
apcupsd_start is not changed
|
||||
apcupsd_conf.changed and
|
||||
not apcupsd_start.changed
|
||||
|
@ -4,6 +4,8 @@
|
||||
roles:
|
||||
- role: "system_ups"
|
||||
tags: "role:system_ups"
|
||||
- role: "system_smart"
|
||||
tags: "role:system_smart"
|
||||
- role: "system_zfs"
|
||||
tags: "role:system_zfs"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user