Skip to content

Commit

Permalink
Merge pull request #1 from cernops/prepare
Browse files Browse the repository at this point in the history
Vesion 1.0
  • Loading branch information
traylenator committed Dec 9, 2013
2 parents a8dfcbd + e2f826d commit 0668d42
Show file tree
Hide file tree
Showing 16 changed files with 1,018 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rvm: 1.8.7
notifications:
env:
- PUPPET_VERSION=2.6.14
- PUPPET_VERSION=2.7.11
- PUPPET_VERSION=3.2.2
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source 'https://rubygems.org'

if ENV.key?('PUPPET_VERSION')
puppetversion = "= #{ENV['PUPPET_VERSION']}"
else
puppetversion = ['>= 2.7']
end

gem 'rake'
gem 'puppet-lint'
gem 'rspec-puppet'
gem 'puppet', puppetversion
11 changes: 11 additions & 0 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name 'cernops-webalizer'
version '0.1.0'
source 'http://github.com/cernops/puppet-webalizer'
author 'cernops'
license 'Apache License, Version 2.0'
summary 'Configures webalizer'
description 'Configure webalizer'
project_page 'http://github.com/cernops/puppet-webalizer'

## Add dependencies, if any:
#dependency 'puppetlabs/apache', '>= 0.9.0'
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
puppet-webalizer
================
#webalizer

Installs and configures /etc/webalizer.conf
## Overview
1. Installs webalizer package.
2. Configures /etc/webalizer.conf.
3. Overrights thecron job file provided by the package.
4. Optionally creates apache configuration to serve webalizer's output.

This has only been tested on rhel/fedora type systems, it should be very
easy to adapt to debian or others.

## Examples
Set up webalizer on an alternative logfile, allow access from all to the
apache served ouput

```puppet
class{'webalizer':
logfile => "/var/log/httpd/my_access.log",
allow => 'from all',
puppet_apache => true,
}
```

## Params
See webalizer::init and webalizer::params for confguration that can passed
to webalizer::init.

## License
Apache 2.0

## Contact
Steve Traylen <[email protected]>

## Support
Please log tickets and issues at http://github.com/cernops/puppet-webalizer
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rake'

require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_80chars')

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
end

