How to create your own ansible role…

An Ansible role is a set of tasks to configure a host to serve a certain purpose like configuring a service. Roles are defined using YAML files with a predefined directory structure. A role directory structure contains directories: defaults, vars, tasks, files, templates, meta, handlers.

Creation and setup of your own Ansible Role in a RHEL system.

Step 1: Install system roles.

Step 2: To create your own roles configure your ansible.cfg file located in /etc/ansible/ansible.cfg as shown below:

Step 3: Initiate your Role

Step 4: Get into the directory and look for the main.yml file for writing tasks for your role.

Step 5: Write your tasks in the file.

Apache Webserver Role

Step 6: Create the file for running your role.

any playbook

Step 7: Run the file

Step 8: Result:

THANKS …

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

New Battlesnake Partner: Repl.it

Dynamic SQL Pivots with dbt

Most Common SQL Questions & Answers You Must Know For Your Next Interview

The lost droid and the magic Dagger: an intro to dependency injection for Android.

Choose the Best Accounting Software to Enhance Accuracy and Productivity

Python3: Mutable, Immutable… everything is object!

What I learned from deleting a production database

Your Code has a Redemption Arc too, not just the Series you Watch

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
HarvinderSingh

HarvinderSingh

More from Medium

Home Automation Treadmill Bike

Containerisation and Docker in HPC

How to install simultaneously Docker and Podman on RHEL 8/CentOS 8

Physical location of files persisted in docker volumes on windows docker-desktop running on…