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

时间:2015-07-07 17:20:23

标签: ansible ansible-playbook

我正在使用Ansible提供的示例学习Ansible和playbooks。 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

[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

请帮忙

1 个答案:

答案 0 :(得分:4)

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

你的剧本任务应该在tasks块中:

---
- hosts: localhost
  tasks:
  - debug: msg="Start KickAsssss"

有关详细信息和示例,请参阅Intro to Playbooks