如何让Ansible和Yum一起工作?

如何让Ansible和Yum一起工作?,ansible,centos,yaml,Ansible,Centos,Yaml,学习ansible。我收到这个错误: JSON: Expecting value: line 1 column 1 (char 0) Syntax Error while loading YAML. mapping values are not allowed in this context The error appears to be in '/home/march/ansible-tut/playbooks/chap3-play.yml': line 7, column 12, b

学习ansible。我收到这个错误:

JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to be in '/home/march/ansible-tut/playbooks/chap3-play.yml': line 7, column 12, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - name: Install Apache.
        yum:
           ^ here
我是否缺少一些lib文件或其他软件?我正在运行这个剧本

- name: Install Apache.
  hosts: all

  tasks:
    - name: Install Apache.
        yum:
          name:
            - httpd
            - httpd-devel
          state: present

    - name: Ensure Apache started
      service:
        name: httpd
        state: started
        enabled: true

这是我的第一本剧本,所以未来不是好兆头:这是由于语法问题

- name: Install Apache.
  yum:
    name:
      - httpd
      - httpd-devel
    state: present

- name: Ensure Apache started
  service:
    name: httpd
    state: started
    enabled: true

查看此文档以了解更多信息:

似乎不是有效的YAML语法,->此语法很简单:
yum:
块必须具有与其上方的
名称相同的缩进。就像在第二块中启动apache一样。