Error in Mount Module in Ansible

别来无恙 提交于 2020-01-06 04:45:10

问题


I am trying to mount a remote directory. Following is the code:

- name: mount the folder.
  mount: name=/mnt/point src="//sdfs601/master.src/scm/pkgs" fstype=auto opts="domain=td,username=uname,password=pass,file_mode=0777,dir_mode=0777" state=mounted

But it is giving the following error:

fatal: [153.64.221.181]: FAILED! => {"changed": false, "failed": true, "msg": "Error mounting /mnt/15.00: mount: special device //sdfs601/master.src/scm/pkgs does not exist\n"}

But when i try mounting using the shell command on target host. It is working fine. Following is the command:

/bin/mount -o username=uname,password=pass,domain=dd //sdfs601/master.src/scm/pkgs /mnt/point

回答1:


http://docs.ansible.com/ansible/mount_module.html

This module controls active and configured mount points in /etc/fstab. You can check python code https://github.com/ansible/ansible-modules-core/blob/devel/system/mount.py#L219

Please check your /etc/fstab and add an appropriate record.




回答2:


For future folks who are getting the same error, set the appropriate fstype.

I got the exact same error message when I was trying to do something similar, mounting an NFS share. It also worked fine in shell. But then it worked after setting fstype: nfs in the Ansible task.

Got the clue from here: Why won't Ansible mount Vagrant remote NFS share



来源:https://stackoverflow.com/questions/35449311/error-in-mount-module-in-ansible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!