1

我正在尝试挂载远程目录。以下是代码:

- 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

但它给出了以下错误:

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"}

但是当我尝试在目标主机上使用 shell 命令安装时。它工作正常。以下是命令:

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

2 回答 2

2

对于将来遇到相同错误的人,请设置适当的fstype.

当我尝试做类似的事情,挂载 NFS 共享时,我收到了完全相同的错误消息。它在 shell 中也能正常工作。fstype: nfs但是在设置Ansible 任务后它就起作用了。

从这里得到线索:为什么 Ansible 不能挂载 Vagrant 远程 NFS 共享

于 2018-03-01T17:16:21.727 回答
0

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

该模块控制 /etc/fstab 中活动和配置的挂载点。您可以检查 python 代码https://github.com/ansible/ansible-modules-core/blob/devel/system/mount.py#L219

请检查您的 /etc/fstab 并添加适当的记录。

于 2016-03-13T05:38:19.603 回答