O'Reilly logo

Puppet 5 Cookbook - Fourth Edition by Thomas Uphill

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

In this recipe, I'll show you how to build an HAProxyserver to load balance web requests across web servers. We'll use exported resources to build the haproxy configuration file, just as we did for the NFS example:

  1. Create the modules/haproxy/manifests/master.pp file with the following contents:
# the master member of the proxy groupclass haproxy::master (  String $app = 'myapp') {  # The HAProxy master server  # will collected haproxy::slave resources and add to it's balancer  package { 'haproxy': ensure => installed }
  1. Set the SELinux Boolean for haproxy_connect_any to on. This will allow Haproxy to connect to services:
  selinux::boolean{ 'haproxy_connect_any':    ensure => 'on',    before => Service['haproxy'],  }
  1. Turn on the  ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required