O'Reilly logo

Ansible Quick Start Guide by Mohamed Alibi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Ansible roles

Let's now create an Ansible role from scratch. This role is a Samba file server setup on either of the big families of Linux. It serves a folder that is accessible via a shared user.

First, let's create our role folder using the ansible-galaxy command line. Before running the command, we need to change the Terminal workspace to the location in which we would like to store our Ansible roles:

cd ~/Roles/ansible-galaxy init samba.lab.edu

We should see the following output:

- samba.lab.edu was created successfully

We then create a folder with the name of the role, with the following structure of subfolders and files:

samba.lab.edu└── README.md├── defaults│ └── main.yml├── files│ ├── handlers│ └── main.yml├── meta│ └── main.yml ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required