Excerpts from Michael DeHaan's message of 2014-07-15 11:37:33 -0400:
> Can you share more about what the proposed syntax might be for this flag
> (such as an example playbook line?)
That's actually where I run into trouble; the filesystem module's
arguments and their semantics don't leave a lot of room for extending.
Currently, the filesystem module will create a filesystem if none
exists, or create filesystem unconditionally when force=yes.
I could imagine changing the behavior by adding a 'size' parameter, so
that one could do the following:
---
# creates a filesystem or resizes the filesystem to fit its block device
filesystem: dev=/dev/sda1 fstype=ext4
# creates a filesystem of a given size or expands an existing filesystem to 10g
filesystem: dev=/dev/sda1 fstype=ext4 size=10g
# creates a filesystem of a given size, or expands or *shrinks* as necessary
filesystem: dev=/dev/sda1 fstype=ext4 size=10g allow_shrinking=yes
# creates a filesystem unconditionally
filesystem: dev=/dev/sda1 fstype=ext4 size=10g force=yes
This has the disadvantage of being kind of magic, and changing the
module's current behavior when passed only 'dev' and 'fstype' (currently
it leaves the filesystem untouched).
Other alternatives might be adding a 'allow_resizing' parameter that
defaulted to false and preserved the modules current behavior, making
resizing opt-in.
One could also imagine a 'state' parameter which took 'present' and
'absent' in addition to something like 'sized', where only the latter
triggers resizing.
Obviously there will be sanity checks to avoid loss of data via
shrinking, for example.
Not sure about the best approach here.
--
Morgan Hamill