Ansible_workstation/tasks/nfs_share.yml

39 lines
792 B
YAML

---
- name: install nfs
apt:
pkg: nfs-kernel-server
state: present
when: ansible_distribution == 'Debian'
notify: restart nfs
- name: install nfs
pacman:
pkg: nfs-utils
state: present
when: ansible_distribution != 'Debian'
notify: restart nfs
- name: Lines in exports
lineinfile:
dest: /etc/exports
line: "{{ item.name }} 192.168.1.1/24({{ item.options }})"
with_items: "{{ nfs_shares }}"
notify: restart nfs
- 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 }}"
notify: restart nfs