47 lines
928 B
YAML
47 lines
928 B
YAML
|
---
|
||
|
|
||
|
- name: Make NFS Host
|
||
|
hosts: kube-fs
|
||
|
become: true
|
||
|
|
||
|
tasks:
|
||
|
- name: Install Requirements
|
||
|
apt:
|
||
|
state: present
|
||
|
name: nfs-kernel-server
|
||
|
|
||
|
- name: Enable NFS Service
|
||
|
systemd:
|
||
|
name: nfs-mountd
|
||
|
state: started
|
||
|
enabled: true
|
||
|
|
||
|
- name: Make shares
|
||
|
file:
|
||
|
state: directory
|
||
|
path: "{{ item }}"
|
||
|
with_items:
|
||
|
- '/mnt/nfsshare'
|
||
|
|
||
|
- name: mount data disk
|
||
|
mount:
|
||
|
path: /mnt/data
|
||
|
src: /dev/sdb
|
||
|
fstype: ext4
|
||
|
opts: rw,relatime
|
||
|
state: present
|
||
|
|
||
|
- name: Add /mnt/nfsshare as a NFS Share
|
||
|
lineinfile:
|
||
|
path: /etc/exports
|
||
|
line: "/mnt/nfsshare *(rw,sync,no_root_squash)"
|
||
|
|
||
|
- name: Add /mnt/data as a NFS Share
|
||
|
lineinfile:
|
||
|
path: /etc/exports
|
||
|
line: "/mnt/data *(rw,sync,no_root_squash)"
|
||
|
|
||
|
- name: Update NFS Exports
|
||
|
shell: exportfs -rav
|
||
|
|