Original: nfs software services use ansible for one-click deployment, nfsansible
[Root @ m01 tools] # cat nfspeizhi. sh
Cat>/etc/exports <EOF
/Data 172.16.1.0/24 (rw, sync)
EOF
-Hosts: 172.16.1.131 # Server
Tasks:
-Name: yum
Shell: yum install-y nfs-utils rpcbind # install nfs
-Name: yunm
Shell: yum-y install sshpass # software for installing the key
-Name: chuangjianmulu
Shell: mkdir-p/server/tools/# create the configuration file
-Name: peizhi
Copy: src =/server/tools/nfspeizhi. sh dest =/server/tools/nfspeizhi. sh
-Name: yunxingjiaoben
Script:/server/tools/nfspeizhi. sh # Run the script
-Name: guanlimulu
Shell: mkdir-p/data & chown-R nfsnobody. nfsnobody/data
-Name: qidong
Shell:/etc/init. d/rpcbind start # start
-Name: kaijiqidong
Shell: chkconfig rpcbind on & chkconfig nfs on
# Set the password file
-Hosts: 172.16.1.108
Tasks:
-Name: yum
Shell: yum install-y nfs-utils rpcbind # Client
#-Name: gui
# Shell: umount-f/mnt
-Name: guazai
Shell: mount-t nfs 172.16.1.131:/data/mnt
-Hosts: 172.16.1.141
Tasks:
-Name: yumh
Shell: yum install-y nfs-utils rpcbind # Client
#-Name: guih
# Shell: umount-f/mnt
-Name: guazaih
Shell: mount-t nfs 172.16.1.131:/data/mnt