From 68586d6450c418ae84ed676bc478b2dbf15ec86a Mon Sep 17 00:00:00 2001 From: Jeremy Dubois Date: Wed, 14 Oct 2020 12:14:58 +0200 Subject: [PATCH] Fstab role : do not change lines beggining with "#" --- roles/base/tasks/fstab.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/base/tasks/fstab.yml b/roles/base/tasks/fstab.yml index 7112137..e761282 100644 --- a/roles/base/tasks/fstab.yml +++ b/roles/base/tasks/fstab.yml @@ -11,7 +11,7 @@ - name: / partition is customized - softdep replace: dest: /etc/fstab - regexp: '(\s+/\s+\S+\s+rw)(.*)' + regexp: '([^#]\s+/\s+\S+\s+rw)(.*)' replace: '\1,softdep\2' when: - fstab_content.stdout | regex_search('\s/\s') @@ -22,7 +22,7 @@ - name: /var partition is customized - softdep replace: dest: /etc/fstab - regexp: '(\s+/var\s+\S+\s+rw)(.*)' + regexp: '([^#]\s+/var\s+\S+\s+rw)(.*)' replace: '\1,softdep\2' when: - fstab_content.stdout | regex_search('\s/var\s') @@ -33,7 +33,7 @@ - name: /usr partition is customized - softdep replace: dest: /etc/fstab - regexp: '(\s+/usr\s+\S+\s+rw)(.*)' + regexp: '([^#]\s+/usr\s+\S+\s+rw)(.*)' replace: '\1,softdep\2' when: - fstab_content.stdout | regex_search('\s/usr\s') @@ -44,7 +44,7 @@ - name: /tmp partition is customized - noexec replace: dest: /etc/fstab - regexp: '(\s+/tmp\s+\S+\s+rw(,softdep)*)(.*)' + regexp: '([^#]\s+/tmp\s+\S+\s+rw(,softdep)*)(.*)' replace: '\1,noexec\3' when: - fstab_content.stdout | regex_search('\s/tmp\s') @@ -56,7 +56,7 @@ - name: /tmp partition is customized - softdep replace: dest: /etc/fstab - regexp: '(\s+/tmp\s+\S+\s+rw)(.*)' + regexp: '([^#]\s+/tmp\s+\S+\s+rw)(.*)' replace: '\1,softdep\2' notify: remount /tmp when: @@ -69,7 +69,7 @@ - name: /home partition is customized - softdep replace: dest: /etc/fstab - regexp: '(\s+/home\s+\S+\s+rw)(.*)' + regexp: '([^#]\s+/home\s+\S+\s+rw)(.*)' replace: '\1,softdep\2' when: - fstab_content.stdout | regex_search('\s/home\s')