remount-usr: back to a simpler implementation

This commit is contained in:
Jérémy Lecour 2024-02-07 15:43:23 +01:00 committed by Jérémy Lecour
parent 4fb49dd6c9
commit d401778024
Signed by: jlecour
SSH Key Fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY
1 changed files with 3 additions and 13 deletions

View File

@ -2,27 +2,17 @@
# findmnt returns 0 on hit, 1 on miss
# If the return code is higher than 1, it's a blocking failure
- name: "check if /usr is a mountpoint" "findmnt -n /usr &> /dev/null"
register: usr_mount_exists
failed_when: False
check_mode: False
changed_when: False
- name: "check if /usr is a read-only partition"
cmd: 'findmnt /usr --noheadings --options ro'
register: usr_partition
when: usr_mount_exists.rc == 0
changed_when: False
failed_when: usr_partition.rc > 1
register: usr_partition
check_mode: False
- name: "mount /usr in rw"
cmd: 'mount -o remount,rw /usr'
- usr_mount_exists.rc == 0
- usr_partition.rc == 0
cmd: 'mount --options remount,rw /usr'
when: usr_partition.rc == 0
notify: remount usr
changed_when: False