I want to apply xfs projects in a server-specific way and need to setup the xfs /etc/projects file before I can use the community.general.xfs_quota module.
I have on each server an xfs mountpoint with a folder structure like this:
/mountpoint/projects/$PROJECTNAME/crashdumps
I want to create 1 shared XFS quota for all these folders with e.g. id 1000.
With a shell script this is easy enough:
pushd /;
for x in /mountpoint/projects/*/crashdumps; do
echo 1000:$x;
done|sort > /etc/projects ;
popd
But can I do this with ansible, in a way that the task is only marked changed when the /etc/projects file is actually changed?
To be clear: Ansible should look at the existing folder structure. I prefer not to maintain a per server /etc/projects file or list of folders.