1. 程式人生 > >ansible一鍵批量部署nfs服務

ansible一鍵批量部署nfs服務

nfs 一鍵安裝 批量

一鍵安裝nfs服務

#install nfs_server
- hosts: 172.16.1.31    服務端
  tasks:
    -name: installnfs-utils rpcbind
      yum: name=nfs-utils,rpcbind
    -name: copyconffile
      copy: src=/etc/ansible/nfs_conf/exports dest=/etc/exports #將nfs配置文件配置好直接發送過去
    -name: createuser_www
      user: name=www createhome=no shell=/sbin/nologinuid=888
    -name: create dirdata
      file: dest=/data state=directory owner=www group=www
    -name: startrpc_server
      shell: /etc/init.d/rpcbind start
    -name: startnfs_server
      shell: /etc/init.d/nfs start
- hosts: 172.16.1.41    客戶端
  tasks:
    -name: install nfsrpc rpcbind
      yum: name=nfs-utils,rpcbind
    -name: createuser_www
      user: name=www createhome=no shell=/sbin/nologinuid=888
    -name: mountdata_dir
      mount: name=/mnt src=172.16.1.31:/data fstype=nfs state=mounted


本文出自 “每天一小步” 博客,請務必保留此出處http://fenyuer.blog.51cto.com/11265169/1963177

ansible一鍵批量部署nfs服務