From 112ad23a66698735e2fcbdc5bcbb9227497b4fed Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Tue, 17 Dec 2024 20:15:20 +0000 Subject: [PATCH] nfs_server: Move configs to include file --- roles/nfs_server/files/local.conf | 7 +++++++ roles/nfs_server/tasks/main.yml | 30 ++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 roles/nfs_server/files/local.conf diff --git a/roles/nfs_server/files/local.conf b/roles/nfs_server/files/local.conf new file mode 100644 index 0000000..b5085c3 --- /dev/null +++ b/roles/nfs_server/files/local.conf @@ -0,0 +1,7 @@ +[mountd] +debug="auth,general" + +[nfsd] +udp=n +tcp=y +vers3=n diff --git a/roles/nfs_server/tasks/main.yml b/roles/nfs_server/tasks/main.yml index c73f100..c2ca5fd 100644 --- a/roles/nfs_server/tasks/main.yml +++ b/roles/nfs_server/tasks/main.yml @@ -1,21 +1,19 @@ --- -- name: Disable NFS versions 2 and 3 - ansible.builtin.lineinfile: - path: /etc/nfs.conf - line: "{{ item }}=n" - regexp: '^(#\s*)?{{ item }}=.*' - with_items: - - vers2 - - vers3 - notify: Restart nfs-server +- name: Create config directory + ansible.builtin.file: + path: /etc/nfs.conf.d + state: directory + mode: "0755" + owner: root + group: "{{ ansible_wheel }}" -- name: Disable NFS over UDP - ansible.builtin.lineinfile: - path: /etc/nfs.conf - line: "udp=n" - regexp: '^(#\s*)?udp=.*' - insertbefore: vers2=n - notify: Restart nfs-server +- name: Create local config + ansible.builtin.copy: + dest: /etc/nfs.conf.d/local.conf + src: local.conf + mode: "0644" + owner: root + group: "{{ ansible_wheel }}" - name: Install home/role autocreate scripts ansible.builtin.copy: