ARTH TASK-15

ARTH TASK-15

Task Description??

  • Create an ansible role myapache to configure Httpd WebServer.
  • Create another ansible role myloadbalancer to configure HAProxy LB.
  • We need to combine both of these roles controlling webserver versions and solving challenge for host ip’s addition dynamically over each Managed Node in HAProxy.cfg file.

Role for Configuring HTTPD

Role: In Ansible, the role is the primary mechanism for breaking a playbook into multiple files. This simplifies writing complex playbooks, and it makes them easier to reuse.

in this article my managed node is 127.0.0.1 :

Creating the role in Controller node and setup Path in Inventory File :

Here i create the my_http_role under the roles folder :

Setup roles Path :

No alt text provided for this image

Creating an ansible role my_http_role:

# ansible-galaxy role init my_http_role

For see how many role in your pc :

# ansible-galaxy role list
No alt text provided for this image

For configuring server using my_http_role:

No alt text provided for this image

Put Task in Main.yml file :

No alt text provided for this image

Now run main yml file http_role.yml :

No alt text provided for this image
No alt text provided for this image

Let’s check our webpage from the browser :

No alt text provided for this image

Successfully Run. . . .

Ansible role myloadbalancer to configure HAProxy LB.

Roles:

Roles let you automatically load related vars_files, tasks, handlers, and other Ansible artifacts based on a known file structure. Once you group your content in roles, you can easily reuse them and share them with other users

In this article we create two Role for Haproxy and Webserver configure .

Controller Node

192.168.0.113 in this controller node we will config our Loadbalancer.

Managed Node

192.168.0.118 this managed node is our backed webserver .

Creating an ansible role haproxy_role and webserver_role:

# ansible-galaxy role init haproxy_role
# ansible-galaxy role init webserver_role

For see how many role in your machine :

No alt text provided for this image

Configure Role path in Inventory :

No alt text provided for this image

For configuring Load Balancer using haproxy_role role:

No alt text provided for this image

update the man.yml file in haproxy_role .

No alt text provided for this image

In haproxy.cfg use jinja code like below .

No alt text provided for this image

For configuring webserver using webserver_role role:

No alt text provided for this image

update the main.yml file in webserver_role .

No alt text provided for this image

Create the main haproxy_role.yml File :

No alt text provided for this image
# ansible-playbook haproxy_role.yml

Now run this haproxy_role.yml file :

No alt text provided for this image

Now see the Backedwebserver Status (192.168.0.118) :

No alt text provided for this image

Now go to the Chrome and see webpage :

Here LB ip was (192.168.0.113) :

No alt text provided for this image

Thanks!!




GAURAV DESHMUKH

Former SDE Intern @Raja Software Labs, Pune

3 年

Fabulous work ??

回复

要查看或添加评论,请登录

Akanksha Bhatt的更多文章

  • Task-8 Automation with Python

    Task-8 Automation with Python

    ARTH - Task 8 ??????? Task Description?? ?? Create a Menu Using Python integrating all the concepts that have been…

  • Task-14.3

    Task-14.3

    ???????? ?????????????????????? : Create an Ansible Playbook which will dynamically load the variable file named same…

  • Task-14.2

    Task-14.2

    Ansible playbook that will retrieve new Container IP and dynamically update the inventory and Configure web-server…

  • Task-14.1

    Task-14.1

    Task description :- 14.1 Create a network Topology Setup in such a way so that System A can ping to two Systems System…

  • LOAD BALANCING WITH HAPROXY

    LOAD BALANCING WITH HAPROXY

    Task Description 12.1 Use Ansible playbook to Configure Reverse Proxy i.

    1 条评论
  • Neural Networks in Netflix

    Neural Networks in Netflix

    What are Neural Networks? Neural networks are a set of algorithms, they are designed to mimic the human brain, that is…

  • Restarting HTTPD Service is not idempotent in nature and also consume more resources suggest a way to rectify this challenge in Ansible Playbook.

    Restarting HTTPD Service is not idempotent in nature and also consume more resources suggest a way to rectify this challenge in Ansible Playbook.

    What is Idempotent nature in Ansible? An operation is idempotent if the result of performing it once is exactly the…

  • CONFIGURING HADOOP CLUSTER USING ANSIBLE

    CONFIGURING HADOOP CLUSTER USING ANSIBLE

    Welcome you all, in this blog I will cover how we can“ CONFIGURE HADOOP CLUSTER USING ANSIBLE” Before starting the…

    1 条评论
  • How Industries are Solving Challenges Using Ansible??

    How Industries are Solving Challenges Using Ansible??

    What Is Ansible ? ?? Ansible is a software tool that provides simple but powerful automation for cross-platform…

  • Configuration of Apache Web Server in Docker Container using Ansible

    Configuration of Apache Web Server in Docker Container using Ansible

    In this article we will perform various tasks: Configure Docker Start and enable Docker Services Pull the httpd server…

    1 条评论

社区洞察

其他会员也浏览了