Installs and configures haproxy.
- Chef 12.5+
- Ubuntu 12.04+, Ubuntu 14.04+, Ubuntu 16.04
- RHEL 6+, CentOS6+, OracleLinux6+
- RHEL 7+, CentOS7+, OracleLinux7+
- Debian 8+
haproxy_install 'package' do
conf_file_mode '0640'
end
haproxy_config_global '' do
chroot '/var/lib/haproxy'
daemon true
maxconn 256
log '/dev/log local0' #It can also be defined as Array
log_tag 'WARDEN'
pidfile '/var/run/haproxy.pid'
stats socket: '/var/lib/haproxy/stats level admin'
tuning 'bufsize' => '262144'
end
haproxy_config_defaults '' do
mode 'http'
timeout connect: '5000ms',
client: '5000ms',
server: '5000ms'
end
haproxy_frontend 'http-in' do
bind '*:80'
extra_options(
'redirect' => [
'code 301 prefix / if acl1',
'scheme https if !acl_2'
])
default_backend 'servers'
end
haproxy_backend 'servers' do
server ['server1 127.0.0.1:8000 maxconn 32']
end
haproxy_resolver 'dns' do
nameserver ['google 8.8.8.8:53']
extra_options('resolve_retries' => 30,
'timeout' => 'retry 1s')
end
- Author:: Dan Webb (https://github.com/damacus)
- Author:: Will Fisher (https://github.com/teknofire)
- Author:: Richard Shade (https://github.com/rshade)
- Author:: Joshua Timberman ([email protected])
- Author:: Aaron Baer ([email protected])
- Author:: Justin Kolberg ([email protected])
Copyright:: Heavy Water Operations, LLC.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.