task :default => [:spec, :lint]
33 changes: 33 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#Class: webalizer::config
#confgures webalizer.conf and cron job using
#parameters from init (defaults params.pp)
class webalizer::config inherits webalizer {


if $::puppet_apache {
file{'/etc/httpd/conf.d/webalizer.conf':
ensure => file,
owner => root,
group => root,
mode => '0644',
content => template('webalizer/webalizer-httpd.conf.erb')
}
}

file{'/etc/webalizer.conf':
ensure => file,
mode => '0644',
owner => root,
group => root,
content => template('webalizer/webalizer.conf.erb')
}
#Kill the rpm provided cron job.
file{'/etc/cron.daily/00webalizer':
ensure => file,
mode => '0755',
owner => root,
group => root,
content => template('webalizer/webalizer.cron.erb'),
require => Package['webalizer']
}
}
133 changes: 133 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# == Class: webalizer
#
# Installs webalizer and configures /etc/webalizer.conf
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# [*version*]
# Specify a version of the webalizer package to install. Default is *present*
#
# [*puppet_apache*]
# Should the puppet module create a /etc/httpd/conf.d/webalizer.conf, default is
# *true*
#
# [*allow*]
# Specify who is permitted to access the /usage URL, default is from 'from 127.0.0.1' only.
# The value ends up in the /etc/httpd/conf.d/webalizer.conf file above.
#
# [*logfile*, *logtype*, *historyname*, ...]
# There are around 70 configuration options that set values in /etc/webalizer.conf.
# These values come direct from the man page for webalizer.conf. Note that some
# values are strings where as some are arrays. Check the defaults in params.pp
# === Examples
#
# class { webalizer:
# logfile => '/var/log/httpd/my_accces.log',
# allow => 'from all',
# puppet_apache => true
# }
#
# === Authors
#
# Steve Traylen <[email protected]>
#
# === Copyright
#
# Copyright 2013 Steve Traylen, CERN
#
class webalizer (
$version = $webalizer::params::version,
$puppet_apache = $webalizer::params::puppet_apache,
$allow = $webalizer::params::allow,
$logfile = $webalizer::params::logfile,
$logtype = $webalizer::params::logtype,
$historyname = $webalizer::params::historyname,
$incremental = $webalizer::params::incremental,
$clf = $webalizer::params::clf,
$incrementalname = $webalizer::params::incrementalname,
$reporttitle = $webalizer::params::reporttitle,
$hostname = $webalizer::params::hostname,
$htmlextenstion = $webalizer::params::htmlextenstion,
$pagetype = $webalizer::params::pagetype,
$usehttps = $webalizer::params::usehttps,
$dnscache = $webalizer::params::dnscache,
$dnschildren = $webalizer::params::dnschildren,
$htmlpre = $webalizer::params::htmlpre,
$htmlhead = $webalizer::params::htmlhead,
$htmlbody = $webalizer::params::htmlbody,
$htmlpost = $webalizer::params::htmlpost,
$htmltail = $webalizer::params::htmltail,
$htmlend = $webalizer::params::htmlend ,
$quiet = $webalizer::params::quiet ,
$reallyquiet = $webalizer::params::reallyquiet ,
$timeme = $webalizer::params::timeme,
$gmttime = $webalizer::params::gmttime,
$debug = $webalizer::params::debug,
$foldseqerr = $webalizer::params::foldseqerr,
$visittimeout = $webalizer::params::visittimeout,
$ignorehist = $webalizer::params::ignorehist,
$countrygraph = $webalizer::params::countrygraph,
$dailygraph = $webalizer::params::dailygraph,
$dailystats = $webalizer::params::dailystats,
$hourlygraph = $webalizer::params::hourlygraph,
$hourlystats = $webalizer::params::hourlystats,
$graphlegend = $webalizer::params::graphlegend,
$graphlines = $webalizer::params::graphlines,
$topsites = $webalizer::params::topsites,
$topksites = $webalizer::params::topksites,
$topurls = $webalizer::params::topurls ,
$topkurls = $webalizer::params::topkurls ,
$topreferrers = $webalizer::params::topreferrers,
$topagents = $webalizer::params::topagents,
$topcountries = $webalizer::params::topcountries,
$topentry = $webalizer::params::topentry,
$topexit = $webalizer::params::topexit,
$topsearch = $webalizer::params::topsearch,
$topusers = $webalizer::params::topusers,
$allsites = $webalizer::params::allsites,
$allurls = $webalizer::params::allurls,
$allreferrers = $webalizer::params::allreferrers,
$allagents = $webalizer::params::allagents,
$allsearchstr = $webalizer::params::allsearchstr,
$allusers = $webalizer::params::allusers,
$indexalias = $webalizer::params::indexalias,
$hidesite = $webalizer::params::hidesite,
$hidereferrer = $webalizer::params::hidereferrer,
$hideurl = $webalizer::params::hideurl,
$hideagent = $webalizer::params::hideagent,
$hideuser = $webalizer::params::hideuser,
$groupurl = $webalizer::params::groupurl,
$groupsite = $webalizer::params::groupsite,
$groupreferrer = $webalizer::params::groupreferrer,
$groupuser = $webalizer::params::groupuser,
$hideallsites = $webalizer::params::hideallsites,
$groupdomains = $webalizer::params::groupdomains,
$groupshading = $webalizer::params::groupshading,
$grouphighlight = $webalizer::params::grouphighlight,
$ignoresite = $webalizer::params::ignoresite,
$ignoreurl = $webalizer::params::ignoreurl,
$ignorereferrer = $webalizer::params::ignorereferrer,
$ignoreagent = $webalizer::params::ignoreagent,
$ignoreuser = $webalizer::params::ignoreuser,
$mangleagents = $webalizer::params::mangleagents,
$searchagents = $webalizer::params::searchagents

) inherits webalizer::params {

validate_string($version)
validate_string($allow)

anchor { 'webalizer::begin': } ->
class { '::webalizer::install': } ->
class { '::webalizer::config': } ->
anchor { 'webalizer::end': }

}
6 changes: 6 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Class: webalizer::install
class webalizer::install ($version = 'present' ) inherits webalizer {
package{'webalizer':
ensure => $version
}
}
88 changes: 88 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Class: webalizer::params
class webalizer::params {
# Package version of webalizer.
$version = present

#Should I create a httpd configuration file.
$puppet_apache = true
# Who is permitted to access the URL.
$allow = 'from 127.0.0.1'

#Webalizer configuration. All other variables
# are just lower cased configurations from
# man webalizer.conf.
$logfile = '/var/log/httpd/access.log'
$logtype = 'clf'
$output = '/var/www/usage'
$historyname = '/var/lib/webalizer/webalizer.hist'
$incremental = 'yes'
$incrementalname = '/var/lib/webalizer/webalizer.current'
$reporttitle = 'Usage Statistics for'
$hostname = undef
$htmlextenstion = html
$pagetype = ['htm*','cgi','php','shtml']
$usehttps = no
$dnscache = '/var/lib/webalizer/dns_cache.db'
$dnschildren = '10'
$htmlpre = ['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">']
$htmlhead = ['<META NAME="author" CONTENT="The Webalizer">']
$htmlbody = 'HTMLBody <BODY BGCOLOR="#E8E8E8" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000">'
$htmlpost = ['<BR CLEAR="all">']
$htmltail = '<IMG SRC="msfree.png" ALT="100% Micro$oft free!">'
$htmlend = '</BODY></HTML>'
$quiet = 'yes'
$reallyquiet = 'no'
$timeme = 'no'
$gmttime = 'no'
$debug = 'no'
$foldseqerr = 'yes'
$visittimeout = '1800'
$ignorehist = 'no'
$countrygraph = 'yes'
$dailygraph = 'yes'
$dailystats = 'yes'
$hourlygraph = 'yes'
$hourlystats = 'yes'
$graphlegend = 'yes'
$graphlines = '2'
$topsites = '30'
$topksites = '10'
$topurls = '30'
$topkurls = '10'
$topreferrers = '30'
$topagents = '15'
$topcountries = '30'
$topentry = '10'
$topexit = '10'
$topsearch = '20'
$topusers = '20'
$allsites = 'no'
$allurls = 'no'
$allreferrers = 'no'
$allagents = 'no'
$allsearchstr = 'no'
$allusers = 'no'
$indexalias = ['home.htm','homepage.htm']
$hidesite = []
$hidereferrer = []
$hideurl = ['*.gif','*.GIF','*.jpg','*.JPG','*.png','*.PNG','*.ra']
$hideagent = ['RealPlayer']
$hideuser = []
$groupurl = []
$groupsite = []
$groupreferrer = []
$groupuser = []
$hideallsites = 'no'
$groupdomains = '0'
$groupshading = 'yes'
$grouphighlight = 'yes'
$ignoresite = []
$ignoreurl = []
$ignorereferrer = []
$ignoreagent = []
$ignoreuser = []
$mangleagents = '0'
$searchagents = ['yahoo.com p=','altavista.com q=','google.com q=','eureka.com q=']

}

