From f3f8eabdf1bc8d73dd8a5ede8f197fcd834d78ea Mon Sep 17 00:00:00 2001 From: Michael Stahnke Date: Sun, 7 Oct 2012 12:40:10 -0700 Subject: Initial commit --- Modulefile | 11 +++++++++++ README | 17 +++++++++++++++++ manifests/init.pp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ spec/spec_helper.rb | 17 +++++++++++++++++ tests/init.pp | 11 +++++++++++ 5 files changed, 111 insertions(+) create mode 100644 Modulefile create mode 100644 README create mode 100644 manifests/init.pp create mode 100644 spec/spec_helper.rb create mode 100644 tests/init.pp diff --git a/Modulefile b/Modulefile new file mode 100644 index 0000000..6056563 --- /dev/null +++ b/Modulefile @@ -0,0 +1,11 @@ +name 'stahnma-avahi' +version '0.0.1' +source 'UNKNOWN' +author 'stahnma' +license 'Apache License, Version 2.0' +summary 'UNKNOWN' +description 'UNKNOWN' +project_page 'UNKNOWN' + +## Add dependencies, if any: +dependency 'cprice404-inifile', '>= 1.2.0' diff --git a/README b/README new file mode 100644 index 0000000..64ce0b5 --- /dev/null +++ b/README @@ -0,0 +1,17 @@ +avahi + +This is the avahi module. + +License +------- +Apache Software License 2.0 + + +Contact +------- +stahnma@fedoraproject.org + + +Support +------- +none diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..a9c7162 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,55 @@ +# == Class: avahi +# +# This module sets up avahi on EL based systems. +# +# +# Requirements: +# cprice404-inifile >= 0.0.3 +# +# === Parameters +# +# === Examples +# +# class { avahi: } +# +# === Authors +# +# Michael Stahnke +# +# === Copyright +# +# Copyright 2012 Michael Stahnke + + +class avahi { + + $avahi_pkgs = [ 'avahi', 'avahi-tools', 'nss-mdns' ] + + package { $avahi_pkgs: + ensure => installed, + } + + service { 'avahi-daemon': + ensure => running, + enable => true, + hasstatus => true, + require => Service['messagebus'], + } + + service { 'messagebus': + ensure => running, + enable => true, + require => Package[$avahi_pkgs], + } + + ini_setting { "avahi-${::hostname}": + ensure => present, + path => '/etc/avahi/avahi-daemon.conf', + section => 'server', + setting => 'host-name', + key_val_separator => '=', + value => $::hostname, + notify => Service['avahi-daemon'], + } + +} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..5fda588 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,17 @@ +dir = File.expand_path(File.dirname(__FILE__)) +$LOAD_PATH.unshift File.join(dir, 'lib') + +require 'mocha' +require 'puppet' +require 'rspec' +require 'spec/autorun' + +Spec::Runner.configure do |config| + config.mock_with :mocha +end + +# We need this because the RAL uses 'should' as a method. This +# allows us the same behaviour but with a different method name. +class Object + alias :must :should +end diff --git a/tests/init.pp b/tests/init.pp new file mode 100644 index 0000000..f313125 --- /dev/null +++ b/tests/init.pp @@ -0,0 +1,11 @@ +# The baseline for module testing used by Puppet Labs is that each manifest +# should have a corresponding test manifest that declares that class or defined +# type. +# +# Tests are then run by using puppet apply --noop (to check for compilation errors +# and view a log of events) or by fully applying the test in a virtual environment +# (to compare the resulting system state to the desired state). +# +# Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html +# +include avahi -- cgit v1.2.3