Remis Haroon - رامز
Remis Haroon - رامز

Reputation: 3572

ERROR: debug is not a legal parameter at this level in an Ansible Playbook

I am just learning Ansible with playbooks using the examples provided by Ansible. https://github.com/ansible/ansible-examples/tree/master/lamp_simple

When I tried to put a debug message on start of the playbook, I am getting the error as given below.

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

Please help

Upvotes: 2

Views: 2687

Answers (1)

ceejayoz
ceejayoz

Reputation: 180024

Ansible doesn't know which host to execute debug against.

Your playbook's tasks should be in a tasks block:

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

See Intro to Playbooks for more details and examples.

Upvotes: 5

Related Questions