You need to use win_ping and not ping. It's trying to run Python code in a
PowerShell engine which fails.
On Thursday, October 29, 2020 at 11:50:28 AM UTC+10 dwiz wrote:
> This is verbose output:
>
> ansible 2.9.11
> config file = /etc/ansible/ansible.cfg
> configured module search path =
> ['/home/ansible/.ansible/plugins/modules',
> '/usr/share/ansible/plugins/modules']
> ansible python module location =
> /home/ansible/.local/lib/python3.6/site-packages/ansible
> executable location = /home/ansible/.local/bin/ansible
> python version = 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0]
> Using /etc/ansible/ansible.cfg as config file
> setting up inventory plugins
> host_list declined parsing /etc/ansible/hosts as it did not pass its
> verify_file() method
> script declined parsing /etc/ansible/hosts as it did not pass its
> verify_file() method
> auto declined parsing /etc/ansible/hosts as it did not pass its
> verify_file() method
> Parsed /etc/ansible/hosts inventory source with ini plugin
> Loading callback plugin minimal of type stdout, v2.0 from
> /home/ansible/.local/lib/python3.6/site-packages/ansible/plugins/callback/minimal.py
> META: ran handlers
> <x.x.x.x> Attempting python interpreter discovery
> < x.x.x.x > ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5985 TO
> x.x.x.x
> EXEC (via pipeline wrapper)
> Using module file
> /home/ansible/.local/lib/python3.6/site-packages/ansible/modules/system/ping.py
> Pipelining is enabled.
> EXEC (via pipeline wrapper)
> [WARNING]: No python interpreters found for host x.x.x.x (tried
> ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7',
> 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])
> x.x.x.x | 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:13 char:27\r\n+
> except (AttributeError, OSError):\r\n+
> ~\r\nMissing argument in parameter list.\r\nAt line:15 char:7\r\n+ if
> scriptdir is not None:\r\n+ ~\r\nMissing '(' after 'if' in if
> statement.\r\nAt line:22 char:7\r\n+ if sys.version_info < (3,):\r\n+
> ~\r\nMissing '(' after 'if' in if statement.\r\nAt line:22
> char:30\r\n+ if sys.version_info < (3,):\r\n+
> ~\r\nMissing expression after ','.\r\nAt line:22 char:25\r\n+ if
> sys.version_info < (3,):\r\n+ ~\r\nThe '<' operator
> is reserved for future use.\r\nAt line:27 char:34\r\n+ def
> invoke_module(modlib_path, temp_path, json_params):\r\n+
> ~\r\nMissing argument in parameter list.\r\nAt line:28
> char:40\r\n+ z = zipfile.ZipFile(modlib_path, mode='a')\r\n+
> ~\r\nMissing argument in parameter
> list.\r\nAt line:31 char:33\r\n+ zinfo = zipfile.ZipInfo()\r\n+
> ~\r\nAn expression was expected after
> '('.\r\nAt line:34 char:25\r\n+ z.writestr(zinfo,
> sitecustomize)\r\n+ ~\r\nMissing argument in
> parameter list.\r\nNot all parse errors were reported. Correct the
> reported errors and try again.\"\r\nAt line:6 char:1\r\n+ $exec_wrapper =
> [ScriptBlock]::Create($split_parts[0])\r\n+
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n +
> CategoryInfo : NotSpecified: (:) [],
> MethodInvocationException\r\n + FullyQualifiedErrorId :
> ParseException\r\n \r\nThe expression after '&' in a pipeline element
> produced an object that was not valid. It must result in a command
> \r\nname, a script block, or a CommandInfo object.\r\nAt line:7 char:2\r\n+
> &$exec_wrapper\r\n+ ~~~~~~~~~~~~~\r\n + CategoryInfo :
> InvalidOperation: (:) [], RuntimeException\r\n + FullyQualifiedErrorId :
> BadExpression\r\n ",
> "module_stdout": "",
> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
> "rc": 1
> }
>
>
> On Wednesday, October 28, 2020 at 9:42:39 PM UTC-4 dwiz wrote:
>
>> Hello,
>>
>> I am testing connection to my windows host. My host file is set up as
>> below.
>>
>> [windows]
>> X.X.X.X
>>
>> [windows:vars]
>> ansible_user=
>> ansible_password=
>> ansible_connection=winrm
>> ansible_port=5985
>>
>> I was able to connect to the host fine before but now when testing with,
>> 'ansible windows -m ping', I get the following error. I'm not sure what
>> could've change between my tests. any guidance please. Regards.
>>
>> [WARNING]: No python interpreters found for host x.x.x.x (tried
>> ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7',
>> 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])
>> x.x.x.x | 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:13
>> char:27\r\n+ except (AttributeError, OSError):\r\n+
>> ~\r\nMissing argument in parameter list.\r\nAt line:15 char:7\r\n+
>> if scriptdir is not None:\r\n+ ~\r\nMissing '(' after 'if' in if
>> statement.\r\nAt line:22 char:7\r\n+ if sys.version_info < (3,):\r\n+
>> ~\r\nMissing '(' after 'if' in if statement.\r\nAt line:22
>> char:30\r\n+ if sys.version_info < (3,):\r\n+
>> ~\r\nMissing expression after ','.\r\nAt line:22 char:25\r\n+ if
>> sys.version_info < (3,):\r\n+ ~\r\nThe '<' operator
>> is reserved for future use.\r\nAt line:27 char:34\r\n+ def
>> invoke_module(modlib_path, temp_path, json_params):\r\n+
>> ~\r\nMissing argument in parameter list.\r\nAt line:28
>> char:40\r\n+ z = zipfile.ZipFile(modlib_path, mode='a')\r\n+
>> ~\r\nMissing argument in parameter
>> list.\r\nAt line:31 char:33\r\n+ zinfo = zipfile.ZipInfo()\r\n+
>> ~\r\nAn expression was expected after
>> '('.\r\nAt line:34 char:25\r\n+ z.writestr(zinfo,
>> sitecustomize)\r\n+ ~\r\nMissing argument in
>> parameter list.\r\nNot all parse errors were reported. Correct the
>> reported errors and try again.\"\r\nAt line:6 char:1\r\n+ $exec_wrapper =
>> [ScriptBlock]::Create($split_parts[0])\r\n+
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n +
>> CategoryInfo : NotSpecified: (:) [],
>> MethodInvocationException\r\n + FullyQualifiedErrorId :
>> ParseException\r\n \r\nThe expression after '&' in a pipeline element
>> produced an object that was not valid. It must result in a command
>> \r\nname, a script block, or a CommandInfo object.\r\nAt line:7 char:2\r\n+
>> &$exec_wrapper\r\n+ ~~~~~~~~~~~~~\r\n + CategoryInfo :
>> InvalidOperation: (:) [], RuntimeException\r\n + FullyQualifiedErrorId :
>> BadExpression\r\n ",
>> "module_stdout": "",
>> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
>> "rc": 1
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/46bd6427-4c3c-41b6-8ca0-d8026b6147d2n%40googlegroups.com.