fstype 指定挂载文件的系统类型,必须指定
path 定义挂载到哪个目录,必须指定
src 定义挂载内容
state 挂载状态
mounted进行挂载,修改/etc/fstab信息
unmounted临时卸载,不修改/etc/fstab信息
absent永久性卸载,并修改 /etc/fstab信息​​

  • name: 永久挂载

mount: src=/dev/sdb path=/data state=mounted fstype=iso9660

  • 1.永久挂载

[root@ansible

2.临时卸载

[root@ansible ~]# ansible mysql -m mount -a 'fstype=iso9660 src=/dev/sr0 path=/mnt state=unmounted'
192.168.56.88 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"dump": "0",
"fstab": "/etc/fstab",
"fstype": "iso9660",
"name": "/mnt",
"opts": "defaults",
"passno": "0",
"src": "/dev/sr0"
}

3.永久卸载

[root@ansible ~]# ansible mysql -m mount -a 'fstype=iso9660 src=/dev/sr0 path=/mnt state=absent'
192.168.56.88 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"dump": "0",
"fstab": "/etc/fstab",
"fstype": "iso9660",
"name": "/mnt",
"opts": "defaults",
"passno": "0",
"src": "/dev/sr0"
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

ansible