2019-04-18 14:20:08 +00:00
|
|
|
---
|
|
|
|
- name: install nfs
|
|
|
|
apt:
|
|
|
|
pkg: nfs-kernel-server
|
|
|
|
state: present
|
2019-04-18 17:11:33 +00:00
|
|
|
when: ansible_distribution == 'Debian'
|
2020-03-14 10:10:11 +00:00
|
|
|
notify: restart nfs-server
|
2019-04-18 17:11:33 +00:00
|
|
|
|
|
|
|
- name: install nfs
|
|
|
|
pacman:
|
|
|
|
pkg: nfs-utils
|
|
|
|
state: present
|
|
|
|
when: ansible_distribution != 'Debian'
|
2020-03-14 10:10:11 +00:00
|
|
|
notify: restart nfs-server
|
2019-04-18 14:20:08 +00:00
|
|
|
|
|
|
|
- name: Lines in exports
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/exports
|
|
|
|
line: "{{ item.name }} 192.168.1.1/24({{ item.options }})"
|
|
|
|
with_items: "{{ nfs_shares }}"
|
2020-03-14 10:10:11 +00:00
|
|
|
notify: restart nfs-server
|
2019-04-18 14:20:08 +00:00
|
|
|
|
|
|
|
- name: create mount points
|
|
|
|
file:
|
|
|
|
path: "{{ item.name }}"
|
|
|
|
state: directory
|
|
|
|
with_items: "{{ nfs_shares }}"
|
|
|
|
|
|
|
|
- name: rbind Mounts for NFS etc.
|
|
|
|
mount:
|
|
|
|
name: '{{ item.name }}'
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
fstype: none
|
|
|
|
opts: rbind
|
|
|
|
passno: 0
|
|
|
|
state: mounted
|
|
|
|
with_items: "{{ nfs_shares }}"
|
2020-03-14 10:10:11 +00:00
|
|
|
notify: restart nfs-server
|