我在Ubuntu上具有python 3.6.7的Ansible 2.7.10,在Windows 2019 Core上具有Erlang 21.3的RabbitMQ 3.8.7。
我想运行简单的任务,例如:
可兔-m Rabbitmq_vhost -a“名称= /测试状态=存在”
172.25.222.105 | FAILED! => {
"changed": false,
"module_stderr": "Exception calling \"Create\" with \"1\" argument(s): \"At line:4 char:21\r
+ def _ansiballz_main():\r
+ ~\r
An expression was expected after '('.\r
At line:12 char:27\r
+ except (AttributeError, OSError):\r
+ ~\r
Missing argument in parameter list.\r
At line:14 char:7\r
+ if scriptdir is not None:\r
+ ~\r
Missing '(' after 'if' in if statement.\r
At line:21 char:7\r
+ if sys.version_info < (3,):\r
+ ~\r
Missing '(' after 'if' in if statement.\r
At line:21 char:30\r
+ if sys.version_info < (3,):\r
+ ~\r
Missing expression after ','.\r
At line:21 char:25\r
+ if sys.version_info < (3,):\r
+ ~\r
The '<' operator is reserved for future use.\r
At line:23 char:32\r
+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r
+ ~\r
Missing expression after ','.\r
At line:23 char:33\r
+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r
+ ~~~~~~~~~~~~~\r
Unexpected token 'imp.PY_SOURCE' in expression or statement.\r
At line:23 char:32\r
+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r
+ ~\r
Missing closing ')' in expression.\r
At line:23 char:46\r
+ MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r
+ ~\r
Unexpected token ')' in expression or statement.\r
Not all parse errors were reported. Correct the reported errors and try again.\"\r
At line:6 char:1\r
+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])\r
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException\r
+ FullyQualifiedErrorId : ParseException\r
\r
The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name,\r
a script block, or a CommandInfo object.\r
At line:7 char:2\r
+ &$exec_wrapper\r
+ ~~~~~~~~~~~~~\r
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException\r
+ FullyQualifiedErrorId : BadExpression\r
",
"module_stdout": "",
"msg": "MODULE FAILURE
See stdout/stderr for the exact error",
"rc": 1
}
我也用不同的模块进行了测试,例如:rabbitmq_user,错误是相同的。我还使用ansible 2.7.10和python 2.6进行了测试,并且收到了相同的错误,使用剧本的测试也相同。在剧本中,我还检查了Rabbitmq服务是否已启动并正在运行,并且除与Rabbitmq进行通信外,其他方法均正常。
库存文件:
[rabbit]
172.25.222.105
变量文件:
ansible_user: ansible
ansible_password: password
ansible_port: 5985
ansible_connection: winrm
ansible_winrm_transport: ntlm
可允许的用户是本地管理员
一些建议如何与ansible和Rabbitmq交谈?我没有解决这个问题的新主意:(
非常感谢大家的帮助。