错误:在Ansible Playbook中,调试不是此级别的合法参数

Rem*_*oon 2 ansible ansible-playbook

我只是使用Ansible提供的示例通过剧本学习Ansible。 https://github.com/ansible/ansible-examples/tree/master/lamp_simple

当我尝试在剧本的开头放置调试消息时,出现以下错误。

vagrant@packer-debian-7:~/ansible-examples-master/lamp_simple$ ansible-playbook -i hosts site.yml --private-key=~/.ssh/google_compute_engine -vvvv
ERROR: debug is not a legal parameter at this level in an Ansible Playbook
Run Code Online (Sandbox Code Playgroud)

[site.yml]

---
# This playbook deploys the whole application stack in this site.  

- debug: msg="Start KickAsssss"

- name: apply common configuration to all nodes
  hosts: all

  roles:
    - common

- name: configure and deploy the webservers and application code
  hosts: webservers

  roles:
    - web

- name: deploy MySQL and configure the databases
  hosts: dbservers

  roles:
    - db
Run Code Online (Sandbox Code Playgroud)

请帮忙

cee*_*yoz 5

Ansible不知道要执行哪个主机 debug针对。

您的剧本的任务应该很严格tasks

---
- hosts: localhost
  tasks:
  - debug: msg="Start KickAsssss"
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息和示例,请参见Playbook简介