RFC: Ephemeral Mounts

Hi,

I have a playbook that requires filesystems to be mounted temporarily,
and I do not want to have them recorded in /etc/fstab. I was originally
using the command module to call mount and do it by hand, but that
required a lot of boilerplate in my playbook. I thus set out to tweak
the mount module to provide an option to skip writing of /etc/fstab. I
noticed that it has an undocumented argument, fstab, which is used to
specify the path to /etc/fstab. Unfortunately, if this argument is used
in combination with state=mounted, the mount fails. I made a minor
change[1] to allow it to work by explicitly passing all the necessary
information to the mount command, rather than rely on it being specified
in fstab. This works, with the minor caveat that when fstab=/dev/null,
it always reports changed, even if it didn't actually do anything. That
should be relatively easy to fix, but before I dive too far into the
rabbit hole, I wanted to get other opinions on the problem and possible
solutions.

[1] https://github.com/AdmiralNemo/ansible/commits/enhance-mount

Thanks,

I’m fine with supporting the concept.

Rather than fstab=/dev/null, perhaps it would be a little easier to grok if we added add_to_fstab=False (default True, to be consistent with present behavior).

I think this might be a little closer to the abstraction level we might want.