Open parthadas-1986 opened 1 year ago
Mapped drives are not created on network logons so they won’t be accessible in Ansible tasks. You’ll have to use the UNC path to the Azure File Share and also use become to unlock the credential manager store or specify explicit credentials for authentication.
Mapped drives are not created on network logons so they won’t be accessible in Ansible tasks. You’ll have to use the UNC path to the Azure File Share and also use become to unlock the credential manager store or specify explicit credentials for authentication.
Thanks for your reply, I already tried with UNC path also, getting same result, But i have to check with become option, that i haven't tried yet.
UNC will allow it to connect but you need something to overcome the double hop/credential delegation problem. Become is one way of doing so.
Hi, I have tried with following playbook
- name: windows mssql install
hosts: mssql
gather_facts: yes
become_user: ansibleusr
tasks:
- name: Edit Default.PFL file(Profile Edit)
win_lineinfile:
path: \saptest16.file.core.windows.net\sapmnt\TEST\DEFAULT.PFL
regex: "{{ item.from }}"
line: "{{ item.to }}"
remote_src: true
with_items:
- { from: '^SAPDBHOST =' , to: 'SAPDBHOST = windows' }
But still getting following error
TASK [Edit Default.PFL file(Profile Edit)] **** Wednesday 12 April 2023 07:12:21 +0000 (0:00:06.414) 0:00:06.611 *** failed: [sqltest01.azsqlha.cloudcoe.local] (item={'from': '^SAPDBHOST =', 'to': 'SAPDBHOST = windows'}) => {"ansible_loop_var": "item", "changed": false, "item": {"from": "^SAPDBHOST =", "to": "SAPDBHOST = windows"}, "msg": "Path \saptest16.file.core.windows.net\sapmnt\TEST\DEFAULT.PFL does not exist !"}
SUMMARY
The Azure File Share is successfully mounted on the Windows VM (Windows Server 2019 Datacenter), and required permissions are added as per Microsoft document. But whenever we are trying to update any file with in the share path using ansible code(win_lineinfile), we are getting "File path does not exists" error. But in the same VM, we are able to edit file in other physical location and also we can manually update file in AFS path, only via ansible it is not working. Please note, We are running the ansible code from Control node (i.e. A Linux vm in same vnet and same region)
ISSUE TYPE
COMPONENT NAME
win_lineinfile
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Windows 2019 Datacenter
STEPS TO REPRODUCE
EXPECTED RESULTS
"SAPDBHOST =" text should replaced with 'SAPDBHOST = windows' in the file located in AFS mount path
ACTUAL RESULTS
File is not getting updated after running this playbook.