企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 通过ansible剧本部署nfs客户端与服务端。 > 要求: > 1)服务端分享/data目录, > 2)客户端backup服务器把/data目录挂载到/nfsbackup目录中 --- ## nfs 服务端部署 ``` - hosts: 10.0.0.24 tasks: - name: ensure rsync is at the latest version yum: name: nfs-utils,rpcbind state: latest - name: run rpcbind service: name: rpcbind state: started enabled: yes - name: run nfs service: name: nfs state: started enabled: yes - name: make data dir file: path: /data state: directory owner: nfsnobody group: nfsnobody - name: set exports file copy: #content: '#share /data 172.16.1.0/24\n/data 172.16.1.0/24(rw,sync)' content: '#share /data 10.0.0.0/24\n/data 10.0.0.0/24(rw,sync)' dest: /etc/exports - name: reload nfs service: name: nfs state: reloaded - name: test nfs shell: rpcinfo -p 172.16.1.31;showmount -e 172.16.1.31 ``` ## nfs 客户端部署 ``` - hosts: 10.0.0.22 tasks: - name: ensure rsync is at the latest version yum: name: nfs-utils,rpcbind state: latest - name: run rpcbind service: name: rpcbind state: started enabled: yes - name: run nfs service: name: nfs state: stoped enabled: no - name: make upload dir file: path: /upload state: directory - name: mount nfs mount: path: /mnt/dvd src: /dev/sr0 fstype: iso9660 opts: ro,noauto state: present ```