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

Create Google Classrooms using Google Apps Script

On duplicates and persistence


Microservices and it’s Architecture

UITextField Obscura

Flask is Heavy? Use Matplotlib and Seaborn in Streamlit

How adopting Agile for a transformational project is helping a large bank to increase efficiency by…

Future of Mobile App Development Technologies

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

Automate your SSH logins with this .bat script for your private network.

Using Handlers with Import and Include statements

Copy Multiple Files — Ansible lookup plugin fileglob

How to connect your pc to Gitlab with ssh