ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
193 stars 152 forks source link

Invalid error with the win_unzip module when attempting to unzip a zip file #562

Open frogstarr78 opened 2 months ago

frogstarr78 commented 2 months ago
SUMMARY

I am receiving an invalid error with the win_unzip module when attempting to unzip a zip file.

ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.12.4]
  config file = /home/noelsc/git/ansible/ansible.cfg
  configured module search path = ['/home/noelsc/git/ansible']
  ansible python module location = /home/noelsc/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/noelsc/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/noelsc/.local/bin/ansible
  python version = 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0]
  jinja version = 3.1.1
  libyaml = True
COLLECTION VERSION
# /home/noelsc/.local/lib/python3.8/site-packages/ansible_collections
Collection        Version
----------------- -------
community.windows 1.9.0

# /home/noelsc/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.windows 2.0.0
CONFIGURATION
ANSIBLE_COW_SELECTION(/home/noelsc/git/ansible/ansible.cfg) = random
ANSIBLE_NOCOWS(env: ANSIBLE_NOCOWS) = True
CACHE_PLUGIN(/home/noelsc/git/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/noelsc/git/ansible/ansible.cfg) = /home/shared/ansible/cache/
COLOR_VERBOSE(/home/noelsc/git/ansible/ansible.cfg) = bright blue
DEFAULT_ACTION_PLUGIN_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/action_plugins']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/callback_plugins']
DEFAULT_CONNECTION_PLUGIN_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/connection_plugins']
DEFAULT_FILTER_PLUGIN_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/filter_plugins']
DEFAULT_FORKS(/home/noelsc/git/ansible/ansible.cfg) = 5
DEFAULT_GATHERING(/home/noelsc/git/ansible/ansible.cfg) = implicit
DEFAULT_HOST_LIST(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/inventory/hosts.yml']
DEFAULT_INVENTORY_PLUGIN_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/inventory']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/noelsc/git/ansible/ansible.cfg) = True
DEFAULT_LOCAL_TMP(/home/noelsc/git/ansible/ansible.cfg) = /home/noelsc/.ansible/tmp/ansible-local-2014605j_ogmy0a
DEFAULT_LOG_PATH(/home/noelsc/git/ansible/ansible.cfg) = /var/log/ansible.log
DEFAULT_LOOKUP_PLUGIN_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible/lookup_plugins']
DEFAULT_MANAGED_STR(/home/noelsc/git/ansible/ansible.cfg) = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
DEFAULT_MODULE_PATH(/home/noelsc/git/ansible/ansible.cfg) = ['/home/noelsc/git/ansible']
DEFAULT_POLL_INTERVAL(/home/noelsc/git/ansible/ansible.cfg) = 15
DEFAULT_PRIVATE_ROLE_VARS(/home/noelsc/git/ansible/ansible.cfg) = True
DEFAULT_TIMEOUT(/home/noelsc/git/ansible/ansible.cfg) = 10
DEFAULT_TRANSPORT(/home/noelsc/git/ansible/ansible.cfg) = smart
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/noelsc/.ansible/vault
GALAXY_SERVER(/home/noelsc/git/ansible/ansible.cfg) = https://old-galaxy.ansible.com
INVENTORY_ENABLED(/home/noelsc/git/ansible/ansible.cfg) = ['script', 'host_list', 'yaml', 'constructed', 'portal_inventory', 'nmap', 'auto']
INVENTORY_IGNORE_EXTS(/home/noelsc/git/ansible/ansible.cfg) = ['.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '~', '.orig', '.ini', '.cfg', '.retry']
INVENTORY_UNPARSED_IS_FAILED(/home/noelsc/git/ansible/ansible.cfg) = True
PARAMIKO_HOST_KEY_AUTO_ADD(/home/noelsc/git/ansible/ansible.cfg) = True
SHOW_CUSTOM_STATS(/home/noelsc/git/ansible/ansible.cfg) = True
OS / ENVIRONMENT

Edition: Windows Server 2022 Standard Version: 21H2 Installed on 9/8/2022 OS Build: 20348.2402

STEPS TO REPRODUCE
---
- name: Describe the purpose of this playbook here
  hosts: redacted.example.com
  gather_facts: yes
  tasks:
    - name: Extract the time zone zip files
      community.windows.win_unzip:
        src: 'C:\Install\{{ zone_url | basename }}'
        dest: 'C:\Install\'
        recurse: yes
        delete_archive: no
        creates: 'C:\Install\{{ zone_url | basename }}\{{ zone_url | basename }}\timezone_{{ zone_url | basename | splitext | first }}.sql'
      loop:
        - https://mirror.mariadb.org/zoneinfo/zoneinfo.zip
      loop_control:
        loop_var: zone_url
EXPECTED RESULTS

The zip file is unziped

ACTUAL RESULTS

I get an error complaining that the extension isn't zip Screenshot 2024-04-19 112331

ansible-playbook t5.yml -vvvv
ansible-playbook [core 2.12.4]
  config file = /home/noelsc/git/ansible/ansible.cfg
  configured module search path = ['/home/noelsc/git/ansible']
  ansible python module location = /home/noelsc/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/noelsc/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/noelsc/.local/bin/ansible-playbook
  python version = 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0]
  jinja version = 3.1.1
  libyaml = True
Using /home/noelsc/git/ansible/ansible.cfg as config file
setting up inventory plugins
redirecting (type: inventory) ansible.builtin.nmap to community.general.nmap
Loading collection community.general from /home/noelsc/.ansible/collections/ansible_collections/community/general
script declined parsing /home/noelsc/git/ansible/inventory/hosts.yml as it did not pass its verify_file() method
host_list declined parsing /home/noelsc/git/ansible/inventory/hosts.yml as it did not pass its verify_file() method
Parsed /home/noelsc/git/ansible/inventory/hosts.yml inventory source with yaml plugin
Loading collection community.windows from /home/noelsc/.ansible/collections/ansible_collections/community/windows
Loading callback plugin default of type stdout, v2.0 from /home/noelsc/.local/lib/python3.8/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Loading callback plugin teams of type notification, v2.0 from /home/noelsc/git/ansible/callback_plugins/redis_logging.py
Loading callback plugin teams of type notification, v2.0 from /home/noelsc/git/ansible/callback_plugins/teams.py

PLAYBOOK: t5.yml ****************************************************************************************************************************************************************************************************************************************************************************************
Positional arguments: t5.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/noelsc/git/ansible/inventory/hosts.yml',)
forks: 5
1 plays in t5.yml

PLAY [Describe the purpose of this playbook here] *******************************************************************************************************************************************************************************************************************************************************
teams update attempts 0

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************************************************************************
task path: /home/noelsc/git/ansible/t5.yml:2
redirecting (type: modules) ansible.builtin.setup to ansible.windows.setup
Loading collection ansible.windows from /home/noelsc/.ansible/collections/ansible_collections/ansible/windows
Using module file /home/noelsc/.ansible/collections/ansible_collections/ansible/windows/plugins/modules/setup.ps1
Pipelining is enabled.
<redacted.example.com> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO redacted.example.com
EXEC (via pipeline wrapper)
ok: [redacted.example.com]
META: ran handlers

TASK [Extract the time zone zip files] ******************************************************************************************************************************************************************************************************************************************************************
task path: /home/noelsc/git/ansible/t5.yml:6
Using module file /home/noelsc/.ansible/collections/ansible_collections/community/windows/plugins/modules/win_unzip.ps1
Pipelining is enabled.
<redacted.example.com> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO redacted.example.com
EXEC (via pipeline wrapper)
failed: [redacted.example.com] (item=https://mirror.mariadb.org/zoneinfo/zoneinfo.zip) => {
    "ansible_loop_var": "zone_url",
    "changed": false,
    "dest": "C:\\Install\\",
    "msg": "PowerShellCommunityExtensions PowerShell Module (PSCX) is required for non-'.zip' compressed archive types.",
    "removed": false,
    "src": "C:\\Install\\zoneinfo.zip",
    "zone_url": "https://mirror.mariadb.org/zoneinfo/zoneinfo.zip"
}

PLAY RECAP **********************************************************************************************************************************************************************************************************************************************************************************************
redacted.example.com : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

teams update attempts 0