Add logrotate,iptables,snapper and smartd
This commit is contained in:
13
tasks/iptables.yml
Normal file
13
tasks/iptables.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: iptables - install iptables-persistent
|
||||
package: name=iptables-persistent
|
||||
|
||||
- name: /etc/iptables/rules.v4
|
||||
template: "dest=/etc/iptables/rules.v4 src={{ common_iptables_v4 }} owner=root group=root mode=0644"
|
||||
notify:
|
||||
iptables restore
|
||||
|
||||
- name: /etc/iptables/rules.v6
|
||||
template: "dest=/etc/iptables/rules.v6 src={{ common_iptables_v6 }} owner=root group=root mode=0644"
|
||||
notify:
|
||||
iptables restore
|
||||
6
tasks/logrotate.yml
Normal file
6
tasks/logrotate.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: logrotate - set backlog
|
||||
lineinfile:
|
||||
path: /etc/logrotate.conf
|
||||
regexp: '^rotate '
|
||||
line: 'rotate 52'
|
||||
@@ -56,3 +56,20 @@
|
||||
- import_tasks: sysctl.yml
|
||||
when: common_sysctl
|
||||
tags: ['common', 'sysctl']
|
||||
|
||||
- import_tasks: logrotate.yml
|
||||
when: common_logrotate
|
||||
tags: ['common', 'logrotate']
|
||||
|
||||
- import_tasks: iptables.yml
|
||||
when: common_iptables
|
||||
tags: ['common', 'iptables']
|
||||
|
||||
- import_tasks: snapper.yml
|
||||
when: common_snapper
|
||||
tags: ['common', 'snapper']
|
||||
|
||||
- import_tasks: smartd.yml
|
||||
when: common_smartd
|
||||
tags: ['common', 'smartd']
|
||||
|
||||
|
||||
16
tasks/smartd.yml
Normal file
16
tasks/smartd.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: smartd - install smartmontools
|
||||
package: name=smartmontools
|
||||
|
||||
- name: smartd - /etc/default/smartmontools
|
||||
replace:
|
||||
path: /etc/default/smartmontools
|
||||
regexp: "^#start_smartd=.*"
|
||||
replace: "start_smartd=yes"
|
||||
notify: restart smartd
|
||||
|
||||
- name: smartd - /etc/smartd.conf
|
||||
copy:
|
||||
dest: /etc/smartd.conf
|
||||
content: "DEVICESCAN -a -d nvme -d sat -o on -s (S/../.././01) -n standby -R 5 -I 9 -R 194 -m root -M exec /usr/share/smartmontools/smartd-runner\n"
|
||||
notify: restart smartd
|
||||
20
tasks/snapper.yml
Normal file
20
tasks/snapper.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: snapper - install snapper
|
||||
package: name=snapper
|
||||
|
||||
- name: snapper - create-config
|
||||
command: snapper create-config /
|
||||
args:
|
||||
creates: /etc/snapper/configs/root
|
||||
|
||||
- name: snapper - get rootfs blkid
|
||||
shell: "blkid -s UUID|grep `mount|grep '/ '|cut -d' ' -f1`|cut -d' ' -f 2"
|
||||
register: snapper_blkid
|
||||
changed_when: False
|
||||
|
||||
- name: snapper - /etc/fstab
|
||||
lineinfile:
|
||||
path: /etc/fstab
|
||||
line: "{{ snapper_blkid.stdout_lines[0] }} /.snapshots btrfs subvol=.snapshots 0 1"
|
||||
when: snapper_blkid.stdout_lines is defined
|
||||
notify: snapper - reload fstab
|
||||
Reference in New Issue
Block a user