Ansible中安装模块出错

时间:2016-02-17 06:21:28

标签: ansible ansible-playbook ansible-2.x

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

- 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

2 个答案:

答案 0 :(得分:1)

对于获得相同错误的未来人员,请设置相应的fstype

当我尝试执行类似的操作时,我得到了完全相同的错误消息,挂载了NFS共享。它在shell中运行良好。但是在Ansible任务中设置fstype: nfs之后它就起作用了。

从这里得到线索:Why won't Ansible mount Vagrant remote NFS share

答案 1 :(得分: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并添加适当的记录。

相关问题