选项 | 参数 | 备注 |
---|---|---|
fstype | 挂载类型。iso9660、ext4、nfs、none | |
opts | 挂载权限 | |
path | 必选项 | 本地挂载点 |
src | 指定要挂载的设备 | |
state | absentmountedpresentunmounted | 卸载设置,清理/etc/fstab写入的配置挂载设备,并把配置写入/etc/fstab开机挂载,仅把配置写入/etc/fstab卸载设备,不会清除/etc/fstab |
挂载nfs
代码语言:javascript复制---
- hosts: IP
remote_user: root
tasks:
- name: mount dev
mount:
src: 192.168.1.10:/data/nfs
path: /data/nfs
fstype: nfs
state: mounted
卸载nfs
代码语言:javascript复制---
- hosts: IP
remote_user: root
tasks:
- name: umount dev
mount:
path: /data/nfs
state: absent