j1ngk3.nfs
Ansible角色:NFS
安装NFS服务器/客户端。
需求
无。
角色变量
可以传递给此角色的变量及其简要说明如下:
# NFS安装模式:服务器或客户端
nfs_mode: server
# 要添加到/etc/exports文件的行
nfs_exports:
- path: "/home"
export: "vnode*.localdomain(fsid=0,rw,async,no_root_squash,no_subtree_check,insecure)"
# 要添加到/etc/fstab文件的行
nfs_client_imports:
- local: "/home"
remote: "/home"
server_host: "{{hostvars['server']['ansible_default_ipv4']}}"
NFS客户端导入还可以定义以下变量:
state
:更多信息请参见:http://docs.ansible.com/ansible/mount_module.htmlopts
:更多信息请参见:https://wiki.debian.org/fr/fstabdump
:更多信息请参见:https://wiki.debian.org/fr/fstabpassno
:更多信息请参见:https://wiki.debian.org/fr/fstab
依赖
无。
示例剧本
以下是如何安装和配置NFS服务器和客户端的示例:
- hosts: server
roles:
- { role: 'j1ngk3.nfs', nfs_mode: 'server', nfs_exports: [{path: "/home", export: "vnode*.localdomain(fsid=0,rw,async,no_root_squash,no_subtree_check,insecure)"}] }
- hosts: client
roles:
- { role: 'j1ngk3.nfs', nfs_mode: 'client', nfs_client_imports: [{ local: "/home", remote: "/home", server_host: "{{hostvars['server']['ansible_default_ipv4']}}" }] }
许可证
Apache许可证 v2 [1]