infrastructure icon indicating copy to clipboard operation
infrastructure copied to clipboard

Ansible request for directory creation on Windows

Open sxa opened this issue 2 years ago • 6 comments

Please put the name of the software product (and affected platforms if relevant) in the title of this issue

Delete as appropriate from this list:

  • Bug in ansible playbook

Details: Windows playbooks utilise but do not create c:\temp which is required for some playbook roles and it is not on all machines by default. Similarly c:\openjdk which is required when creating the symbolic links with mklink will fail with The system cannot find the path specified

sxa avatar Aug 25 '22 13:08 sxa

@sxa believe these directories are created at the very beginning of the Common role in the windows playbook. Can you see if you can reproduce this, as I am unable.

TASK [Common : Create C:\temp directory] ***************************************
changed: [192.168.50.8]

TASK [Common : Create C:\openjdk directory] ************************************
changed: [192.168.50.8]

steelhead31 avatar Sep 02 '22 12:09 steelhead31

Removing from the September plan until I can attempt to reproduce on a clean Azure deployment (Unsure which type of machine I hit this on)

sxa avatar Sep 05 '22 14:09 sxa

Hit this again today when using a new Windows system created at Azure: AWX link: https://awx2.adoptopenjdk.net/#/jobs/playbook/553

TASK [WMF_5.1 : Get WMF 5.1 Packages] ******************************************
fatal: [build-sxa-win2012r2-x64-1]: FAILED! => {"changed": false, "dest": "C:/temp/WMFinstaller.msu", "elapsed": 0, "msg": "The path 'C:\\temp' does not exist for destination 'C:/temp/WMFinstaller.msu', or is not visible to the current user.  Ensure download destination folder exists (perhaps using win_file state=directory) before win_get_url runs.", "url": "https://go.microsoft.com/fwlink/?linkid=839516"}
PLAY RECAP *********************************************************************
build-sxa-win2012r2-x64-1  : ok=8    changed=2    unreachable=0    failed=1    skipped=5    rescued=0    ignored=0   

Created the directory manually to work around it.

sxa avatar Oct 18 '22 12:10 sxa

I notice in the awx jobit has the skipped tag "basic_config" , the task that creates the c:\temp dir has this tag..
- name: Create C:\temp directory
 win_file:
   path: C:\temp
   state: directory
 tags: basic_config

steelhead31 avatar Oct 18 '22 13:10 steelhead31

Similarly I'm missing C:\openjdk resulting in this:

TASK [Java7 : Create symlink to Java 7] ****************************************
fatal: [build-sxa-win2012r2-x64-1]: FAILED! => {"changed": true, "cmd": "mklink /D \"C:\\openjdk\\jdk-7\" \"C:\\Program Files\\Java\\java-se-7u75-ri\"", "delta": "0:00:00.062500", "end": "2022-10-18 01:08:21.670590", "msg": "non-zero return code", "rc": 1, "start": "2022-10-18 01:08:21.608089", "stderr": "The system cannot find the path specified.\r\n", "stderr_lines": ["The system cannot find the path specified."], "stdout": "", "stdout_lines": []}
PLAY RECAP *********************************************************************
build-sxa-win2012r2-x64-1  : ok=44   changed=25   unreachable=0    failed=1    skipped=5    rescued=0    ignored=0   

sxa avatar Oct 18 '22 13:10 sxa

I notice in the awx jobit has the skipped tag "basic_config" , the task that creates the c:\temp dir has this tag.. - name: Create C:\temp directory win_file: path: C:\temp state: directory tags: basic_config

Well spotted - I don't recall why that is there. We should probably check whether the use of that role is a sensible approach for creating those directories ...

sxa avatar Oct 18 '22 13:10 sxa