Start a Project

How to install Apache using Ansible Playbook

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

Exit mobile version