/
/
/
Ansible role that deployss my nas configuration. It mostly handles nfs configurations and exports that are tailored to the hardware and service configuration.
1---
2- name: Configure SMART monitoring
3 template:
4 src: smartd.conf.j2
5 dest: /etc/smartd.conf
6 backup: true
7 mode: '0644'
8 owner: root
9 group: root
10 become: true
11 when: nas_smartmontools_enabled | bool
12 notify: restart smartd
13
14- name: Enable and start smartd service
15 systemd:
16 name: smartd
17 state: started
18 enabled: true
19 become: true
20 when: nas_smartmontools_enabled | bool
21
22
23- name: Configure mdadm monitoring daemon
24 lineinfile:
25 path: "{{ nas_mdadm_config_file }}"
26 regexp: '^MAILADDR'
27 line: "MAILADDR {{ nas_email_notifications }}"
28 backup: true
29 become: true
30 when:
31 - nas_email_notifications != ""
32 - nas_raid_monitoring | bool
33
34- name: Enable mdadm monitoring service
35 systemd:
36 name: mdmonitor
37 state: started
38 enabled: true
39 daemon_reload: true
40 become: true
41 when: nas_raid_monitoring | bool
42
43
44- name: Create log rotation for NAS logs
45 template:
46 src: nas-logrotate.j2
47 dest: /etc/logrotate.d/nas
48 mode: '0644'
49 owner: root
50 group: root
51 become: true
52
53- name: Ensure log directory exists
54 file:
55 path: "{{ nas_log_file | dirname }}"
56 state: directory
57 mode: '0755'
58 owner: root
59 group: root
60 become: true
61
62- name: Create initial log file
63 file:
64 path: "{{ nas_log_file }}"
65 state: touch
66 mode: '0644'
67 owner: root
68 group: root
69 become: true
70 changed_when: false