Add logrotate cookbook
This commit is contained in:
29
cookbooks/logrotate/templates/default/logrotate-global.erb
Normal file
29
cookbooks/logrotate/templates/default/logrotate-global.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
# This file was generated by Chef for <%= node['fqdn'] %>.
|
||||
# Do not modify this file by hand!
|
||||
|
||||
<% @configuration.directives.each do |d| -%>
|
||||
<%= d %>
|
||||
<% end -%>
|
||||
|
||||
<% @configuration.values.each do |k, v| -%>
|
||||
<%= k %> <%= v %>
|
||||
<% end -%>
|
||||
|
||||
include /etc/logrotate.d
|
||||
|
||||
<% @configuration.paths.each do |path, path_config| -%>
|
||||
<%= path %> {
|
||||
<% path_config['directives'].each do |d|-%>
|
||||
<%= d %>
|
||||
<% end -%>
|
||||
<% path_config['values'].each do | k, v | -%>
|
||||
<%= k %> <%= v %>
|
||||
<% end -%>
|
||||
<% path_config['scripts'].each do | scripttype, body | -%>
|
||||
<%= scripttype %>
|
||||
<%= body %>
|
||||
endscript
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
<% end -%>
|
||||
23
cookbooks/logrotate/templates/default/logrotate.erb
Normal file
23
cookbooks/logrotate/templates/default/logrotate.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
# This file was generated by Chef for <%= node['fqdn'] %>.
|
||||
# Do not modify this file by hand!
|
||||
|
||||
<%= @path %> {
|
||||
<%- if @frequency %>
|
||||
<%= @frequency %>
|
||||
<%- end %>
|
||||
<%- CookbookLogrotate::VALUES.each do |opt_name| %>
|
||||
<% if instance_variable_get("@#{opt_name}") %>
|
||||
<%= "#{opt_name} #{instance_variable_get("@#{opt_name}")}" %>
|
||||
<%- end %>
|
||||
<%- end %>
|
||||
<% @options.each do |o| -%>
|
||||
<%= o %>
|
||||
<% end -%>
|
||||
<%- CookbookLogrotate::SCRIPTS.each do |script_name| %>
|
||||
<% unless instance_variable_get("@#{script_name}").empty? %>
|
||||
<%= script_name %>
|
||||
<%= instance_variable_get("@#{script_name}") %>
|
||||
endscript
|
||||
<%- end %>
|
||||
<%- end %>
|
||||
}
|
||||
Reference in New Issue
Block a user