My zip file contains a folder UAT-04022021_01
which has several files.
ls output on my local ansible server zip achieve file and its contents below:
-rwxrwxr-x 1 user1 user1 171910544 Feb 4 07:02 /web
/playbooks/automation/deployments/tmpfiles/04/UAT-04022021_01.zip
$ unzip -l "/web/playbooks/automation/deployments/tmpfiles/04/UAT-04022021_01.zip"
Archive: /web/playbooks/automation/deployments/tmpfiles/04/UAT-04022021_01.zip
Length Date Time Name
--------- ---------- ----- ----
0 02-04-2021 17:31 UAT-04022021_01/
144241065 02-04-2021 15:58 UAT-04022021_01/canv.ear
8342584 02-04-2021 16:00 UAT-04022021_01/canpizza.ear
10522141 02-04-2021 16:01 UAT-04022021_01/cantity.ear
8778258 02-04-2021 15:59 UAT-04022021_01/canipc.ear
--------- -------
171884048 5 files
[user1@linuxlocalhost deployments]$
Below is my code to extract the zip to all remote destination hosts
---
- name: "Play 1"
host: "{{ dest_host }}"
user: "{{ USER }}"
- name: Give better permissions to the zip file
tags: validate
file:
path: "{{ playbook_dir }}/tmpfiles/{{ Latest_Build_Number }}/{{ depfile | basename }}"
mode: 0775
delegate_to: localhost
run_once: true
- name: "Untar artifacts in CURRENT Folder"
tags: validate
unarchive:
src: "{{ playbook_dir }}/tmpfiles/{{ Latest_Build_Number }}/{{ depfile | basename }}"
dest: "/web/bea_apps/applications/{{ domain_home }}/{{ item }}/CURRENT/"
with_items: "{{ CLUSTER.split(',') }}"
Output:
#############################################\n\n')
The full traceback is:
File "/tmp/ansible_MCNgND/ansible_module_unarchive.py", line 873, in main
res_args['changed'] = module.set_fs_attributes_if_different(file_args, res_args['changed'], expand=False)
File "/tmp/ansible_MCNgND/ansible_modlib.zip/ansible/module_utils/basic.py", line 1473, in set_fs_attributes_if_different
file_args['path'], file_args['mode'], changed, diff, expand
File "/tmp/ansible_MCNgND/ansible_modlib.zip/ansible/module_utils/basic.py", line 1204, in set_mode_if_different
path_stat = os.lstat(b_path)
failed: [myserver2] (item=VL_BATCH) => {
"changed": false,
"dest": "/web/bea_apps/applications/mydom1/VL_BATCH/CURRENT/",
"gid": 64332,
"group": "wladmin",
"handler": "ZipArchive",
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": "/web/bea_apps/applications/mydom1/VL_BATCH/CURRENT/",
"directory_mode": null,
"exclude": [],
"extra_opts": [],
"follow": false,
"force": null,
"group": null,
"keep_newer": false,
"list_files": false,
"mode": null,
"original_basename": "UAT-04022021_01.zip",
"owner": null,
"regexp": null,
"remote_src": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": "/home/wladmin/.ansible/tmp/ansible-tmp-1612477399.28-110140157282432/source",
"unsafe_writes": null,
"validate_certs": true
}
},
"item": "VL_BATCH",
"mode": "0755",
"msg": "Unexpected error when accessing exploded file: [Errno 2] No such file or directory: '/web/bea_apps/applications/mydom1/VL_BATCH/CURRENT/UAT-04022021_01/'",
"owner": "wladmin",
"size": 2,
"src": "/home/wladmin/.ansible/tmp/ansible-tmp-1612477399.28-110140157282432/source",
"state": "directory",
"uid": 600000008
}
/web/bea_apps/applications/mydom1/VL_BATCH/CURRENT/
is empty and has permission for the user to write to.
I checked on the destination and it does contain this folder /web/bea_apps/applications/mydom1/VL_BATCH/CURRENT/
but not /web/bea_apps/applications/mydom1/VL_BATCH/CURRENT/UAT-04022021_01/
It was supposed to create this folder UAT-04022021_01
if it unzips under the CURRENT
folder.
After researching a bit more I tried this suggested fix of environment
but it does not help either.
- name: "Untar artifacts in CURRENT Folder"
tags: validate
unarchive:
src: "{{ playbook_dir }}/tmpfiles/{{ Latest_Build_Number }}/{{ depfile | basename }}"
dest: "/web/bea_apps/applications/{{ domain_home }}/{{ item }}/CURRENT/"
with_items: "{{ CLUSTER.split(',') }}"
environment:
LANG: C
LC_ALL: C
LC_MESSAGES: C
My source is Linux while destination is Solaris.
Can you please suggest what could be wrong?