/keepalived-nginx-HA-ubuntu

I configured keepalived and nginx together to make Highly available nginx cluster

Primary LanguageJinja

Ansible Nginx High Availability with Keepalived

This Ansible project sets up a highly available Nginx configuration using Keepalived on Ubuntu servers. The setup includes load balancing and failover capabilities.

Requirements

  • Ubuntu target servers
  • Ansible 2.9 or higher
  • Python 3.x

Project Structure

.
├── inventory/
│   └── hosts.yml
├── group_vars/
│   └── all.yml
├── roles/
│   ├── nginx/
│   └── keepalived/
├── site.yml
└── README.md

Usage

  1. Update the inventory file with your server details
  2. Configure variables in group_vars/all.yml
  3. Run the playbook:
ansible-playbook -i inventory/hosts.yml site.yml

Configuration

The setup includes:

  • Nginx installation and configuration
  • Keepalived installation and configuration
  • Virtual IP (VIP) configuration
  • Health checks
  • Failover setup