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:


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

Recommended from Medium

How Can Measure The Usability of Your Blue Star Generators Web Outcome Measurement System?

Book Description Search using TF-IDF

OpenAI Codex: Why the revolution is still missing

How My Microsoft Interview Landed Me Higher Position Than I Applied For

Centralized Logging — EFFK — Elastic Search + Fluent Bit + Fluentd + Kibana

Create OCI Function running a Playwright scenario

Project of the week — Budget App

Use Kubernetes’ ExtendedResourceToleration to keep out non-GPU pods

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


More from Medium


DNS analysis in a nutshell

Creating HTML email templates for vRealize Automation Code Stream

Simple phishing analysis