FreeKB - Ansible Getting Started with playbooks
Ansible - Getting Started with playbooks

This assumes you have installed Ansible and have gone through our Getting Started with Ansible and Getting Started with the ansible-playbook command articles.

The ansible-playbook command uses a .yml or .yaml file to perform a series of tasks, thus you'll need to create the .yml or .yaml file before issuing the ansible-playbook command.

touch playbook.yml


Following is an example of the minimum markup needed to perform a task.

- hosts: all
    - debug: msg="Hello World"


The following command could then be used to run this playbook.

ansible-playbook playbook.yml


If you have a single server defined in your /etc/ansible/hosts file, the following should be displayed. Check out this article if you want to know what Gathering Facts is all about.

PLAY [all]

TASK [Gathering Facts]
ok: []

TASK [debug]
ok: [] => {
    "msg": "Hello World"

PLAY RECAP : ok=1  changed=0  unreacable=0  failed=0


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter f9660 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |