Reputation: 3
I'm trying to create an ansible playbook to create a shared folder in windows. So I want to get the target windows hostname automatically while executing the playbook and create the folder as filedownload path, I'm struggle with getting the hostname automatically during folder creation.
---
# 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
Upvotes: 0
Views: 1483
Reputation: 2568
You can use ansible_hostname or inventory_hostname fact
path: C:\{{ansible_hostname }}\{{FileDownloadPath}}
or
path: C:\{{inventory_hostname }}\{{FileDownloadPath}}
Upvotes: 1