"Automating Apache HTTPD Installation on Windows with Ansible: A Step-by-Step Guide"

"Automating Apache HTTPD Installation on Windows with Ansible: A Step-by-Step Guide"

·

1 min read

Before you begin:
Ensure you have set up password-less SSH authentication between your Ansible control node and the target server. If you haven't done this yet, follow the step-by-step guide here to get it configured.

Create a File with .yml or yaml extension into the ansible instance

---
- name: Install and Start HTTPD Service
  hosts: all
  become: true

  tasks:
    - name: Install HTTPD Package
      apt:
         name: apache2
         state: present

    - name: Start HTTPD Service
      service:
             name: apache2
             state: started

Run the file

ansible-playbook -i inventory fileName.yml

Playbook Output

Check for HTTPD Installation

sudo systemctl status apache2

HTTPD Output

You are done installing HTTPD Package on Windows”

Command To Stop the HTTPD

sudo systemcd stop apache2

Check if the HTTPD is Stopped

sudo systemcd status apache2

Status Of HTTPD Service Stop

HAPPY AUTOMATING !