This is a very basic install and configuration of haproxy, supporting multiple instances of haproxy.
It configures haproxy to load with multiple configuration files.
- /etc/haproxy/instance.cfg # Global configurations
- /etc/haproxy/instance.d/frontends # Frontend configurations
- /etc/haproxy/instance.d/backends # Backend configurations
Tested on chef 12.5.1 and CentOS 6.7
:create
Create a haproxy service (default):restart
Restart the haproxy service
instance_name
String Name of the service (name property)
ga_haproxy 'servicename'
:enable
Enable a frontend for an existing haproxy service (default):disable
Disable a frontend for an existing haproxy service
frontend_name
String Name of the frontend (name property)instance_name
String The instance with which it is associatedsocket
String The socket on which to listendefault_backend
String The default_backend haproxy directive.
ga_haproxy_frontend 'frontend-foo'
instance_name 'servicename'
socket '*:80'
default_backend 'backend-foo'
action :enable
OR
ga_haproxy_frontend 'frontend-foo'
action :disable
:enable
Enable a backend for an existing haproxy service (default):disable
Disable a backend for an existing haproxy service
backend_name
String Name of the backend (name property)instance_name
String The instance with which it is associatedservers
Array The servers for the backend.options
[Array, nil] Additional options for the backend. (optional)j
servers = [
{
name: 'servername1',
socket: '127.0.0.1:5001',
options: ['check']
}
]
options = [
'balance roundrobin'
]
ga_haproxy_backend 'backend-foo'
instance_name 'servicename'
servers servers
options options
action :enable
OR
ga_haproxy_backend 'backend-foo'
action :disable