diff --git a/README.md b/README.md index f9117b2..b2c4810 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,14 @@ ## Overview -Manage NFS (client) installation. +Manage NFS (client) installation and configuration. ## Role Variables * **nfs_cli_manage** : If `nfs-client` should be managed with this role [default : `true`]. * **nfs_cli_pkg_state** : State of new `nfs-client` package(s) [default : `installed`]. +* **nfs_cli_conf_path** : Configuration file for `nfs-client` [default : `/etc/default/nfs-common`]. +* **nfs_cli_conf_tpl** : Template used to generate the previous config file [default : `etc/default/nfs-common.j2`]. ### OS Specific Variables @@ -38,6 +40,7 @@ Please see default value by Operating System file in [vars][vars directory] dire This role will : * Install needed packages to provide `nfs-client`. +* Manage `nfs-client` configuration files. ## Development diff --git a/defaults/main.yml b/defaults/main.yml index d36d6ce..efe9b1b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,3 +4,5 @@ # client nfs_cli_manage: true nfs_cli_pkg_state: 'installed' +nfs_cli_conf_path: '/etc/default/nfs-common' +nfs_cli_conf_tpl: 'etc/default/nfs-common.j2' diff --git a/tasks/main.yml b/tasks/main.yml index 39a396a..b4b9a6c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,4 +15,16 @@ state: '{{ nfs_cli_pkg_state }}' with_items: - '{{ nfs_cli_pkg_list }}' + when: nfs_cli_manage + +- name: CONFIG nfs-client + template: + src: '{{ nfs_cli_conf_tpl }}' + dest: '{{ nfs_cli_conf_path }}' + owner: root + group: root + mode: 0644 + backup: true + when: nfs_cli_manage + # }}} diff --git a/templates/etc/default/nfs-common.j2 b/templates/etc/default/nfs-common.j2 new file mode 100644 index 0000000..aeca677 --- /dev/null +++ b/templates/etc/default/nfs-common.j2 @@ -0,0 +1,21 @@ +# {{ ansible_managed }} + +# If you do not set values for the NEED_ options, they will be attempted +# autodetected; this should be sufficient for most people. Valid alternatives +# for the NEED_ options are "yes" and "no". + +# Do you want to start the statd daemon? It is not needed for NFSv4. +NEED_STATD= + +# Options for rpc.statd. +# Should rpc.statd listen on a specific port? This is especially useful +# when you have a port-based firewall. To use a fixed port, set this +# this variable to a statd argument like: "--port 4000 --outgoing-port 4001". +# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS +STATDOPTS= + +# Do you want to start the idmapd daemon? It is only needed for NFSv4. +NEED_IDMAPD= + +# Do you want to start the gssd daemon? It is required for Kerberos mounts. +NEED_GSSD=