Introduction
Today we’re going to talk about Ansible troubleshooting, specifically about the Module Failure on Windows-target.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.
Playbook
How to troubleshoot the Module Failure on Windows-target.
error code
``yaml
---
- name: win_get_url module Playbook
hosts: all
become: false
vars:
myurl: "https://releases.ansible.com/ansible/ansible-2.9.25.tar.gz"
mydest: 'C:\Users\vagrant\Desktop\ansible-2.9.25.tar.gz'
tasks:
- name: download file
ansible.builtin.get_url:
url: "{{ myurl }}"
dest: "{{ mydest }}"
`
error execution
``bash
ansible-pilot $ ansible-playbook -i virtualmachines/win/inventory troubleshooting/get_url_error.yml
PLAY [win_get_url module Playbook] **
TASK [Gathering Facts]
ok: [WindowsServer]
TASK [download file] **
[WARNING]: No python interpreters found for host WindowsServer (tried ['python3.10', 'python3.9',
'python3.8', 'python3.7', 'python3.6', 'python3.5', '/usr/bin/python3', '/usr/libexec/platform-
python', 'python2.7', 'python2.6', '/usr/bin/python', 'python'])
fatal: [WindowsServer]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Exception calling \"Create\" with \"1\" argument(s): \"At line:4 char:21\r\n+ def _ansiballz_main():\r\n+ ~\r\nAn expression was expected after '('.\r\nAt line:8 char:19\r\n+ os.getcwd()\r\n+ ~\r\nAn expression was expected after '('.\r\nAt line:20 char:27\r\n+ except (AttributeError, OSError):\r\n+ ~\r\nMissing argument in parameter list.\r\nAt line:22 char:29\r\n+ excludes = set(('', '.', scriptdir))\r\n+ ~\r\nMissing expression after ','.\r\nAt line:22 char:30\r\n+ excludes = set(('', '.', scriptdir))\r\n+ ~~~~~~~~~\r\nUnexpected token 'scriptdir' in expression or statement.\r\nAt line:22 char:29\r\n+ excludes = set(('', '.', scriptdir))\r\n+ ~\r\nMissing closing ')' in expression.\r\nAt line:22 char:39\r\n+ excludes = set(('', '.', scriptdir))\r\n+ ~\r\nUnexpected token ')' in expression or statement.\r\nAt line:22 char:40\r\n+ excludes = set(('', '.', scriptdir))\r\n+ ~\r\nUnexpected token ')' in expression or statement.\r\nAt line:29 char:7\r\n+ if sys.version_info < (3,):\r\n+ ~\r\nMissing '(' after 'if' in if statement.\r\nAt line:29 char:30\r\n+ if sys.version_info < (3,):\r\n+ ~\r\nMissing expression after ','.\r\nNot all parse errors were reported. Correct the reported errors and try