How to install Apache using Ansible Playbook

Updated 10 February 2023

Here we are introducing a playbook and how it works with Ansible in Linux servers.

Playbooks can run multiple tasks and jobs and provide some more advanced functionality, it’s used to define deployment and configurations in a single file, using the playbook we can manage our configurations and deployments on remote machines.  Ansible playbook config files are written in the simple YAML, the playbooks are designed to be human-readable and developed in a basic text language. As the playbooks expressed in YAML format and have a minimum of syntax, which intentionally tries to not be a programming language or script, but rather a model of a configuration or a process.

A YAML script always starts with “—” and ends with “…”

Apache installation using Ansible playbook :

How above codes is working ?

– name: use comand to run “apt-get update”

apt: update_cache=yes : used to update the cache

– name : use to run command “apt-get install apache2”

apt: name=apache2 state=present

– name: to restart apache service

service: name=apache2 state= restart

-debug: msg : used to display installation message.

  CONTACT US IN CASE OF ANY QUERY

Category(s) linux
author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project






    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home