forked from evolix/ansible-roles
remount-usr: do not try to remount /usr RW if /usr is not a mounted partition
This commit is contained in:
parent
c90afcb4f4
commit
66b69f1502
|
@ -20,6 +20,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
* etc-git: add /var/chroot-bind/etc/bind repo
|
* etc-git: add /var/chroot-bind/etc/bind repo
|
||||||
* webapps/nextcloud: Set ownership and permissions of data directory
|
* webapps/nextcloud: Set ownership and permissions of data directory
|
||||||
* webapps/nextcloud: Add condition for config tasks
|
* webapps/nextcloud: Add condition for config tasks
|
||||||
|
* remount-usr: do not try to remount /usr RW if /usr is not a mounted partition
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,28 @@
|
||||||
---
|
---
|
||||||
# findmnt returns 0 on hit, 1 on miss
|
# findmnt returns 0 on hit, 1 on miss
|
||||||
# If the return code is higher than 1, it's a blocking failure
|
# If the return code is higher than 1, it's a blocking failure
|
||||||
|
|
||||||
|
- name: "check if /usr is a mountpoint"
|
||||||
|
ansible.builtin.shell: "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"
|
- name: "check if /usr is a read-only partition"
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: 'findmnt /usr --noheadings --options ro'
|
cmd: 'findmnt /usr --noheadings --options ro'
|
||||||
|
register: usr_partition
|
||||||
|
when: usr_mount_exists.rc == 0
|
||||||
changed_when: False
|
changed_when: False
|
||||||
failed_when: usr_partition.rc > 1
|
failed_when: usr_partition.rc > 1
|
||||||
check_mode: no
|
check_mode: False
|
||||||
register: usr_partition
|
|
||||||
|
|
||||||
- name: "mount /usr in rw"
|
- name: "mount /usr in rw"
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: 'mount -o remount,rw /usr'
|
cmd: 'mount -o remount,rw /usr'
|
||||||
changed_when: False
|
when:
|
||||||
when: usr_partition.rc == 0
|
- usr_mount_exists.rc == 0
|
||||||
|
- usr_partition.rc == 0
|
||||||
notify: remount usr
|
notify: remount usr
|
||||||
|
changed_when: False
|
||||||
|
|
Loading…
Reference in a new issue