How To Make Ansible Role And Integrate them

roles_path= your path
ansible-galaxy role init “name of role you want to give”
 — -
# tasks file for mylb
- name: “Installing haproxy”
name: “haproxy”
— name: “editing and pasting haproxy file”
src: haproxy.cfg
dest: /etc/haproxy/haproxy.cfg
— name: “starting ha proxy serice”
name: “haproxy”
state: restarted
enabled: yes
— name: “disabling selinux”
policy: targeted
state: permissive
 — -
# tasks file for myweb
- name: “installing http and php”
— httpd
— php
state: present
— name: “putting index.php file in backend server”
src: index.php
dest: /var/www/html/index.php
— name: “starting haproxy server”
name: httpd
state: started
- hosts: localhost
- name:calling mylb role to configure haproxy
name: mylb
- hosts: b
- name:calling myweb role to configure webserver
name: myweb
role running successfully




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

Recommended from Medium

Running a Kubernetes Cluster on Ubuntu with Calico

How I cleared the AWS Solutions Architect Associate — C02 exam

My Journey to Become a Software Engineer… Week 3 — Check!

Laravel Basic | What is Database Seeder in Laravel?

cplace DIGITAL CONFERENCE — collaborate. co-create. innovate.

Let It Go — The Ledge, I mean

Chrome Remote Desktop On Ubuntu 20.04 Setup Guide/Setup Script

Time scheduling to trigger Jenkins job

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
Gupta Aditya

Gupta Aditya

More from Medium

Simple Workflow in Github Action : PM2 Configuration

The Power of Docker’s COPY — from

Learn How To Get the File name and File ID From Google Drive In Apps Script

Google Apps Script — Getting File Name And Id From Google Drive Files

How to create Azure resource using Terraform and GitHub Actions