Using Ansible 2.6.2, I've set `cleanmgr.exe /sagerun:3` to everything possible manually on the Windows 10 machine.
In my playbook I have the following task:
- name: windows | disk cleanup
win_shell: "cmd.exe /c cleanmgr.exe /sagerun:3"
args:
chdir: "C:\\Windows\\system32"
However it hangs on this task it seems, and I can't seem to figure out why, or what I could be debugging.
Running the command manually on the machine locally works fine. Also, the command works fine for Windows 7 machine, so I'm not sure this could be a configuration issue on the Windows 10 machine?
Ansible debug (showing the ping task just before it hangs):
TASK [cleanup : windows | verify connection] ***********************************
task path: /Users/ansible/builds/0/clean_base_vms/ansible/roles/cleanup/tasks/windows.yml:3
ok: [win10_base] => {
"changed": false,
"ping": "pong"
}
Using module file /Users/ansible/clean_base_vms/virtualenv/lib/python2.7/site-packages/ansible/modules/windows/win_shell.ps1
<ip-address> ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5985 TO <ip-address>
checking if winrm_host <ip-address> is an IPv6 address
<ip-address> WINRM CONNECT: transport=plaintext endpoint=http://<ip-address>:5985/wsman
<ip-address> WINRM OPEN SHELL: <shell-thing>
EXEC (via pipeline wrapper)
<ip-address> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-']
I've left this task running for 5 hours before it fails...
Any ideas would be greatly appreciated, thank you in advance :)