我在运行ansible-playbook时遇到问题(语法错误)

问题描述 投票:-1回答:1

我遵循了多个教程,但仍然总是遇到相同的错误。

first.yaml

---

- hosts: all
 task

 - name: download httpd
 yum:
 - name: httpd
   state: latest

当我跑步时> first-yasible-playbook.yaml我明白了:

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

The error appears to be in '/home/ansible/Document/first.yaml': line 5, column 8, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- hosts: all
       ^ here

谢谢

ansible
1个回答
0
投票

你好,尝试这个(docs.ansible.com),

- name: install the latest version of Apache
  yum:
    name: httpd
    state: latest

name: httpd之前,在提供的示例中没有-字符。

© www.soinside.com 2019 - 2024. All rights reserved.