YJWANG

[Ubuntu] NFS-Server 구축 Ansible Ad-Hoc 본문

01.OS-Services

[Ubuntu] NFS-Server 구축 Ansible Ad-Hoc

왕영주 2021. 6. 30. 09:40

Ansible Command 설치

# apt update
# apt install ansible

 

 

Ansible Ad-Hoc Command 실행

'/data' 로 NFS dir를 사용한다는 가정하에 구성됐으니 환경에 맞게 변경하여 사용하시기 바랍니다.

Install NFS Package
# ansible -m apt -a 'name=nfs-kernel-server state=present' localhost

Create Directory
# ansible -m file -a 'path=/data state=directory mode=0777' localhost

LineInFIle
# ansible -m lineinfile -a 'path=/etc/exports line="/data *(rw,no_root_squash,sync)"' localhost

Restart nfs-server
# ansible -m systemd -a 'state=restarted name=nfs-server' localhost

Confirm
# exportfs -v
/data         	<world>(rw,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)

 

 

mount 테스트

# mount -t nfs localhost:/data /mnt

# df -h /mnt
Filesystem       Size  Used Avail Use% Mounted on
localhost:/data   39G  1.8G   37G   5% /mnt

# umount /mnt
반응형