Fstab : we now also add noatime to each partitions

This commit is contained in:
Jérémy Dubois 2020-10-15 09:57:02 +02:00
parent 4c902eda5a
commit a7b96d9f67
2 changed files with 87 additions and 2 deletions

View File

@ -2,7 +2,32 @@
- name: newaliases
shell: smtpctl update table aliases
- name: remount /tmp
- name: remount / noatime
command: mount -u -o noatime /
args:
warn: false
- name: remount /var noatime
command: mount -u -o noatime /var
args:
warn: false
- name: remount /usr noatime
command: mount -u -o noatime /usr
args:
warn: false
- name: remount /tmp noexec
command: mount -u -o noexec /tmp
args:
warn: false
- name: remount /tmp noatime
command: mount -u -o noatime /tmp
args:
warn: false
- name: remount /home noatime
command: mount -u -o noatime /home
args:
warn: false

View File

@ -19,6 +19,18 @@
tags:
- fstab
- name: / partition is customized - noatime
replace:
dest: /etc/fstab
regexp: '([^#]\s+/\s+ffs\s+rw)(\S*)(\s+.*)'
replace: '\1\2,noatime\3'
notify: remount / noatime
when:
- fstab_content.stdout | regex_search('\s/\s')
- not (fstab_content.stdout | regex_search('\s+/\s+ffs\s+rw\S*noatime'))
tags:
- fstab
- name: /var partition is customized - softdep
replace:
dest: /etc/fstab
@ -30,6 +42,18 @@
tags:
- fstab
- name: /var partition is customized - noatime
replace:
dest: /etc/fstab
regexp: '([^#]\s+/var\s+ffs\s+rw)(\S*)(\s+.*)'
replace: '\1\2,noatime\3'
notify: remount /var noatime
when:
- fstab_content.stdout | regex_search('\s/var\s')
- not (fstab_content.stdout | regex_search('\s+/var\s+ffs\s+rw\S*noatime'))
tags:
- fstab
- name: /usr partition is customized - softdep
replace:
dest: /etc/fstab
@ -41,11 +65,24 @@
tags:
- fstab
- name: /usr partition is customized - noatime
replace:
dest: /etc/fstab
regexp: '([^#]\s+/usr\s+ffs\s+rw)(\S*)(\s+.*)'
replace: '\1\2,noatime\3'
notify: remount /usr noatime
when:
- fstab_content.stdout | regex_search('\s/usr\s')
- not (fstab_content.stdout | regex_search('\s+/usr\s+ffs\s+rw\S*noatime'))
tags:
- fstab
- name: /tmp partition is customized - noexec
replace:
dest: /etc/fstab
regexp: '([^#]\s+/tmp\s+ffs\s+rw(,softdep)*)(.*)'
replace: '\1,noexec\3'
notify: remount /tmp noexec
when:
- fstab_content.stdout | regex_search('\s/tmp\s')
- not (fstab_content.stdout
@ -58,7 +95,6 @@
dest: /etc/fstab
regexp: '([^#]\s+/tmp\s+ffs\s+rw)(.*)'
replace: '\1,softdep\2'
notify: remount /tmp
when:
- fstab_content.stdout | regex_search('\s/tmp\s')
- not (fstab_content.stdout
@ -66,6 +102,18 @@
tags:
- fstab
- name: /tmp partition is customized - noatime
replace:
dest: /etc/fstab
regexp: '([^#]\s+/tmp\s+ffs\s+rw)(\S*)(\s+.*)'
replace: '\1\2,noatime\3'
notify: remount /tmp noatime
when:
- fstab_content.stdout | regex_search('\s/tmp\s')
- not (fstab_content.stdout | regex_search('\s+/tmp\s+ffs\s+rw\S*noatime'))
tags:
- fstab
- name: /home partition is customized - softdep
replace:
dest: /etc/fstab
@ -76,3 +124,15 @@
- not (fstab_content.stdout | regex_search('\s+/home\s+ffs\s+rw,softdep'))
tags:
- fstab
- name: /home partition is customized - noatime
replace:
dest: /etc/fstab
regexp: '([^#]\s+/home\s+ffs\s+rw)(\S*)(\s+.*)'
replace: '\1\2,noatime\3'
notify: remount /home noatime
when:
- fstab_content.stdout | regex_search('\s/home\s')
- not (fstab_content.stdout | regex_search('\s+/home\s+ffs\s+rw\S*noatime'))
tags:
- fstab