Creating a base role

In the previous chapter, we created a simple playbook with all plays written inside the same file. After discovering new and exciting information about roles, we will start refactoring our code and making it modular.

Refactoring our code – creating a base role

We have written two plays in the simple_playbook.yml file. We intended to run the first play on all hosts. This play has tasks to create users, install essential packages, and so on:

Refactoring our code – creating a base role

It's a good practice to combine all such essential tasks and create a base role. You can name it as base, common, essential, or whatever you please, but the concept remains the same. We will ...

Get Ansible Playbook Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.