46 lines
838 B
YAML
46 lines
838 B
YAML
---
|
|
- name: Configure firewall for NFS
|
|
become: true
|
|
firewalld:
|
|
immediate: yes
|
|
permenant: yes
|
|
service: nfs
|
|
state: enabled
|
|
zone: public
|
|
|
|
- name: Install NFS
|
|
become: true
|
|
when: ansible_distribution == "CentOS"
|
|
yum:
|
|
name: nfs-utils
|
|
state: latest
|
|
|
|
- name: Enable NFS server
|
|
become: true
|
|
service:
|
|
name: nfs-server
|
|
enabled: true
|
|
state: started
|
|
|
|
- name: Create exports directory
|
|
become: true
|
|
file:
|
|
path: /share
|
|
state: directory
|
|
|
|
- name: Symlink shares to exports directory
|
|
become: true
|
|
file:
|
|
dest: /share/{{ item.name }}
|
|
src: {{ item.path }}
|
|
state: link
|
|
|
|
- name: Modify /etc/exports
|
|
become: true
|
|
lineinfile:
|
|
path: /etc/exports
|
|
backup: yes
|
|
create: true
|
|
state: present
|
|
line: "/share/{{ item.name }} {{ item.access }}({{ item.permissions }})"
|