Step-by-step process to install HTTPD using ansible-playbook

Step 1: Launch an instances

  • Now connect master node to git bash terminal by using SSH command.

Step 2: Install Ansible

  • Now Install Ansible on your control node (local machine). By using following command
 sudo amazon-linux-extras install ansible2

Step 3: Create a playbook

sudo vi <filename.yml>
  • Here is the playbook script to install HTTPD in slave node
- name: Install HTTPD using Ansible Playbook
hosts: slave-1 #here ensure that node instance name is correct or not
become: true
tasks:
- name: Install HTTPD package
package:
name: httpd
state: present
- name: Start HTTPD service
service:
name: httpd
state: started
enabled: yes

Step 4: Setting up Host Permission

  • Now move to ansible directory path. In that ansible directory there is a file for HOST. Following command navigate to ansible path
cd /etc/ansible/

  • Now open that Host file by using following command
sudo vi host 
  • Inside this host file we giving host details that means our slave node details like Private IP Address, user name and Keyfile details

  • Now execute ansible ping command to verify that our slave node connected or not
ansible ping -m all

Our slave node was successfully connected

Step 5: Running the Playbook

  • Now run ansible-playbook command to run your playbook, specifying the playbook file and target hosts. By using following command
ansible-playbook <filename.yml>

  • Ansible will connect to the target hosts, execute the tasks defined in the playbook, and install HTTPD.

Step 6: Verification

  • Our ansible playbook was successfully executed but need to verify that our HTTPD was installed are not.
  • Now go Slave Node and copy Public IP Address and browse it.

Official Page of HTTPD

How To Install HTTPD Using Ansible Playbook ?

Ansible is an open-source automation tool that improves IT orchestration, the design of the board, and application deployment. It works over SSH and requires no agent to be installed on a managed host. It is lightweight, efficient, and easy to set up, making it suitable for automating tasks on a variety of systems and environments.

HTTPD, otherwise called the Apache HTTP Server, is an open-source web server software broadly utilized for serving web content over the HTTP protocol. It is known for its dependability, scalability, and extensibility, making it a famous choice for hosting websites and applications.

Utilizing Ansible’s capabilities to automate the installation of HTTPD on target hosts is the topic of this guide. We can define the desired state of our infrastructure and carry out tasks in a repeatable and consistent manner by utilizing Ansible playbooks. This saves time and exertion, decreases the risk of manual errors, and ensures the consistency of configurations across servers.

Similar Reads

Primary Terminologies

Ansible: The automation tool Ansible is open-source and used for configuration management, application deployment, and task automation. It works over SSH and requires any agents to be installed on the overseer. Because Ansible defines tasks using a declarative language based on YAML syntax, automation scripts are simple to read, write, and comprehend. Apache HTTPD: Open-source software for serving web content over the HTTP protocol is commonly referred to as HTTPD or Apache HTTP Server. It is known for its dependability, versatility, and extensibility, making it a famous decision for facilitating sites and applications. HTTPD is highly configurable and supports different modules and extensions for additional usefulness. Playbook for Ansible: An Ansible playbook is a YAML file that characterizes a set of undertakings to be executed on remote hosts. Playbooks take into consideration the automation of complex undertakings like software installation, configuration management, and application deployment. Tasks inside a playbook are executed successively, and Ansible ensures idempotence, implying that running the playbook multiple times has a similar result as running it once. Configuration Management: Configuration management refers to the most common way of managing the configurations of programming and frameworks steadily and dependably. With instruments like Ansible, configuration management tasks, for example, introducing programming packages, adjusting configuration files, and managing services, can be automated, lessening manual exertion and ensuring consistency across servers. Package Manager: Package Manager is a tool used to install, update, and remove packages from a system with the help of a package manager. Models incorporate yum and adept for Linux distributions like CentOS/RHEL and Ubuntu/Debian, respectively. Ansible uses package managers to automate the installation of software packages on managed servers as part of the configuration of the management tasks....

What is HTTPD?

HTTPD, short for HyperText Transfer Protocol Daemon, is a term normally used to refer to the Apache HTTP Server. It is an open-source web server software developed and maintained with by the Apache Software Foundation. HTTPD is one of the most widely used web server applications worldwide and assumes a significant part in serving web content over the internet....

Step-by-step process to install HTTPD using ansible-playbook

Step 1: Launch an instances...

Conclusion

Deploying and managing web servers like HTTPD (Apache) using Ansible Playbooks offers different benefits with respect to productivity, consistency, and dependability. By using Ansibles’ mechanization abilities, affiliations can smooth out the technique engaged with installing, configuring, and keeping aware of web servers across their infrastructure....

Install HTTPD using ansible playbook – FAQ’s

Could Ansible be used to manage web servers other than HTTPD (Apache)?...