Move inline_template to a real template (cleaner)
Create a proper conf. file also for logrotate Refs: #25
This commit is contained in:
12
files/logrotate/haproxy
Normal file
12
files/logrotate/haproxy
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Managed by Puppet
|
||||||
|
# Module cloud::loadbalancer
|
||||||
|
/var/log/haproxy.log {
|
||||||
|
rotate 7
|
||||||
|
daily
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
delaycompress
|
||||||
|
compress
|
||||||
|
postrotate
|
||||||
|
endscript
|
||||||
|
}
|
@@ -15,7 +15,6 @@
|
|||||||
#
|
#
|
||||||
# HAproxy nodes
|
# HAproxy nodes
|
||||||
#
|
#
|
||||||
|
|
||||||
class cloud::loadbalancer(
|
class cloud::loadbalancer(
|
||||||
$ceilometer_api = true,
|
$ceilometer_api = true,
|
||||||
$cinder_api = true,
|
$cinder_api = true,
|
||||||
@@ -36,7 +35,7 @@ class cloud::loadbalancer(
|
|||||||
$keepalived_state = 'BACKUP',
|
$keepalived_state = 'BACKUP',
|
||||||
$keepalived_priority = 50,
|
$keepalived_priority = 50,
|
||||||
$keepalived_interface = $os_params::keepalived_interface,
|
$keepalived_interface = $os_params::keepalived_interface,
|
||||||
$keepalived_ipvs = [ $os_params::openstack_vip, $os_params::mysql_vip ],
|
$keepalived_ipvs = [$os_params::openstack_vip,$os_params::mysql_vip],
|
||||||
$keepalived_localhost_ip = $os_params::keepalived_localhost_ip,
|
$keepalived_localhost_ip = $os_params::keepalived_localhost_ip,
|
||||||
$ks_cinder_public_port = $os_params::ks_cinder_public_port,
|
$ks_cinder_public_port = $os_params::ks_cinder_public_port,
|
||||||
$ks_ceilometer_public_port = $os_params::ks_ceilometer_public_port,
|
$ks_ceilometer_public_port = $os_params::ks_ceilometer_public_port,
|
||||||
@@ -77,83 +76,12 @@ class cloud::loadbalancer(
|
|||||||
notify_backup => '"/etc/init.d/haproxy stop"',
|
notify_backup => '"/etc/init.d/haproxy stop"',
|
||||||
}
|
}
|
||||||
|
|
||||||
$monitors_data = inline_template('
|
file { '/etc/logrotate.d/haproxy':
|
||||||
<%- if @swift_api -%>
|
ensure => file,
|
||||||
acl swift_api_dead nbsrv(swift_api_cluster) lt 1
|
source => 'puppet:///cloud/logrotate/haproxy',
|
||||||
monitor fail if swift_api_dead
|
owner => root,
|
||||||
<%- end -%>
|
group => root,
|
||||||
<%- if @keystone_api -%>
|
mode => '0644';
|
||||||
acl keystone_api_dead nbsrv(keystone_api_cluster) lt 1
|
|
||||||
monitor fail if keystone_api_dead
|
|
||||||
<% end -%>
|
|
||||||
<%- if @galera -%>
|
|
||||||
acl galera_dead nbsrv(galera_cluster) lt 1
|
|
||||||
monitor fail if galera_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @neutron_api -%>
|
|
||||||
acl neutron_api_dead nbsrv(neutron_api_cluster) lt 1
|
|
||||||
monitor fail if neutron_api_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @cinder_api -%>
|
|
||||||
acl cinder_api_dead nbsrv(cinder_api_cluster) lt 1
|
|
||||||
monitor fail if cinder_api_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @nova_api -%>
|
|
||||||
acl nova_api_dead nbsrv(nova_api_cluster) lt 1
|
|
||||||
monitor fail if nova_api_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @nova_ec2 -%>
|
|
||||||
acl nova_ec2_dead nbsrv(nova_ec2_cluster) lt 1
|
|
||||||
monitor fail if nova_ec2_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @nova_metadata -%>
|
|
||||||
acl nova_metadata_dead nbsrv(nova_metadata_cluster) lt 1
|
|
||||||
monitor fail if nova_metadata_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @spice -%>
|
|
||||||
acl spice_dead nbsrv(spice_cluster) lt 1
|
|
||||||
monitor fail if spice_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @glance_api -%>
|
|
||||||
acl nova_api_dead nbsrv(glance_api_cluster) lt 1
|
|
||||||
monitor fail if nova_api_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @ceilometer_api -%>
|
|
||||||
acl ceilometer_api_dead nbsrv(ceilometer_api_cluster) lt 1
|
|
||||||
monitor fail if ceilometer_api_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @heat_api -%>
|
|
||||||
acl heat_api_dead nbsrv(heat_api_cluster) lt 1
|
|
||||||
monitor fail if heat_api_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @heat_cfn_api -%>
|
|
||||||
acl heat_api_cfn_dead nbsrv(heat_api_cfn_cluster) lt 1
|
|
||||||
monitor fail if heat_api_cfn_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @heat_cloudwatch_api -%>
|
|
||||||
acl heat_api_cloudwatch_dead nbsrv(heat_api_cloudwatch_cluster) lt 1
|
|
||||||
monitor fail if heat_api_cloudwatch_dead
|
|
||||||
<%- end -%>
|
|
||||||
<%- if @horizon -%>
|
|
||||||
acl horizon_dead nbsrv(horizon_cluster) lt 1
|
|
||||||
monitor fail if horizon_dead
|
|
||||||
<%- end -%>
|
|
||||||
')
|
|
||||||
|
|
||||||
file{'/etc/logrotate.d/haproxy':
|
|
||||||
content => "
|
|
||||||
/var/log/haproxy.log
|
|
||||||
{
|
|
||||||
rotate 7
|
|
||||||
daily
|
|
||||||
missingok
|
|
||||||
notifempty
|
|
||||||
delaycompress
|
|
||||||
compress
|
|
||||||
postrotate
|
|
||||||
endscript
|
|
||||||
}
|
|
||||||
"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
haproxy::listen { 'monitor':
|
haproxy::listen { 'monitor':
|
||||||
@@ -163,7 +91,7 @@ monitor fail if horizon_dead
|
|||||||
'mode' => 'http',
|
'mode' => 'http',
|
||||||
'monitor-uri' => '/status',
|
'monitor-uri' => '/status',
|
||||||
'stats' => ['enable','uri /admin','realm Haproxy\ Statistics',"auth ${haproxy_auth}", 'refresh 5s' ],
|
'stats' => ['enable','uri /admin','realm Haproxy\ Statistics',"auth ${haproxy_auth}", 'refresh 5s' ],
|
||||||
'' => $monitors_data,
|
'' => template('cloud/loadbalancer/monitor.erb'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
60
templates/loadbalancer/monitor.erb
Normal file
60
templates/loadbalancer/monitor.erb
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<%- if @swift_api -%>
|
||||||
|
acl swift_api_dead nbsrv(swift_api_cluster) lt 1
|
||||||
|
monitor fail if swift_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @keystone_api -%>
|
||||||
|
acl keystone_api_dead nbsrv(keystone_api_cluster) lt 1
|
||||||
|
monitor fail if keystone_api_dead
|
||||||
|
<% end -%>
|
||||||
|
<%- if @galera -%>
|
||||||
|
acl galera_dead nbsrv(galera_cluster) lt 1
|
||||||
|
monitor fail if galera_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @neutron_api -%>
|
||||||
|
acl neutron_api_dead nbsrv(neutron_api_cluster) lt 1
|
||||||
|
monitor fail if neutron_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @cinder_api -%>
|
||||||
|
acl cinder_api_dead nbsrv(cinder_api_cluster) lt 1
|
||||||
|
monitor fail if cinder_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @nova_api -%>
|
||||||
|
acl nova_api_dead nbsrv(nova_api_cluster) lt 1
|
||||||
|
monitor fail if nova_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @nova_ec2 -%>
|
||||||
|
acl nova_ec2_dead nbsrv(nova_ec2_cluster) lt 1
|
||||||
|
monitor fail if nova_ec2_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @nova_metadata -%>
|
||||||
|
acl nova_metadata_dead nbsrv(nova_metadata_cluster) lt 1
|
||||||
|
monitor fail if nova_metadata_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @spice -%>
|
||||||
|
acl spice_dead nbsrv(spice_cluster) lt 1
|
||||||
|
monitor fail if spice_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @glance_api -%>
|
||||||
|
acl nova_api_dead nbsrv(glance_api_cluster) lt 1
|
||||||
|
monitor fail if nova_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @ceilometer_api -%>
|
||||||
|
acl ceilometer_api_dead nbsrv(ceilometer_api_cluster) lt 1
|
||||||
|
monitor fail if ceilometer_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @heat_api -%>
|
||||||
|
acl heat_api_dead nbsrv(heat_api_cluster) lt 1
|
||||||
|
monitor fail if heat_api_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @heat_cfn_api -%>
|
||||||
|
acl heat_api_cfn_dead nbsrv(heat_api_cfn_cluster) lt 1
|
||||||
|
monitor fail if heat_api_cfn_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @heat_cloudwatch_api -%>
|
||||||
|
acl heat_api_cloudwatch_dead nbsrv(heat_api_cloudwatch_cluster) lt 1
|
||||||
|
monitor fail if heat_api_cloudwatch_dead
|
||||||
|
<%- end -%>
|
||||||
|
<%- if @horizon -%>
|
||||||
|
acl horizon_dead nbsrv(horizon_cluster) lt 1
|
||||||
|
monitor fail if horizon_dead
|
||||||
|
<%- end -%>
|
Reference in New Issue
Block a user