Giter VIP home page Giter VIP logo

ansible-haproxy-role's Introduction

CI

ansible-haproxy-role

HAProxy single loadbalancer server ansible role for Centos 7

Requirements

This role was developed and tested using Ansible 2.9
Backward compatibility is currently not tested and guaranteed

Default variables values

# Rsyslog log facility for HAproxy
haproxy_syslog_facility: local2

# HAProxy supports http/tcp"
haproxy_mode: http

# HAProxy stats port
haproxy_stats_port: 3000

# HAProxy stats auth username
haproxy_stats_user: admin

# HAProxy stats auth password
haproxy_stats_password: r00tme

# Port on which HAProxy should listen
haproxy_listenport: 8080

# HAProxy default backend
haproxy_default_backend: production

Example Playbook

- hosts: loadbalancer
  gather_facts: True
  become: yes
  roles:
    - role: haproxy

  vars:
    haproxy:
      backends:
        - name: production
          balance: roundrobin
          servers:
            - name: web1
              address: 10.0.0.101
              port: 80
            - name: web2
              address: 10.0.0.102
              port: 80

Manual testing (Vagrant)

  • Create vagrant CentOS 7 virtual machines using Vagrantfile (1 haproxy and 2 nginx)
    bento box default username/password is "vagrant" (https://app.vagrantup.com/bento)
vagrant up
  • Deploy nginx webservers
    Provided example playbook require geerlingguy.nginx role available with ansible-galaxy
ansible-galaxy install geerlingguy.nginx
ansible-playbook -i inventory playbook/deploy-nginx.yml -u vagrant -kK
  • Deploy HAProxy server
ansible-playbook -i inventory playbook/deploy-haproxy.yml -u vagrant -kK

Loadbalancer: http://10.0.0.200:8080/
Admin stats: http://10.0.0.200:3000/haproxy

License

MIT

License

Julien Carpentier

ansible-haproxy-role's People

Contributors

j-carpentier avatar

Watchers

 avatar  avatar  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.