使用 ansible playbook 在 windows 中创建共享文件夹

杜兰阿尔吉里亚

我正在尝试创建一个 ansible playbook 来在 Windows 中创建一个共享文件夹。所以我想在执行剧本时自动获取目标 Windows 主机名并将文件夹创建为文件下载路径,我很难在文件夹创建过程中自动获取主机名。

---
# creating share_folder for file download

- name: create share folder for file download
  win_share: 
    name: fileFileDownloadPath
    description: share folder for file download
    path: C:\(target windows hostname should come here)\{{FileDownloadPath}}
    full: Administrator
笑脸

您可以使用 ansible_hostname 或 inventory_hostname 事实

path: C:\{{ansible_hostname }}\{{FileDownloadPath}}
or 
path: C:\{{inventory_hostname }}\{{FileDownloadPath}}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章