Skip to content

Instantly share code, notes, and snippets.

@satrapu
Created August 2, 2017 18:12
Show Gist options
  • Select an option

  • Save satrapu/31b1a03f321990f8d9ae067372a8b456 to your computer and use it in GitHub Desktop.

Select an option

Save satrapu/31b1a03f321990f8d9ae067372a8b456 to your computer and use it in GitHub Desktop.
Ansible playbook which prints a simple debug message.
---
# This playbook prints a simple debug message
- name: Echo
hosts: 127.0.0.1
connection: local
tasks:
- name: Print debug message
debug:
msg: Hello, world!
@robozb
Copy link
Copy Markdown

robozb commented Oct 8, 2022

How can I run it? Thanks!

@satrapu
Copy link
Copy Markdown
Author

satrapu commented Oct 8, 2022

@robozb
Copy link
Copy Markdown

robozb commented Oct 10, 2022

Dear @satrapu, Thank you so much! Regards: Berla

@robozb
Copy link
Copy Markdown

robozb commented Oct 10, 2022

$ ansible-playbook hello-world.yml
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Echo] ***********************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************************
ok: [127.0.0.1]

TASK [Print debug message] ********************************************************************************************************************************************************************************************************************
ok: [127.0.0.1] => {
    "msg": "Hello, world!"
}

PLAY RECAP ************************************************************************************************************************************************************************************************************************************
127.0.0.1                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@mazz
Copy link
Copy Markdown

mazz commented Apr 12, 2024

If you're just copying and pasting this task, make sure that the - name: ... lines-up with rest of your tasks.

@jeffhuys
Copy link
Copy Markdown

Correct spacing:

---
# This playbook prints a simple debug message
- name: Echo
  hosts: 127.0.0.1
  connection: local
  tasks:
    - name: Print debug message
      debug:
        msg: Hello, world!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment