使用模块而不是shell与Ansible临时挂载smb共享

问题描述 投票:0回答:1

我需要挂载smb共享才能访问Ansible中大型共享安装文件。使用CLI可以工作:

- name: Mount share
  become: yes
  shell: "mount.cifs {{ smb_share.path }} {{ smb_share.mount_point }} -o user={{ smb_share.user }},password={{ smb_share.password }},mfsymlinks,exec"

但是,这有两个缺点:

  • 在需要时不遵循使用模块而不是shell命令的最佳做法
  • 如果已安装,则无法检测-我需要实施此操作,例如由grep表示mount]中的挂载点
  • Ansible中有一个mount模块。但是由于此共享仅用于安装并使用凭据,因此我不想将其永久挂载。 mount参数看起来是我需要的,可惜不是Linux:

boot

我仍然尝试设置Determines if the filesystem should be mounted on boot. Only applies to Solaris systems. ,但如文档所述,它仍然使用纯文本密码创建boot: no条目。

是否可以通过任何Ansible模块将Windows共享临时安装在CentOS 7上?

我需要挂载smb共享才能访问Ansible中大型共享安装文件。可以在CLI下使用:-名称:挂载共享成为:yes shell:“ mount.cifs {{smb_share.path}} {{...

ansible centos smb
1个回答
0
投票

我不知道在ansible中有一些临时安装的特定模块。但是从文档中,您可以通过以下方式使用mount

© www.soinside.com 2019 - 2024. All rights reserved.