32 changes: 32 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"types": [

],
"project_page": "http://github.com/cernops/puppet-webalizer",
"license": "Apache License, Version 2.0",
"source": "http://github.com/cernops/puppet-webalizer",
"checksums": {
"spec/spec_helper.rb": "a55d1e6483344f8ec6963fcb2c220372",
"templates/webalizer.cron.erb": "a3ed32e2d701b685a80ea7d0770a74df",
"manifests/config.pp": "0fda1d7f44c4a4726763c033a1ed4225",
"tests/init.pp": "923199e5d5b01e5ac3a405afd4bc0cde",
"manifests/params.pp": "21cd34344273613e7980f3de25907b9c",
"Gemfile": "e07d680dcd49f233e785cdc806ba04fa",
"manifests/install.pp": "38d68922575b69b7684b4b4bc3e941cd",
"templates/webalizer.conf.erb": "b01d955e8eaa0de3c3a9130cc9a5c10d",
"manifests/init.pp": "bab5b132c8215b0415d4e1b6524d3589",
"Modulefile": "a93cf722db7b5ffaf5e7a6834388b0d8",
"Rakefile": "ea715fe0328d4fb4bc6de3aae2d67b11",
"LICENSE": "d2794c0df5b907fdace235a619d80314",
"README.md": "79a0d25f5cd9817b8e60154430bffd9a",
"templates/webalizer-httpd.conf.erb": "9421d76d69b9552be74a3d2b0d3e257b"
},
"description": "Configure webalizer",
"version": "0.1.0",
"summary": "Configures webalizer",
"name": "cernops-webalizer",
"author": "cernops",
"dependencies": [

]
}
Binary file added pkg/cernops-webalizer-0.1.0.tar.gz
Binary file not shown.
Loading

0 comments on commit 0668d42

Please sign in to comment.