Yaml 未找到错误的实际含义。错误:";(<;unknown>;):在第3行第16列的上下文中不允许映射值;

Yaml 未找到错误的实际含义。错误:";(<;unknown>;):在第3行第16列的上下文中不允许映射值;,yaml,Yaml,错误出现在前两行: - hosts: local_host remote_user: ansible become: yes become_method: sudo connection: ssh gather_fact: yes tasks: name: installing MariaDB yum: name: mariadb-server state: latest noti

错误出现在前两行:

- hosts: local_host
    remote_user: ansible
    become: yes
    become_method: sudo
    connection: ssh
    gather_fact: yes
    tasks:
      name: installing MariaDB
      yum:
        name: mariadb-server
        state: latest
      notify: startservice
    handlers:
      name: startservice
      service:
        name: mariadb
        state: restarted
host
不能同时具有标量值(
local\u host
)和映射值(从
remote\u用户:
开始)。您可能希望
远程\u用户
处于
主机
级别,使其成为同级密钥:

- hosts: local_host
    remote_user: ansible

抱歉,但我不知道我在看什么-这需要编辑和更好的解释。嗨,Zydnar,我是StackOverflow的新手:我的查询是关于在ansible playbook上使用此代码验证时出现的错误,如标题OK中所述,只是我们在这一点上帮不了你-yaml本身只是数据-没有程序-所以如果没有解析它的代码,你的问题就无法回答。你的yaml代码本身是正确的-我已经在验证器中检查过了。好的,其他验证器会在您使用下划线的行中抛出相同的错误-尝试更改我说过的ITA-然后再告诉您如何解析此yaml(语言/包/服务器等)我们帮不了你。我想知道为什么很多yaml验证器认为这个yaml文件没有问题,比如:或者,但是这个文件抛出了一个错误:是否有不同的规范…?@Zydnar不,不同的实现。我不能对第一个问题发表评论,因为我肯定不会仅仅为了访问一个网站而破解验证码,就像第二个问题一样:当有东西说“世界最佳X”时“,这通常不是因为它不需要宣传它。Yamlint是可疑的,因为它没有告诉您它使用哪个YAML实现,但每个都正确地报告了错误。PyYAML可能与OP相关,因为它是Ansible使用的。
- host: local_host
  remote_user: ansible
  # and so on