|
|
dac76a |
From 254cb60e722539032c6ea73616d6ab51eb1d4edf Mon Sep 17 00:00:00 2001
|
|
|
dac76a |
From: Watson Sato <wsato@redhat.com>
|
|
|
dac76a |
Date: Fri, 15 May 2020 23:36:18 +0200
|
|
|
dac76a |
Subject: [PATCH] Ansible mount_option: split mount and option task
|
|
|
dac76a |
|
|
|
dac76a |
Separate task that adds mount options mounts the mountpoint into two tasks.
|
|
|
dac76a |
Conditioning the "mount" task on the absence of the target mount option
|
|
|
dac76a |
caused the task to always be skipped when mount option was alredy present,
|
|
|
dac76a |
and could result in the mount point not being mounted.
|
|
|
dac76a |
---
|
|
|
dac76a |
shared/templates/template_ANSIBLE_mount_option | 11 ++++++++---
|
|
|
dac76a |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
dac76a |
|
|
|
dac76a |
diff --git a/shared/templates/template_ANSIBLE_mount_option b/shared/templates/template_ANSIBLE_mount_option
|
|
|
dac76a |
index 95bede25f9..a0cf8d6b7a 100644
|
|
|
dac76a |
--- a/shared/templates/template_ANSIBLE_mount_option
|
|
|
dac76a |
+++ b/shared/templates/template_ANSIBLE_mount_option
|
|
|
dac76a |
@@ -26,14 +26,19 @@
|
|
|
dac76a |
- device_name.stdout is defined and device_name.stdout_lines is defined
|
|
|
dac76a |
- (device_name.stdout | length > 0)
|
|
|
dac76a |
|
|
|
dac76a |
-- name: Ensure permission {{{ MOUNTOPTION }}} are set on {{{ MOUNTPOINT }}}
|
|
|
dac76a |
+- name: Make sure {{{ MOUNTOPTION }}} option is part of the to {{{ MOUNTPOINT }}} options
|
|
|
dac76a |
+ set_fact:
|
|
|
dac76a |
+ mount_info: "{{ mount_info | combine( {'options':''~mount_info.options~',{{{ MOUNTOPTION }}}' }) }}"
|
|
|
dac76a |
+ when:
|
|
|
dac76a |
+ - mount_info is defined and "{{{ MOUNTOPTION }}}" not in mount_info.options
|
|
|
dac76a |
+
|
|
|
dac76a |
+- name: Ensure {{{ MOUNTPOINT }}} is mounted with {{{ MOUNTOPTION }}} option
|
|
|
dac76a |
mount:
|
|
|
dac76a |
path: "{{{ MOUNTPOINT }}}"
|
|
|
dac76a |
src: "{{ mount_info.source }}"
|
|
|
dac76a |
- opts: "{{ mount_info.options }},{{{ MOUNTOPTION }}}"
|
|
|
dac76a |
+ opts: "{{ mount_info.options }}"
|
|
|
dac76a |
state: "mounted"
|
|
|
dac76a |
fstype: "{{ mount_info.fstype }}"
|
|
|
dac76a |
when:
|
|
|
dac76a |
- - mount_info is defined and "{{{ MOUNTOPTION }}}" not in mount_info.options
|
|
|
dac76a |
- device_name.stdout is defined
|
|
|
dac76a |
- (device_name.stdout | length > 0)
|