Skip to content

thespecguy/ansible_httpd_restart_service_idempotence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to make HTTPD restart service idempotent in nature

Ansible_HTTPD

Content

  • About Ansible
  • About Apache HTTPD Webserver
  • Project Understanding


About Ansible

What is Ansible ?

Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.

Why use Ansible ?

  1. Simple
    • Human readable automation
    • No special coding skills needed
    • Tasks executed in order
    • Get productive quickly

  2. Powerful
    • App deployment
    • Configuration management
    • Workflow orchestration
    • Orchestrate the app lifecycle

  3. Agentless
    • Agentless architecture
    • Uses OpenSSH and WinRM
    • No agents to exploit or update
    • Predictable, reliable and secure

For Ansible Documentation, visit the link mentioned below:
https://docs.ansible.com/

About Apache HTTPD Webserver

  • The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0.
  • Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
  • The vast majority of Apache HTTP Server instances run on a Linux distribution, but current versions also run on Microsoft Windows, OpenVMS and a wide variety of Unix-like systems.

For Apache HTTPD Documentation, visit the link mentioned below:
https://httpd.apache.org/docs/

Project Understanding

The main purpose of this README, as you can understand from the title itself , is to make restart service of HTTPD Webserver idempotent in nature

Let's understand the version of software required

Versions

  • HTTPD: 2.4.37
  • Ansible: 2.9.11

Some Important Points To Be Noted:point_left:

  1. In the Ansible Playbook i.e., main.yml, the concept of notify-handlers is used for making HTTPD restart service idempotent i.e., as soon as any changes is detected in the HTTPD configuration file , the task specified in the handler executes and thereby HTTPD restarts.
  2. Some additional functionalities includes allowance of HTTPD port number specified through the Firewall, using the firewalld module in Ansible. Also, Document Root and Port Number could be modified as per requirement.
  3. In the Variable File i.e., vars.yml, tha value of Mount Directory, Document Root and HTTPD Port Number is specified to make the playbook more dynamic.
  4. Template file or Jinja2 template i.e., localconf.conf.j2 is created for HTTPD's configuration file.
  5. Test Page is created and could be modified as per requirement.
  6. It should be noted that if the output of "getenforce" command is Enforcing, it would prevent the service restart due to any change, thereby it is advisable to use "setenforce 0" to change the output to Permissive.

Execution & Output

  • Case I : No changes in the HTTPD's configuration file

  • Execution_Case1

    Output_Case1

  • Case II : Change in HTTPD's configuration file i.e., Port Number is changed from 8080 to 8081

  • Execution_Case2

    Output_Case2


Thank You 😃

LinkedIn Profile

https://www.linkedin.com/in/satyam-singh-95a266182

About

Making HTTPD Restart Service Idempotent in Ansible

Topics

Resources

Stars

Watchers

Forks

Languages