Giter Club home page Giter Club logo

ansible-role-haproxy's Introduction

Build Status License Ansible Role Name Ansible Role counter

Ansible-role-haproxy

Installs HAProxy on RedHat/CentOS server.

Note: This roles use community HAProxy package in version 1.8.

Requirements

This role use custom community package of HAProxy 1.8.1-4, url is define in defaults variable files.

Role Variables

All default variables are predefined in defaults/main.yml. Example playbook usage is also define in vars/main.yml.

Note: An attribute haproxy_nbproc should be equal or lower than the number of cpu on haproxy machines.

Note: A variable haproxy_stats_pass: have to be change before you use this role.

Example Playbook

Example playbook usage.

- name: Run nginx-ingress
  hosts: 'haproxy'
  vars:
   # Below there are some ansible values that could be also define in ansible.cfg
   ansible_become: yes
   ansible_connection: ssh
   ansible_user: ansible
   ansible_ssh_private_key_file: test_key.pem
   #role configuration parameters.
   haproxy_max_conn: 2000000
   haproxy_services:
     - name: "Kafka"
       type: listen
       binds:
         - { host: "*", port: "8080" }
       acls:
         - { name: "network_allowed", rule: "src 20.30.40.50 8.9.9.0/27" }
       conditions:
         - { state: "tcp-request connection reject", rule: "!network_allowed" }
       endpoints:
         - { name: "backend_1", address: "192.168.0.1:8080" }
         - { name: "backend_2", address: "192.168.0.2:8080" }
     - name: "k8s"
       type: frontend
       binds:
         - { host: "*", port: "80" }
       mode: http
       acls:
         - { name: "forward_k8s", rule: "hdr_end(host) -i k8s.example.com" }
       conditions:
         - { state: "use_backend k8s_backend", rule: "forward_k8s" }
       default_backend: company_site
     - name: "company_site"
       type: backend
       balance_type: roundrobin
       options:
         - "option forwardfor"
         - "http-request set-header X-Forwarded-Port %[dst_port]"
       endpoints:
         - { name: "backend_1", address: "192.168.0.1:80", options: "check" }
         - { name: "backend_2", address: "192.168.0.2:80", options: "check" }
     - name: "k8s_backend"
       type: backend
       balance_type: roundrobin
       options:
         - "option forwardfor"
         - "http-request set-header X-Forwarded-Port %[dst_port]"
       endpoints:
         - { name: "backend_1", address: "192.168.0.3:8080", options: "check" }
         - { name: "backend_2", address: "192.168.0.4:8080", options: "check" }
  roles:
       - ansible-role-haproxy


License

MIT

TODO

  • Custom error pages
  • Log customization
  • Add more complex test

Author Information

This role was created in 2018 for Novomatic Technologies Poland purposes.

ansible-role-haproxy's People

Contributors

kaarolch avatar keitalbame avatar paulfantom avatar rdemachkovych 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.