/etc/puppet/modules/orchestra-haproxy/manifests/init.pp is in ubuntu-orchestra-modules-haproxy 1.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | class haproxy( $clustername = $uniqueid, $listenip = $ipaddress, $listenport = "80", $cookiename = "SERVERID" )
{
package{"haproxy": ensure => present} -> File <<| tag == "loadbalancer_${clustername}" |>>
service {"haproxy":
ensure => running,
enable => true,
subscribe => [File["haproxy_default"], File["haproxy_config"]],
hasstatus => true,
restart => "/etc/init.d/haproxy reload",
}
file {"haproxy_default":
name => "/etc/default/haproxy",
ensure => present,
owner => "root",
group => "root",
mode => "644",
require => Package["haproxy"],
}
exec{"haproxy_clustername_directory":
command => "mkdir -p /etc/haproxy/${clustername}",
require => Package["haproxy"],
unless => "test -d /etc/haproxy/${clustername}",
}
exec{"serverentries_file":
command => "echo > /etc/haproxy/${clustername}.servers",
require => Exec["haproxy_clustername_directory"],
unless => "test -e /etc/haproxy/${clustername}.servers",
}
exec{"update_serverentries_config":
command => "cat /etc/haproxy/${clustername}/*.server > /etc/haproxy/${clustername}/${clustername}.servers",
require => Exec["serverentries_file"],
onlyif => "test `find /etc/haproxy/${clustername}/*.server | wc -l` -gt 0",
}
file {"haproxy_config":
name => "/etc/haproxy/haproxy.cfg",
ensure => present,
owner => "root",
group => "root",
mode => "644",
content => template("/etc/puppet/modules/orchestra-haproxy/templates/haproxy.cfg.erb"),
require => Exec["update_serverentries_config"],
}
exec{"update_haproxy_config":
command => "cat /etc/haproxy/${clustername}/${clustername}.servers >> /etc/haproxy/haproxy.cfg",
require => File["haproxy_config"],
notify => Service["haproxy"],
onlyif => "test -e /etc/haproxy/${clustername}/${clustername}.servers",
}
exec{"enable_haproxy":
command => "sed -i /etc/default/haproxy -e s/ENABLED\=0/ENABLED\=1/",
require => Package["haproxy"],
notify => Service["haproxy"],
}
}
|