This repository contains an Ansible playbook designed to deploy and configure an Nginx web server on multiple nodes, demonstrating the ability to manage heterogeneous environments (Ubuntu and Amazon Linux) in an automated fashion.
Project Description
The objective is to automate the configuration of two identical web servers, each on a node with a different operating system, displaying a custom welcome page.
Technologies Used
- Ansible: For configuration automation.
 - AWS EC2: As the node provider (1 Ubuntu, 1 Amazon Linux).
 - Multipass: As the host machine to run Ansible.
 - Nginx: As the web server.
 
Repository Structure
instalar_nginx.yml: The main Ansible playbook containing all the tasks..gitignore: File to exclude the inventory (maquinas) from version control for security purposes.README.md: This file.
How the Playbook Works
The instalar_nginx.yml playbook performs the following actions on all hosts in the inventory:
- Determines the Nginx root path: It uses a variable and a condition (
when: ansible_os_family == "Debian") to set the correct path (/var/www/htmlfor Ubuntu,/usr/share/nginx/htmlfor Amazon Linux). - Installs Nginx: It uses the 
ansible.builtin.packagemodule, which transparently manages bothaptandyum. - Deploys a welcome page: It copies a custom 
index.htmlfile that displays information about the node. - Ensures the service is running: It guarantees that Nginx is started and enabled to start on system boot.
 
How to Use It
- Clone this repository.
 - Create an inventory file (e.g., 
maquinas) with the IPs and credentials of the nodes. - Run the playbook with the command:
 
Bashansible-playbook -i maquinas instalar_nginx.yml
