Add some protection from shadowing mount

Currently we do have wrong bind mount order, due to which /var/log/journal
is shadow mounted with later added /var/log mount.
To prevent this we're inserting new mounts before existing ones
in case where they could shadow mount destination.

Change-Id: Id8cca6d83c75202a273df23be353480366ead156
Closes-Bug: #1895533
This commit is contained in:
Dmitriy Rabotyagov 2020-09-15 17:45:07 +03:00
parent 8a3dd1414c
commit 7d7afa4f9a

View File

@ -50,6 +50,7 @@
lineinfile:
dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
line: "lxc.mount.entry = {{ item['mount_path'] }} {{ item['bind_dir_path'].lstrip('/') }} none bind,create=dir 0 0"
insertbefore: "^lxc.mount.entry = .*\\s{{ item['bind_dir_path'].lstrip('/') | regex_replace('/', '\/') }}.*"
backup: "true"
with_items:
- "{{ lxc_default_bind_mounts | default([]) }}"