Created
August 2, 2017 18:12
-
-
Save satrapu/31b1a03f321990f8d9ae067372a8b456 to your computer and use it in GitHub Desktop.
Ansible playbook which prints a simple debug message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # 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! | |
Author
Please use the commands documented here: https://crossprogramming.com/2018/02/14/running-ansible-on-windows.html#example.
Dear @satrapu, Thank you so much! Regards: Berla
$ 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
If you're just copying and pasting this task, make sure that the - name: ... lines-up with rest of your tasks.
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
How can I run it? Thanks!