gpt4 book ai didi

ansible - 没有找到预期的<文档开始>

转载 作者:行者123 更新时间:2023-12-02 11:21:45 26 4
gpt4 key购买 nike

Ansible 正在阅读 /etc/ansible/hosts文件并给出我不明白的错误。

ARNING]:  * Failed to parse /etc/ansible/hosts with yaml plugin: Syntax
Error while loading YAML. did not find expected <document start> The error
appears to be in '/etc/ansible/hosts': line 2, column 1, but may be elsewhere
in the file depending on the exact syntax problem.
  1. 为什么 ansible 尝试使用 yaml 插件解析这个 INI 样式文件?

  2. 什么是<document start> ?我在任何文档中都找不到这个

该文件看起来像这样(不是实际的)

[first_group]
host-1 ansible_host=1.1.1.1
host-2 ansible_host=2.2.2.2

编辑:

更多信息:

ansible@ansible:~$ ansible-config dump | grep INVENTORY
DEFAULT_INVENTORY_PLUGIN_PATH(default) = [u'/home/ansible/.ansible/plugins/inventory', u'/usr/share/ansible/plugins/inventory']
INVENTORY_ANY_UNPARSED_IS_FAILED(default) = False
INVENTORY_CACHE_ENABLED(default) = False
INVENTORY_CACHE_PLUGIN(default) = None
INVENTORY_CACHE_PLUGIN_CONNECTION(default) = None
INVENTORY_CACHE_PLUGIN_PREFIX(default) = ansible_facts
INVENTORY_CACHE_TIMEOUT(default) = 3600
INVENTORY_ENABLED(default) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml']
INVENTORY_EXPORT(default) = False
INVENTORY_IGNORE_EXTS(default) = {{(BLACKLIST_EXTS + ( '.orig', '.ini', '.cfg', '.retry'))}}
INVENTORY_IGNORE_PATTERNS(default) = []
INVENTORY_UNPARSED_IS_FAILED(default) = False

最佳答案

当您的子标题与其父标题不一致时,可能会发生这种情况。例如:

[webservers]
1.2.3.4
1.2.3.5

[webserver:vars]
ansible_python_interpreter=/usr/bin/python3

仔细看,网络服务器!= 网络服务器。添加 s 就可以开始了。

我在 Google 上搜索了同样的错误,这让我来到了这里。

关于ansible - 没有找到预期的<文档开始>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58316721/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com