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

时间:2020-01-25 20:00:37

标签: ansible

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

first.yaml

<tr th:each="user: ${users}">
    <td th:text="${user.department}" />
    <td th:text="${user.name}" />
</tr>

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

---

- hosts: all
 task

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

谢谢

2 个答案:

答案 0 :(得分:0)

嗨,尝试这个(来自docs.ansible.com),

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

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

答案 1 :(得分:0)

第一个问题是缩进。请看下面。
其次,关键字是任务而不是任务,并且任务后需要冒号(:)。

---

- hosts: all
  tasks:
  - name: download httpd
    yum:
     name: httpd
     state: latest