Coder Social home page Coder Social logo

ansible-nginx-load-balancer's Introduction

ansible-nginx-load-balancer

Ansible role to install/configure an NGINX load balancer for:

Usages

  • HTTP Load Balancing
  • HTTPS Load Balancing
    • SSL Termination
    • Self Signed Certs
  • TCP Load Balancing
  • UDP Load Balancing
  • HA (Highly Available) Setup

Build Status

GitHub Actions

Molecule Test

Travis CI

Build Status

Requirements

For any required Ansible roles, review: requirements.yml

Role Variables

defaults/main.yml

Dependencies

The following Ansible roles should be used along with this ansible-nginx-load-balancer role.

  • ansible-etc-hosts
    • Provides the ability to update /etc/hosts with all hosts which are part of the solution
  • ansible-keepalived
    • Provides the ability to provide the VIP for HA of multiple ansible-nginx-load-balancer nodes.

You can install the above roles using ansible-galaxy and the included requirements

ansible-galaxy install -r requirements.yml

Example Playbook

playbook.yml

License

MIT

Author Information

Larry Smith Jr.

NOTE: Repo has been created/updated using https://github.com/mrlesmithjr/cookiecutter-ansible-role as a template.

ansible-nginx-load-balancer's People

Contributors

aklinkert avatar mrlesmithjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ansible-nginx-load-balancer's Issues

Plain TCP load balancing does not work

Hey there,

I'm trying to deploy a load balancer using plain tcp as protocol, but I am unable to generate a sane config.

This is an excerpt of my playbook:

- name: Install nginx load balancer
  hosts: k8s-lb
  roles:
    - role: mrlesmithjr.nginx-load-balancer
      tags: [lb, load-balancer]
  vars:
    nginx_load_balancer_configs:
      - name: 'ingress_http'
        frontend_listen_port: 80
        method: 'round_robin'
        protocol: 'tcp'
        upstream:
          - servers: "{{ cluster_nodes_ips }}"
            backend_listen_port: 80
      - name: 'ingress_https'
        frontend_listen_port: 443
        method: 'round_robin'
        protocol: 'tcp'
        upstream:
          - servers: "{{ cluster_nodes_ips }}"
            backend_listen_port: 443
      - name: 'k8s_api'
        frontend_listen_port: 6443
        method: 'round_robin'
        protocol: 'tcp'
        upstream:
          - servers: "{{ cluster_masters_ips }}"
            backend_listen_port: 6443

which renders into (replaced all ips by <>):

# Ansible managed

pid /run/nginx.pid;
user www-data;
worker_processes 4;
include /etc/nginx/modules-enabled/*.conf;
events {
  worker_connections 1024;
}
http {
}
stream {
  upstream ingress_http {
    server <>:80;
  }
  server {
    listen 80 tcp;
    proxy_pass ingress_http;
  }
  upstream ingress_https {
    server <>:443;
  }
  server {
    listen 443 tcp;
    proxy_pass ingress_https;
  }
  upstream k8s_api {
    server <>:6443;
  }
  server {
    listen 6443 tcp;
    proxy_pass k8s_api;
  }
}

when using protocol: '':

# Ansible managed

pid /run/nginx.pid;
user www-data;
worker_processes 4;
include /etc/nginx/modules-enabled/*.conf;
events {
  worker_connections 1024;
}
http {
}
stream {
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.