Giter Club home page Giter Club logo

ansible-nginx-reverse-proxy's Introduction

Role Name

Creates and deploys simple nginx reverse proxy configurations from supplied variables, optionally making use of the load balancing features as well.

At the time, this role does not expose all possible configurations of nginx's load balancing and proxying, but aims to use rational defaults with some configurability.

Requirements

nginx with reverse proxy support installed on the server to be managed.

Role Variables

Expected to Be Configured

  • nginx_reverse_proxy_proxies: list of reverse proxy configurations; each configuration needs the following variables
    • nginx_reverse_proxy_backend_name: string, name nginx config uses to refer to the backend
    • nginx_reverse_proxy_domains: list of public-facing domains to be proxied
    • nginx_reverse_proxy_backends: list of backend servers, including ports and other valid parameters for server in the upstream context of an nginx config file
    • nginx_reverse_proxy_config_name: name to use for the proxy file (do not include the '.conf' extension, role will add this)

Proxy configuration options

Along with the variables that must be configured for each reverse proxy configuration, some configuration options are available on a per-proxy basis:

  • balancer_config: specify a load balancing strategy other than the default round robin. Valid options include least_conn (for least connections) and ip_hash (for session persistence using IP hashing).

See the app2proxy definition in the example playbook below.

Role Defaults

nginx_reverse_proxy_config_directory: location to store config files for nginx (default: /etc/nginx/conf.d) nginx_reverse_proxy_nginx_service: name the nginx service runs under, for the handler restart if config files are changed (default: nginx)

Dependencies

nginx is expected to be installed on the server being managed

Example Playbook

---
- hosts: nginx
  remote_user: vagrant
  become: yes
  vars:
    - nginx_reverse_proxy_proxies:
      - config_name: app1proxy
        backend_name: my-backend-1
        backends:
          - localhost:1880 weight=2
          - localhost:1881
        domains:
          - app1.192.168.88.10.xip.io
      - config_name: app2proxy
        backend_name: my-backend-2
        backends:
          - localhost:1882
          - localhost:1883
        domains:
          - app2.192.168.88.10.xip.io
        balancer_config: least_conn;
      - config_name: sessionappproxy
        backend_name: session-app-backend
        backends:
          - localhost:1880
          - localhost:1881
          - localhost:1882
          - localhost:1883
        domains:
          - sessioned-app.192.168.88.10.xip.io
        balancer_config: ip_hash;

  roles:
    - ansible-nginx-reverse-proxy

License

BSD

Author Information

ansible-nginx-reverse-proxy's People

Contributors

waharnum avatar tkhduracell avatar

Watchers

James Cloos avatar

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.