robertdebock / ansible-role-nfsserver

Setup exports on an nfs server
https://robertdebock.nl/
Apache License 2.0
3 stars 2 forks source link

The role does not allow you to specify an alternative exports file #3

Closed eseyman closed 5 months ago

eseyman commented 5 months ago

Describe the bug

I've started using this role to deploy my nfs-server but I want to group together exports in /etc/exports.d/*.exports The role only allows to deploy /etc/exports (the name is hardcoded in tasks/main.yml).

Playbook

---
  - name: "install nfsserver"
    hosts: localhost
    connection: local
    become: yes
    roles:
      - role: robertdebock.nfsserver
        nfsserver_exports:
          - share: "/home/manu/Musique"
            owner: manu
            group: manu
            mode: "0755"
            hosts:
              - name: "192.168.1.0/24"
                options:
                  - ro

Output

The role runs without errors but only deploys /etc/exports.

Environment

robertdebock commented 5 months ago

Okay, started drafting a bit. I think you would like a variable such as nfsserver_exports_file, with a default value of /etc/exports. This would mean all defined shares will end up in that file.

Correct?

eseyman commented 5 months ago

Correct?

It's a tad more complicated than that. In my mind, nfsserver_exports_file would be a per-share value (with /etc/exports being the default) and the role would manage all these files. This would allow you to put certain shares in /etc/exports.d/project1.exports, others in /etc/exports.d/project2.exports, ...).

Of course, this would only be possible on distributions that support /etc/exports.d/ and I'm not sure how many do (although it's a pretty safe bet that if Fedora supports it, RHEL supports it).