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

checking connectivity
ansible all -m ping

let’s being 😁

If we want to install any package into a target for this, we have to configure yum. before yum we have to mount RedHat 8 dvd. DVD content package and for this, we used to modules

1) file : This module helped us to create file for mounting dvd.

, 2) mount: Mount module content source path, state, and type

var file

In our ansible-playbook we have used varible, for this we created sperate file.

target ip

Target ip where we performed our task

configuration file

In the above image, there is a configuration file that allows customized of the server. We are changing the port number and, document root file as per our requirement. and we used ansible facts that help us to change IP dynamically.

yum configuration

We mounted DVD, mounting DVD won’t help us to install package for this we need to configure yum and above image content “how to configure YUM!

package install
- name: installing httpd package
package:
name: "httpd"
state: present
- name: creating document root file
file:
state: directory
path: "{{ doc_root }}"
- name: updating conf file
template:
dest: "/etc/httpd/conf.d/confFile.conf"
src: "confFile.conf"
- name: copying content
copy:
dest: "{{doc_root}}/index.html"
src: /task_11/as.html

Now we are installing httpd package, order to install we have to follow 3 steps after installation

  1. We have created doc_root file using file module
  2. We updated configuration file into /etc/httpd/conf.d/confFile.conf for this we used template module.
  3. By using copy module, we were copied content from the controller node.
firewall rule and service

We are going to set firewall rule for security purpose because other traffic won’t harm our server. firewalld module allows setting rules. for this we giving the port number. We have changed the configuration file and if we want to change to apply for this we need to restart the service all time. for this we have used the service module, The in-service module we have option to restart the service.

PLAY-BOOK RUNNING

WE HAVE SUCCESSFULLY RUNNING PLAY-BOOK….

THANKS FOR READING 😉

--

--

--

I am engineer.

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

Recommended from Medium

Skaffold vs Tilt vs DevSpace

MacOS to Ubuntu Part 7: File System setup and I/O benchmark

Internship at Jotform | Week 1

ELI5: What the F*** is a Bloom Filter?

Improve software quality by recognizing uncertainty

Technical Writing: How to Write Software Documentation

Cultural impact of DevOps (DevOops)

Auto scale the Power BI Embedded capacity using Job Scheduler in Azure

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
Avadhut Shinde

Avadhut Shinde

I am engineer.

More from Medium

Top Ten Reasons Your FEA Stresses Could Be FAKE NEWS!

5 Things for Dads to do with Your Toddler

CS371p Spring 2022: Sungwook Kim (William)

5 things you can do to spice up your stupid little daily walk