Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 Ansible错误-实现错误:名称请求的类型字符串未知_Python 2.7_Ansible - Fatal编程技术网

Python 2.7 Ansible错误-实现错误:名称请求的类型字符串未知

Python 2.7 Ansible错误-实现错误:名称请求的类型字符串未知,python-2.7,ansible,Python 2.7,Ansible,执行ansible playbook时,出现未知类型字符串错误 实现错误:名称请求的类型字符串未知 我试图用ansible剧本来展示我的名字。bg代码是python --- - name: Test hello module hosts: localhost tasks: - name: run the hello module hello: name: 'Test' register: helloout

执行ansible playbook时,出现未知类型字符串错误

实现错误:名称请求的类型字符串未知

我试图用ansible剧本来展示我的名字。bg代码是python

---
-  name:  Test hello module
   hosts:  localhost

   tasks:
     -  name:  run the hello module
        hello:
          name: 'Test'
        register:  helloout

     -  name:  dump test output
        debug:
          msg:  '{{ helloout  }}'
[警告]:提供的主机列表为空,只有本地主机可用。请注意,隐式localhost与“all”不匹配

播放[测试hello模块]****************************************************************************************************************************

任务[收集事实]****************************************************************************************************************************** 确定:[本地主机]

任务[运行hello模块]************************************************************************************************************************* 致命:[localhost]:失败!=>{“changed”:false,“msg”:“实现错误:为名称“}请求的类型字符串未知”

重演****************************************************************************************************************************************** localhost:ok=1已更改=0不可访问=0失败=1已跳过=0已获救=0已忽略=0

AnsibleModule()
方法参数
argument\u spec
中,您要查找的类型实际上是
str
,而不是
string

module = AnsibleModule(
    argument_spec=dict(
        name=dict(required=True, type='str')
    ),
    supports_check_mode=False
)
您可以在中看到参数的可接受类型规范列表

module = AnsibleModule(
    argument_spec=dict(
        name=dict(required=True, type='str')
    ),
    supports_check_mode=False
)