I'd be happy to! I find in my playbooks that it is fairly cumbersome to set up files and related because of the module distinction between copying files, rendering templates, directories... There's a lot of boilerplate that has to be repeated.

For 3-4 years I've been toying with this in various forms. The idea is a "fsbuilder" module that make a task that logically groups filesystem setup (as opposed to grouping by operation as the ansible.builtin modules do).

You set up in the main part of the task the defaults (mode, owner/group, etc), then in your "loop" you list the fs components and any necessary overrides for the defaults. The simplest could for example be:

    - name: Set up app config
      linsomniac.fsbuilder.fsbuilder:
        dest: /etc/myapp.conf
Which defaults to a template with the source of "myapp.conf.j2". But you can also do more complex things like:

    - name: Deploy myapp - comprehensive example with loop
      linsomniac.fsbuilder.fsbuilder:
        owner: root
        group: myapp
        mode: a=rX,u+w
      loop:
        - dest: /etc/myapp/conf.d
          state: directory
        - dest: /etc/myapp/config.ini
          validate: "myapp --check-config %s"
          backup: true
          notify: Restart myapp
        - dest: /etc/myapp/version.txt
          content: "version={{ app_version }}"
        - dest: "/etc/myapp/passwd"
          group: secrets
I am using this extensively in our infrastructure and run ~20 runs a day, so it's fairly well tested.

More information at: https://galaxy.ansible.com/ui/repo/published/linsomniac/fsbu...