Difficulty: beginner
Estimated Time: 15 minutes

In this scenario, you'll learn how to create playbooks in Ansible. Playbooks are the basis for a really simple configuration management and multi-machine deployment system.

Ansible Playbooks

Step 1 of 5

Execute a simple Ansible playbook

Copy following YAML to playbook named playbook.yml which will execute a command on the localhost.

  name: Execute a command on localhost
  hosts: localhost
      name: Execute a command on localhost
      command: touch employees

This playbook will run touch command to create a new file in the current directory.

Run the playbook with ansible-playbook command:

ansible-playbook playbook.yml


You can verify that file named employees was created by listing the contents of the current directory ls.