423212 发表于 2017-9-7 11:26:29

ansible一键批量部署nfs服务

一键安装nfs服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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






页: [1]
查看完整版本: ansible一键批量部署nfs服务