0

I'm trying to install the PowerShell7-MSI-package via Ansible. During execution it seems that Ansible is stuck (at least for about 45 minutes ...). For the installation I'm using the win_package module. I also found this SO question which unfortunately has no answer.

The host I'm trying to install to is:

OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.19042 N/A Build 19042

Ansible version:

ansible 2.9.16
  config file = /etc/ansible/ansible.cfg
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

Playbook:

---
# tasks file for common

- name: Create temp directory
  win_file:
    path: "{{ ansibleRemoteTemp }}"
    state: directory
- name: Copy Powershell package
  win_copy:
    src: ../files/PowerShell-7.1.0-win-x64.msi
    dest: "{{ ansibleRemoteTemp }}/PowerShell-7.1.0-win-x64.msi"
- name: Install PowerShell 7
  win_package:
    product_id: '{8B34F593-C5DF-47D9-AD0E-23D579F6D83E}'
    path: "{{ ansibleRemoteTemp }}/PowerShell-7.1.0-win-x64.msi"
    state: present
    arguments: ' /package PowerShell-7.1.0-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1'

The arguments are based on this learn.microsoft.com link.

Here is my Ansible output:

...

TASK [common : Copy Powershell package] *************************************************************************************************************************************************************************
ok: [server_14] => {
    "changed": false,
    "checksum": "517a93072f1f3d2d82b4634a506a84a808f63de2",
    "dest": "C:/Users/ansibletestuser/AppData/Local/Temp/playbookPackages/PowerShell-7.1.0-win-x64.msi",
    "operation": "file_copy",
    "original_basename": "PowerShell-7.1.0-win-x64.msi",
    "size": 99663872,
    "src": "../files/PowerShell-7.1.0-win-x64.msi"
}

TASK [common : Install PowerShell 7] ****************************************************************************************************************************************************************************

HERE WE ARE STUCK
Zeitounator
  • 38,476
  • 7
  • 53
  • 66
Moerwald
  • 10,448
  • 9
  • 43
  • 83
  • 2
    Did you run ansible with `-vvv` to make sure it does not hang on that task during the connect phase prior to launching the command (unlikely) or if it shows at some point the exact command line it is using on the remote ? Did you check that the install process is runing on the target while you are stuck ? Did you check the logs on the target to look for any clue of what is happening ? Did you try to run the install directly with `win_shell` (as a debug procedure..) rather than the module to see if you get a different result ? – Zeitounator Jan 07 '21 at 11:58
  • in addition to Zeitounator's excellent suggestions, adding [`log_path:`](https://docs.ansible.com/ansible/2.10/collections/ansible/windows/win_package_module.html#parameter-log_path) may help you as well. I'm certainly no Windows expert, but it looks suspicious having `/package` in addition to the `path:`, made doubly suspect given that the docs you linked to do not use that pattern in their examples, either – mdaniel Jan 08 '21 at 17:06

0 Answers0