infra-vagrant-host/ansible/tasks/nfs.yml
2023-02-17 15:48:29 +01:00

34 lines
830 B
YAML

---
- name: Add extra internal network interface for NFS
ansible.builtin.copy:
src: files/etc.network.interfaces.d.svc0
dest: /etc/network/interfaces.d/svc0
owner: root
group: root
register: nfs_net_iface
- name: Restart network interface
shell:
cmd: ifdown svc0 && ifup svc0
when: nfs_net_iface.changed == true
- name: Install nfs
apt:
name: nfs-kernel-server
state: present
- name: Limit nfs service to localhost and svc0
ansible.builtin.blockinfile:
path: /etc/default/nfs-kernel-server
insertafter: '^RPCSVCGSSDOPTS='
block: |
# Listen only on localhost and svc0
RPCNFSDOPTS="-H 127.0.0.1 -H 192.168.254.254"
register: nfs_config_limit
- ansible.builtin.service:
name: nfs-kernel-server
state: restarted
when: nfs_config_limit.changed == true
#