From 605d760dd72b7b6bd3fd54e9f6c3ffacb1b9ee52 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Thu, 10 Jul 2008 19:52:26 +1000 Subject: Moved debian to conf and updated examples directory --- examples/allatonce | 13 +++ examples/assignments | 11 ++ examples/code/allatonce | 13 --- examples/code/assignments | 11 -- examples/code/components | 73 ------------- examples/code/execs | 16 --- examples/code/file.bl | 11 -- examples/code/filedefaults | 10 -- examples/code/fileparsing | 116 --------------------- examples/code/filerecursion | 15 --- examples/code/functions | 3 - examples/code/groups | 7 -- examples/code/head | 30 ------ examples/code/importing | 8 -- examples/code/mac_automount.pp | 16 --- examples/code/mac_dscl.pp | 28 ----- examples/code/mac_dscl_revert.pp | 26 ----- examples/code/mac_netinfo.pp | 5 - examples/code/mac_pkgdmg.pp | 7 -- examples/code/modules/sample-module.pp | 10 -- examples/code/modules/sample-module/README.txt | 17 --- .../lib/puppet/parser/functions/hostname_to_dn.rb | 36 ------- .../code/modules/sample-module/manifests/init.pp | 12 --- .../modules/sample-module/templates/sample.erb | 5 - examples/code/nodes | 20 ---- examples/code/one | 8 -- examples/code/relationships | 34 ------ examples/code/selectors | 28 ----- examples/code/simpletests | 11 -- examples/code/svncommit | 13 --- examples/components | 73 +++++++++++++ examples/execs | 16 +++ examples/file.bl | 11 ++ examples/filedefaults | 10 ++ examples/fileparsing | 116 +++++++++++++++++++++ examples/filerecursion | 15 +++ examples/functions | 3 + examples/groups | 7 ++ examples/head | 30 ++++++ examples/importing | 8 ++ examples/mac_automount.pp | 16 +++ examples/mac_dscl.pp | 28 +++++ examples/mac_dscl_revert.pp | 26 +++++ examples/mac_netinfo.pp | 5 + examples/mac_pkgdmg.pp | 7 ++ examples/modules/sample-module.pp | 10 ++ examples/modules/sample-module/README.txt | 17 +++ .../lib/puppet/parser/functions/hostname_to_dn.rb | 36 +++++++ examples/modules/sample-module/manifests/init.pp | 12 +++ .../modules/sample-module/templates/sample.erb | 5 + examples/nodes | 20 ++++ examples/one | 8 ++ examples/relationships | 34 ++++++ examples/root/bin/sleeper | 67 ------------ examples/root/etc/configfile | 0 examples/root/etc/debian-passwd | 29 ------ examples/root/etc/debian-syslog.conf | 71 ------------- examples/root/etc/init.d/sleeper | 72 ------------- examples/root/etc/otherfile | 0 examples/root/etc/puppet/fileserver.conf | 13 --- examples/root/etc/puppet/namespaceauth.conf | 20 ---- examples/root/etc/puppet/puppet.conf | 10 -- examples/root/etc/puppet/tagmail.conf | 1 - examples/selectors | 28 +++++ examples/simpletests | 11 ++ examples/svncommit | 13 +++ 66 files changed, 589 insertions(+), 872 deletions(-) create mode 100644 examples/allatonce create mode 100644 examples/assignments delete mode 100644 examples/code/allatonce delete mode 100644 examples/code/assignments delete mode 100644 examples/code/components delete mode 100644 examples/code/execs delete mode 100644 examples/code/file.bl delete mode 100644 examples/code/filedefaults delete mode 100644 examples/code/fileparsing delete mode 100644 examples/code/filerecursion delete mode 100644 examples/code/functions delete mode 100644 examples/code/groups delete mode 100644 examples/code/head delete mode 100644 examples/code/importing delete mode 100644 examples/code/mac_automount.pp delete mode 100755 examples/code/mac_dscl.pp delete mode 100755 examples/code/mac_dscl_revert.pp delete mode 100755 examples/code/mac_netinfo.pp delete mode 100755 examples/code/mac_pkgdmg.pp delete mode 100644 examples/code/modules/sample-module.pp delete mode 100644 examples/code/modules/sample-module/README.txt delete mode 100644 examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb delete mode 100644 examples/code/modules/sample-module/manifests/init.pp delete mode 100644 examples/code/modules/sample-module/templates/sample.erb delete mode 100644 examples/code/nodes delete mode 100644 examples/code/one delete mode 100644 examples/code/relationships delete mode 100644 examples/code/selectors delete mode 100644 examples/code/simpletests delete mode 100644 examples/code/svncommit create mode 100644 examples/components create mode 100644 examples/execs create mode 100644 examples/file.bl create mode 100644 examples/filedefaults create mode 100644 examples/fileparsing create mode 100644 examples/filerecursion create mode 100644 examples/functions create mode 100644 examples/groups create mode 100644 examples/head create mode 100644 examples/importing create mode 100644 examples/mac_automount.pp create mode 100755 examples/mac_dscl.pp create mode 100755 examples/mac_dscl_revert.pp create mode 100755 examples/mac_netinfo.pp create mode 100755 examples/mac_pkgdmg.pp create mode 100644 examples/modules/sample-module.pp create mode 100644 examples/modules/sample-module/README.txt create mode 100644 examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb create mode 100644 examples/modules/sample-module/manifests/init.pp create mode 100644 examples/modules/sample-module/templates/sample.erb create mode 100644 examples/nodes create mode 100644 examples/one create mode 100644 examples/relationships delete mode 100755 examples/root/bin/sleeper delete mode 100644 examples/root/etc/configfile delete mode 100644 examples/root/etc/debian-passwd delete mode 100644 examples/root/etc/debian-syslog.conf delete mode 100755 examples/root/etc/init.d/sleeper delete mode 100644 examples/root/etc/otherfile delete mode 100644 examples/root/etc/puppet/fileserver.conf delete mode 100644 examples/root/etc/puppet/namespaceauth.conf delete mode 100644 examples/root/etc/puppet/puppet.conf delete mode 100644 examples/root/etc/puppet/tagmail.conf create mode 100644 examples/selectors create mode 100644 examples/simpletests create mode 100644 examples/svncommit (limited to 'examples') diff --git a/examples/allatonce b/examples/allatonce new file mode 100644 index 000000000..8912ec4e7 --- /dev/null +++ b/examples/allatonce @@ -0,0 +1,13 @@ +# $Id$ + +define thingie { + file { "/tmp/classtest": ensure => file, mode => 755 } + #testing {} +} + +class testing { + thingie { "componentname": } +} + +#component {} +testing { "testingname": } diff --git a/examples/assignments b/examples/assignments new file mode 100644 index 000000000..3edcef84e --- /dev/null +++ b/examples/assignments @@ -0,0 +1,11 @@ +# $Id$ + +$goodness = sunos + +$subvariable = $goodness + +$yayness = "this is a string of text" + +#$sleeper = service { sleeper: +# running => "1" +#} diff --git a/examples/code/allatonce b/examples/code/allatonce deleted file mode 100644 index 8912ec4e7..000000000 --- a/examples/code/allatonce +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ - -define thingie { - file { "/tmp/classtest": ensure => file, mode => 755 } - #testing {} -} - -class testing { - thingie { "componentname": } -} - -#component {} -testing { "testingname": } diff --git a/examples/code/assignments b/examples/code/assignments deleted file mode 100644 index 3edcef84e..000000000 --- a/examples/code/assignments +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ - -$goodness = sunos - -$subvariable = $goodness - -$yayness = "this is a string of text" - -#$sleeper = service { sleeper: -# running => "1" -#} diff --git a/examples/code/components b/examples/code/components deleted file mode 100644 index 3da43c571..000000000 --- a/examples/code/components +++ /dev/null @@ -1,73 +0,0 @@ -# $Id$ - -# i still have no 'require'-like functionality, and i should also -# have 'recommend'-like functionality... -define apache(php,docroot,user,group) { - package { apache: - version => "2.0.53" - } - service { apache: - running => true - } - - - # this definitely won't parse - #if $php == "true" { - # # this needs to do two things: - # # - mark a dependency - # # - cause this apache component to receive refresh events generated by php - # #require("php") - # $var = value - #} - - #file { "../examples/root/etc/configfile": - # owner => $user - #} -} - -define sudo() { - package { sudo: - version => "1.6.8p7" - } - file { "/etc/sudoers": - owner => root, - group => root, - mode => "440" - } -} - -define ssh { - package { ssh: - version => "3.4.4.4" - } - service { "sshd": - running => true - } -} - -define sleeper(path,mode) { - Service { - path => "../examples/root/etc/init.d" - } - - service { sleeper: - running => true, - path => "../examples/root/etc/init.d" - } - file { $path: - mode => $mode - } - $files = ["/tmp/testness","/tmp/funtest"] - file { $files: - ensure => file - } -} - -#apache { "test": -# php => false, -# docroot => "/export/html", -# user => "www-data", -# group => "www-data" -#} - -#ssh { "yucko":} diff --git a/examples/code/execs b/examples/code/execs deleted file mode 100644 index 44f133098..000000000 --- a/examples/code/execs +++ /dev/null @@ -1,16 +0,0 @@ -$path = "/usr/bin:/bin" - -exec { "mkdir -p /tmp/fakedir": - path => $path -} - -exec { "rm -rf /tmp/fakedir": - path => $path -} - -exec { "touch /this/directory/does/not/exist": - path => $path, - returns => 1 -} - - diff --git a/examples/code/file.bl b/examples/code/file.bl deleted file mode 100644 index ef46ba223..000000000 --- a/examples/code/file.bl +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ - -file { - "/tmp/atest": ensure => file, mode => 755; - "/tmp/btest": ensure => file, mode => 755 -} - -file { - "/tmp/ctest": ensure => file; - "/tmp/dtest": ensure => file; -} diff --git a/examples/code/filedefaults b/examples/code/filedefaults deleted file mode 100644 index 56cf76a9a..000000000 --- a/examples/code/filedefaults +++ /dev/null @@ -1,10 +0,0 @@ -# $Id$ - -File { - mode => 755, - recurse => true -} - -file { "/tmp/filedefaultstest": - ensure => file -} diff --git a/examples/code/fileparsing b/examples/code/fileparsing deleted file mode 100644 index f9766b9f6..000000000 --- a/examples/code/fileparsing +++ /dev/null @@ -1,116 +0,0 @@ -# $Id$ - -# this will eventually parse different config files - -# this creates the 'passwd' type, but it does not create any instances -filetype { "passwd": - linesplit => "\n", - escapednewlines => false -} - - -# this creates the 'PasswdUser' type, but again, no instances -filerecord { "user": - filetype => passwd, - fields => [name, password, uid, gid, gcos, home, shell], - namevar => name, - splitchar => ":" - -} - -filetype { ini: - linesplit => "\n\n" -} - -# ini files are different because we don't really care about validating fields -# or at least, we can't do it for most files... -filerecord { "initrecord": - filetype => ini, - fields => [name, password, uid, gid, gcos, home, shell], - namevar => name, - splitchar => ":" - -} - -# this won't work for multiple record types, will it? -# or at least, it requires that we specify multiple times -# ah, and it doesn't specify which of the available record types -# it works for... -passwd { user: - complete => true, # manage the whole file - path => "/etc/passwd" -} - -user { yaytest: - password => x, - uid => 10000, - gid => 10000, - home => "/home/yaytest", - gcos => "The Yaytest", - shell => "/bin/sh" -} - # there seems to be an intrinsic problem here -- i've got subtypes that only - # make sense when an instance of the super type already exists, and i need - # to associate the instances of the subtype with the instances of the supertype - # even if i created the parsers manually, I'd have the same problem - -# this is the crux of it -- i want to be able to say 'user' here without having -# to specify the file, which leaves two options: -# 1) associate the record type with a filetype instance (BAD) -# 2) once the filetype and record type are created, have another command -# that specifically creates a filetype instance and gives names for instances -# of its record types - -define syslog { - - # create a new type, with all defaults - filetype { "syslog": - escapednewlines => true - } - - filerecord { "log": - filetype => syslog, - regex => "^([^#\s]+)\s+(\S+)$", - joinchar => "\t", - fields => [logs, dest] - } - - # these two should just be supported within the filetypes - filerecord { "comment": - filetype => syslog, - regex => "^(#.*)$", - joinchar => "s", - fields => [comment] - } - - filerecord { "blank": - filetype => syslog, - regex => "^(\s*)$", - joinchar => "s", - fields => blank - } -} - -define cron { - filetype { "usercrontab": - } - - # this won't actually work, of course - filerecord { "cronjob": - filetype => crontab, - regex => "^([^#\s]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$", - joinchar => " ", - fields => [minute, hour, day, month, weekday, command], - defaults => ["*", "*", "*", "*", "*", nil], - optional => [minute, hour, day, month, weekday] - } - - crontab { "luke": - } -} - -# XXX this doesn't work in the slightest -define crontab(name,path) { - usercrontab { "${path}/${name}": - } -} diff --git a/examples/code/filerecursion b/examples/code/filerecursion deleted file mode 100644 index b7d8278c2..000000000 --- a/examples/code/filerecursion +++ /dev/null @@ -1,15 +0,0 @@ -# $Id$ - -file { "/tmp/dirtest/b/a": - mode => 755, -} - -file { "/tmp/dirtest": - mode => 755, - recurse => true, -} - -file { "/tmp/dirtest/b/b": - mode => 644, -} - diff --git a/examples/code/functions b/examples/code/functions deleted file mode 100644 index 8e95c3a72..000000000 --- a/examples/code/functions +++ /dev/null @@ -1,3 +0,0 @@ -# $Id$ - -$yaytest = fact("operatingsystem") diff --git a/examples/code/groups b/examples/code/groups deleted file mode 100644 index 35505a2eb..000000000 --- a/examples/code/groups +++ /dev/null @@ -1,7 +0,0 @@ -# $Id$ - -# there need to be two forms of adding to groups: -# add the current host to a group, and add a list of hosts to a -# group by name - -$group = "crap" diff --git a/examples/code/head b/examples/code/head deleted file mode 100644 index 59cbb6593..000000000 --- a/examples/code/head +++ /dev/null @@ -1,30 +0,0 @@ -# $Id$ - -# this file is responsible for importing all of the files we want to actually test - -# these are all of the simple tests -import "simpletests" -import "assignments" -import "selectors" -#import "iftest" -import "importing" -import "execs" -import "filedefaults" - -# facts are now imported into the top of the namespace -#import "facts" - -# obsoleted -#import "functions" - -# files we no longer need to import directly, or at all in some cases -#import "one" -#import "classing" -#import "components" -#import "file.bl" -#import "fileparsing.disabled" -#import "groups" - -# this imports the more complex files -import "allatonce" # imports classing and components -import "nodes" # imports classing and components diff --git a/examples/code/importing b/examples/code/importing deleted file mode 100644 index f02604109..000000000 --- a/examples/code/importing +++ /dev/null @@ -1,8 +0,0 @@ -# $Id$ - -#import "groups" -# testing import loops -import "importing" - -$name = "value" -$system = $operatingsystem diff --git a/examples/code/mac_automount.pp b/examples/code/mac_automount.pp deleted file mode 100644 index bab0136fc..000000000 --- a/examples/code/mac_automount.pp +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env puppet -# Jeff McCune -# -# Apple's Automounter spawns a child that sends the parent -# a SIGTERM. This makes it *very* difficult to figure out -# if the process started correctly or not. -# - -service {"automount-test": - provider => base, - hasrestart => false, - pattern => '/tmp/hometest', - start => "/usr/sbin/automount -m /tmp/home /dev/null -mnt /tmp/hometest", - stop => "ps auxww | grep '/tmp/hometest' | grep -v grep | awk '{print \$2}' | xargs kill", - ensure => running -} diff --git a/examples/code/mac_dscl.pp b/examples/code/mac_dscl.pp deleted file mode 100755 index ff59f9d8d..000000000 --- a/examples/code/mac_dscl.pp +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env puppet --debug --verbose --trace -# -# Jeff McCune: I use this for developing and testing the directory service -# provider. - -User { provider => "directoryservice" } -Group { provider => "directoryservice" } - -user { - "testgone": - ensure => absent, - uid => 550; - "testhere": - ensure => present, - password => "foobar", - shell => "/bin/bash", - uid => 551; -} - -group { - "testgone": - ensure => absent, - gid => 550; - "testhere": - ensure => present, - gid => 551; - -} \ No newline at end of file diff --git a/examples/code/mac_dscl_revert.pp b/examples/code/mac_dscl_revert.pp deleted file mode 100755 index c9bd2b541..000000000 --- a/examples/code/mac_dscl_revert.pp +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env puppet --debug --verbose --trace -# -# Jeff McCune: I use this for developing and testing the directory service -# provider. - -User { provider => "directoryservice" } -Group { provider => "directoryservice" } - -user { - "testgone": - ensure => absent, - uid => 550; - "testhere": - ensure => absent, - uid => 551; -} - -group { - "testgone": - ensure => absent, - gid => 550; - "testhere": - ensure => absent, - gid => 551; - -} diff --git a/examples/code/mac_netinfo.pp b/examples/code/mac_netinfo.pp deleted file mode 100755 index 544b64818..000000000 --- a/examples/code/mac_netinfo.pp +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env puppet --debug - -user { - "jmccune": provider => "netinfo", ensure => present; -} diff --git a/examples/code/mac_pkgdmg.pp b/examples/code/mac_pkgdmg.pp deleted file mode 100755 index a2499e815..000000000 --- a/examples/code/mac_pkgdmg.pp +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env puppet -# - -package -{ - "Foobar.pkg.dmg": ensure => present, provider => pkgdmg; -} diff --git a/examples/code/modules/sample-module.pp b/examples/code/modules/sample-module.pp deleted file mode 100644 index 57079a0aa..000000000 --- a/examples/code/modules/sample-module.pp +++ /dev/null @@ -1,10 +0,0 @@ -# Jeff McCune -# 2007-08-14 -# -# Use: -# puppet --verbose --debug --modulepath=`pwd` ./sample-module.pp -# -# sample-module demonstrates the use of a custom language function -# included within the module bundle. - -include sample-module diff --git a/examples/code/modules/sample-module/README.txt b/examples/code/modules/sample-module/README.txt deleted file mode 100644 index ee4b8201a..000000000 --- a/examples/code/modules/sample-module/README.txt +++ /dev/null @@ -1,17 +0,0 @@ -Jeff McCune -2007-08-14 - -This small, sample module demonstrates how to extend the puppet language -with a new parser function. - -See: -manifests/init.pp -lib/puppet/parser/functions/hostname_to_dn.rb -templates/sample.erb - -Note the consistent naming of files for Puppet::Util::Autoload - -Reference Documents: -http://reductivelabs.com/trac/puppet/wiki/ModuleOrganisation -http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions -http://reductivelabs.com/trac/puppet/wiki/FunctionReference diff --git a/examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb b/examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb deleted file mode 100644 index 9f732b5bc..000000000 --- a/examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) David Schmitt -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the Author nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -# Jeff McCune -# 2007-08-14 -# See: http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions - -module Puppet::Parser::Functions - newfunction(:hostname_to_dn, :type => :rvalue, :doc => "Given 'foo.bar.com', return 'dc=foo,dc=bar,dc=com'.") do |args| - args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") - end -end diff --git a/examples/code/modules/sample-module/manifests/init.pp b/examples/code/modules/sample-module/manifests/init.pp deleted file mode 100644 index 1af8dff1f..000000000 --- a/examples/code/modules/sample-module/manifests/init.pp +++ /dev/null @@ -1,12 +0,0 @@ -# Jeff McCune -# -# Demonstration of a custom parser function and erb template within -# a module, working in concert. - -class sample-module { - $fqdn_to_dn = hostname_to_dn($domain) - $sample_template = template("sample-module/sample.erb") - - notice("hostname_to_dn module function returned: [$fqdn_to_dn]") - info("sample.erb looks like:\n$sample_template") -} diff --git a/examples/code/modules/sample-module/templates/sample.erb b/examples/code/modules/sample-module/templates/sample.erb deleted file mode 100644 index b13561b45..000000000 --- a/examples/code/modules/sample-module/templates/sample.erb +++ /dev/null @@ -1,5 +0,0 @@ - -## Jeff McCune -fqdn: <%= fqdn %> -basedn: <%= fqdn_to_dn %> -## end sample.erb ## diff --git a/examples/code/nodes b/examples/code/nodes deleted file mode 100644 index 42488e689..000000000 --- a/examples/code/nodes +++ /dev/null @@ -1,20 +0,0 @@ -# $Id$ - -# define nodes - -#service.setpath("../examples/root/etc/init.d") - -Service { - path => "../examples/root/etc/init.d" -} - -import "classing" - -sleepserver { - path => $operatingsystem ? { - sunos => "../examples/root/etc/configfile", - hpux => "../examples/other/etc/configfile", - default => "../examples/root/etc/configfile" - }, - schedule => true -} diff --git a/examples/code/one b/examples/code/one deleted file mode 100644 index 452d32f3e..000000000 --- a/examples/code/one +++ /dev/null @@ -1,8 +0,0 @@ -# $Id$ - -# this service doesn't actually exist, so we noop it -# and this way, we can test noop :) -service { "funtest": - running => "0", - noop => true -} diff --git a/examples/code/relationships b/examples/code/relationships deleted file mode 100644 index 795788947..000000000 --- a/examples/code/relationships +++ /dev/null @@ -1,34 +0,0 @@ -# $Id$ - -#service.setpath("../examples/root/etc/init.d") -#puppet.statefile("/tmp/puppetstate") -$path = "../examples/root/etc/configfile" - path => "../examples/root/etc/init.d" - - -define files { - file { "/tmp/yaytest": - ensure => file, - mode => 755 - } - file { "/tmp/exists": - checksum => md5 - } -} - -define sleeper { - file { $path: - mode => 755 - } - service { sleeper: - path => "../examples/root/etc/init.d", - running => 1 - } -} - -files { } - -sleeper { - require => files["yay"], - schedule => true -} diff --git a/examples/code/selectors b/examples/code/selectors deleted file mode 100644 index a70399bc7..000000000 --- a/examples/code/selectors +++ /dev/null @@ -1,28 +0,0 @@ -# $Id$ -# - -$platform = SunOS - -$funtest = $platform ? { - SunOS => yayness, - AIX => goodness, - default => badness -} - -# this is a comment - -$filename = "/tmp/yayness" - -$sleeper = file { $filename: - mode => $platform ? { - SunOS => 644, - default => 755 - }, - create => $platform ? "SunOS" => true -} - -# i guess it has to be solved this way... - -#$platform ? sunos => file { $filename: -# mode => 644 -#} diff --git a/examples/code/simpletests b/examples/code/simpletests deleted file mode 100644 index b4fd3234e..000000000 --- a/examples/code/simpletests +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ - -file { - "/tmp/atest": ensure => file; - "/tmp/btest": ensure => file -} - -file { - "/tmp/ctest": ensure => file; - "/tmp/dtest": ensure => file; -} diff --git a/examples/code/svncommit b/examples/code/svncommit deleted file mode 100644 index 350cd8580..000000000 --- a/examples/code/svncommit +++ /dev/null @@ -1,13 +0,0 @@ -$path = "/usr/bin:/bin" - -file { "/tmp/svntests": - recurse => true, - checksum => md5 -} - -exec { "echo 'files have been updated'": - cwd => "/tmp/svntests", - refreshonly => true, - require => file["/tmp/svntests"], - path => $path -} diff --git a/examples/components b/examples/components new file mode 100644 index 000000000..3da43c571 --- /dev/null +++ b/examples/components @@ -0,0 +1,73 @@ +# $Id$ + +# i still have no 'require'-like functionality, and i should also +# have 'recommend'-like functionality... +define apache(php,docroot,user,group) { + package { apache: + version => "2.0.53" + } + service { apache: + running => true + } + + + # this definitely won't parse + #if $php == "true" { + # # this needs to do two things: + # # - mark a dependency + # # - cause this apache component to receive refresh events generated by php + # #require("php") + # $var = value + #} + + #file { "../examples/root/etc/configfile": + # owner => $user + #} +} + +define sudo() { + package { sudo: + version => "1.6.8p7" + } + file { "/etc/sudoers": + owner => root, + group => root, + mode => "440" + } +} + +define ssh { + package { ssh: + version => "3.4.4.4" + } + service { "sshd": + running => true + } +} + +define sleeper(path,mode) { + Service { + path => "../examples/root/etc/init.d" + } + + service { sleeper: + running => true, + path => "../examples/root/etc/init.d" + } + file { $path: + mode => $mode + } + $files = ["/tmp/testness","/tmp/funtest"] + file { $files: + ensure => file + } +} + +#apache { "test": +# php => false, +# docroot => "/export/html", +# user => "www-data", +# group => "www-data" +#} + +#ssh { "yucko":} diff --git a/examples/execs b/examples/execs new file mode 100644 index 000000000..44f133098 --- /dev/null +++ b/examples/execs @@ -0,0 +1,16 @@ +$path = "/usr/bin:/bin" + +exec { "mkdir -p /tmp/fakedir": + path => $path +} + +exec { "rm -rf /tmp/fakedir": + path => $path +} + +exec { "touch /this/directory/does/not/exist": + path => $path, + returns => 1 +} + + diff --git a/examples/file.bl b/examples/file.bl new file mode 100644 index 000000000..ef46ba223 --- /dev/null +++ b/examples/file.bl @@ -0,0 +1,11 @@ +# $Id$ + +file { + "/tmp/atest": ensure => file, mode => 755; + "/tmp/btest": ensure => file, mode => 755 +} + +file { + "/tmp/ctest": ensure => file; + "/tmp/dtest": ensure => file; +} diff --git a/examples/filedefaults b/examples/filedefaults new file mode 100644 index 000000000..56cf76a9a --- /dev/null +++ b/examples/filedefaults @@ -0,0 +1,10 @@ +# $Id$ + +File { + mode => 755, + recurse => true +} + +file { "/tmp/filedefaultstest": + ensure => file +} diff --git a/examples/fileparsing b/examples/fileparsing new file mode 100644 index 000000000..f9766b9f6 --- /dev/null +++ b/examples/fileparsing @@ -0,0 +1,116 @@ +# $Id$ + +# this will eventually parse different config files + +# this creates the 'passwd' type, but it does not create any instances +filetype { "passwd": + linesplit => "\n", + escapednewlines => false +} + + +# this creates the 'PasswdUser' type, but again, no instances +filerecord { "user": + filetype => passwd, + fields => [name, password, uid, gid, gcos, home, shell], + namevar => name, + splitchar => ":" + +} + +filetype { ini: + linesplit => "\n\n" +} + +# ini files are different because we don't really care about validating fields +# or at least, we can't do it for most files... +filerecord { "initrecord": + filetype => ini, + fields => [name, password, uid, gid, gcos, home, shell], + namevar => name, + splitchar => ":" + +} + +# this won't work for multiple record types, will it? +# or at least, it requires that we specify multiple times +# ah, and it doesn't specify which of the available record types +# it works for... +passwd { user: + complete => true, # manage the whole file + path => "/etc/passwd" +} + +user { yaytest: + password => x, + uid => 10000, + gid => 10000, + home => "/home/yaytest", + gcos => "The Yaytest", + shell => "/bin/sh" +} + # there seems to be an intrinsic problem here -- i've got subtypes that only + # make sense when an instance of the super type already exists, and i need + # to associate the instances of the subtype with the instances of the supertype + # even if i created the parsers manually, I'd have the same problem + +# this is the crux of it -- i want to be able to say 'user' here without having +# to specify the file, which leaves two options: +# 1) associate the record type with a filetype instance (BAD) +# 2) once the filetype and record type are created, have another command +# that specifically creates a filetype instance and gives names for instances +# of its record types + +define syslog { + + # create a new type, with all defaults + filetype { "syslog": + escapednewlines => true + } + + filerecord { "log": + filetype => syslog, + regex => "^([^#\s]+)\s+(\S+)$", + joinchar => "\t", + fields => [logs, dest] + } + + # these two should just be supported within the filetypes + filerecord { "comment": + filetype => syslog, + regex => "^(#.*)$", + joinchar => "s", + fields => [comment] + } + + filerecord { "blank": + filetype => syslog, + regex => "^(\s*)$", + joinchar => "s", + fields => blank + } +} + +define cron { + filetype { "usercrontab": + } + + # this won't actually work, of course + filerecord { "cronjob": + filetype => crontab, + regex => "^([^#\s]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$", + joinchar => " ", + fields => [minute, hour, day, month, weekday, command], + defaults => ["*", "*", "*", "*", "*", nil], + optional => [minute, hour, day, month, weekday] + } + + crontab { "luke": + } +} + +# XXX this doesn't work in the slightest +define crontab(name,path) { + usercrontab { "${path}/${name}": + } +} diff --git a/examples/filerecursion b/examples/filerecursion new file mode 100644 index 000000000..b7d8278c2 --- /dev/null +++ b/examples/filerecursion @@ -0,0 +1,15 @@ +# $Id$ + +file { "/tmp/dirtest/b/a": + mode => 755, +} + +file { "/tmp/dirtest": + mode => 755, + recurse => true, +} + +file { "/tmp/dirtest/b/b": + mode => 644, +} + diff --git a/examples/functions b/examples/functions new file mode 100644 index 000000000..8e95c3a72 --- /dev/null +++ b/examples/functions @@ -0,0 +1,3 @@ +# $Id$ + +$yaytest = fact("operatingsystem") diff --git a/examples/groups b/examples/groups new file mode 100644 index 000000000..35505a2eb --- /dev/null +++ b/examples/groups @@ -0,0 +1,7 @@ +# $Id$ + +# there need to be two forms of adding to groups: +# add the current host to a group, and add a list of hosts to a +# group by name + +$group = "crap" diff --git a/examples/head b/examples/head new file mode 100644 index 000000000..59cbb6593 --- /dev/null +++ b/examples/head @@ -0,0 +1,30 @@ +# $Id$ + +# this file is responsible for importing all of the files we want to actually test + +# these are all of the simple tests +import "simpletests" +import "assignments" +import "selectors" +#import "iftest" +import "importing" +import "execs" +import "filedefaults" + +# facts are now imported into the top of the namespace +#import "facts" + +# obsoleted +#import "functions" + +# files we no longer need to import directly, or at all in some cases +#import "one" +#import "classing" +#import "components" +#import "file.bl" +#import "fileparsing.disabled" +#import "groups" + +# this imports the more complex files +import "allatonce" # imports classing and components +import "nodes" # imports classing and components diff --git a/examples/importing b/examples/importing new file mode 100644 index 000000000..f02604109 --- /dev/null +++ b/examples/importing @@ -0,0 +1,8 @@ +# $Id$ + +#import "groups" +# testing import loops +import "importing" + +$name = "value" +$system = $operatingsystem diff --git a/examples/mac_automount.pp b/examples/mac_automount.pp new file mode 100644 index 000000000..bab0136fc --- /dev/null +++ b/examples/mac_automount.pp @@ -0,0 +1,16 @@ +#!/usr/bin/env puppet +# Jeff McCune +# +# Apple's Automounter spawns a child that sends the parent +# a SIGTERM. This makes it *very* difficult to figure out +# if the process started correctly or not. +# + +service {"automount-test": + provider => base, + hasrestart => false, + pattern => '/tmp/hometest', + start => "/usr/sbin/automount -m /tmp/home /dev/null -mnt /tmp/hometest", + stop => "ps auxww | grep '/tmp/hometest' | grep -v grep | awk '{print \$2}' | xargs kill", + ensure => running +} diff --git a/examples/mac_dscl.pp b/examples/mac_dscl.pp new file mode 100755 index 000000000..ff59f9d8d --- /dev/null +++ b/examples/mac_dscl.pp @@ -0,0 +1,28 @@ +#!/usr/bin/env puppet --debug --verbose --trace +# +# Jeff McCune: I use this for developing and testing the directory service +# provider. + +User { provider => "directoryservice" } +Group { provider => "directoryservice" } + +user { + "testgone": + ensure => absent, + uid => 550; + "testhere": + ensure => present, + password => "foobar", + shell => "/bin/bash", + uid => 551; +} + +group { + "testgone": + ensure => absent, + gid => 550; + "testhere": + ensure => present, + gid => 551; + +} \ No newline at end of file diff --git a/examples/mac_dscl_revert.pp b/examples/mac_dscl_revert.pp new file mode 100755 index 000000000..c9bd2b541 --- /dev/null +++ b/examples/mac_dscl_revert.pp @@ -0,0 +1,26 @@ +#!/usr/bin/env puppet --debug --verbose --trace +# +# Jeff McCune: I use this for developing and testing the directory service +# provider. + +User { provider => "directoryservice" } +Group { provider => "directoryservice" } + +user { + "testgone": + ensure => absent, + uid => 550; + "testhere": + ensure => absent, + uid => 551; +} + +group { + "testgone": + ensure => absent, + gid => 550; + "testhere": + ensure => absent, + gid => 551; + +} diff --git a/examples/mac_netinfo.pp b/examples/mac_netinfo.pp new file mode 100755 index 000000000..544b64818 --- /dev/null +++ b/examples/mac_netinfo.pp @@ -0,0 +1,5 @@ +#!/usr/bin/env puppet --debug + +user { + "jmccune": provider => "netinfo", ensure => present; +} diff --git a/examples/mac_pkgdmg.pp b/examples/mac_pkgdmg.pp new file mode 100755 index 000000000..a2499e815 --- /dev/null +++ b/examples/mac_pkgdmg.pp @@ -0,0 +1,7 @@ +#!/usr/bin/env puppet +# + +package +{ + "Foobar.pkg.dmg": ensure => present, provider => pkgdmg; +} diff --git a/examples/modules/sample-module.pp b/examples/modules/sample-module.pp new file mode 100644 index 000000000..57079a0aa --- /dev/null +++ b/examples/modules/sample-module.pp @@ -0,0 +1,10 @@ +# Jeff McCune +# 2007-08-14 +# +# Use: +# puppet --verbose --debug --modulepath=`pwd` ./sample-module.pp +# +# sample-module demonstrates the use of a custom language function +# included within the module bundle. + +include sample-module diff --git a/examples/modules/sample-module/README.txt b/examples/modules/sample-module/README.txt new file mode 100644 index 000000000..ee4b8201a --- /dev/null +++ b/examples/modules/sample-module/README.txt @@ -0,0 +1,17 @@ +Jeff McCune +2007-08-14 + +This small, sample module demonstrates how to extend the puppet language +with a new parser function. + +See: +manifests/init.pp +lib/puppet/parser/functions/hostname_to_dn.rb +templates/sample.erb + +Note the consistent naming of files for Puppet::Util::Autoload + +Reference Documents: +http://reductivelabs.com/trac/puppet/wiki/ModuleOrganisation +http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions +http://reductivelabs.com/trac/puppet/wiki/FunctionReference diff --git a/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb b/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb new file mode 100644 index 000000000..9f732b5bc --- /dev/null +++ b/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb @@ -0,0 +1,36 @@ +# Copyright (C) David Schmitt +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the Author nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# Jeff McCune +# 2007-08-14 +# See: http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions + +module Puppet::Parser::Functions + newfunction(:hostname_to_dn, :type => :rvalue, :doc => "Given 'foo.bar.com', return 'dc=foo,dc=bar,dc=com'.") do |args| + args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") + end +end diff --git a/examples/modules/sample-module/manifests/init.pp b/examples/modules/sample-module/manifests/init.pp new file mode 100644 index 000000000..1af8dff1f --- /dev/null +++ b/examples/modules/sample-module/manifests/init.pp @@ -0,0 +1,12 @@ +# Jeff McCune +# +# Demonstration of a custom parser function and erb template within +# a module, working in concert. + +class sample-module { + $fqdn_to_dn = hostname_to_dn($domain) + $sample_template = template("sample-module/sample.erb") + + notice("hostname_to_dn module function returned: [$fqdn_to_dn]") + info("sample.erb looks like:\n$sample_template") +} diff --git a/examples/modules/sample-module/templates/sample.erb b/examples/modules/sample-module/templates/sample.erb new file mode 100644 index 000000000..b13561b45 --- /dev/null +++ b/examples/modules/sample-module/templates/sample.erb @@ -0,0 +1,5 @@ + +## Jeff McCune +fqdn: <%= fqdn %> +basedn: <%= fqdn_to_dn %> +## end sample.erb ## diff --git a/examples/nodes b/examples/nodes new file mode 100644 index 000000000..42488e689 --- /dev/null +++ b/examples/nodes @@ -0,0 +1,20 @@ +# $Id$ + +# define nodes + +#service.setpath("../examples/root/etc/init.d") + +Service { + path => "../examples/root/etc/init.d" +} + +import "classing" + +sleepserver { + path => $operatingsystem ? { + sunos => "../examples/root/etc/configfile", + hpux => "../examples/other/etc/configfile", + default => "../examples/root/etc/configfile" + }, + schedule => true +} diff --git a/examples/one b/examples/one new file mode 100644 index 000000000..452d32f3e --- /dev/null +++ b/examples/one @@ -0,0 +1,8 @@ +# $Id$ + +# this service doesn't actually exist, so we noop it +# and this way, we can test noop :) +service { "funtest": + running => "0", + noop => true +} diff --git a/examples/relationships b/examples/relationships new file mode 100644 index 000000000..795788947 --- /dev/null +++ b/examples/relationships @@ -0,0 +1,34 @@ +# $Id$ + +#service.setpath("../examples/root/etc/init.d") +#puppet.statefile("/tmp/puppetstate") +$path = "../examples/root/etc/configfile" + path => "../examples/root/etc/init.d" + + +define files { + file { "/tmp/yaytest": + ensure => file, + mode => 755 + } + file { "/tmp/exists": + checksum => md5 + } +} + +define sleeper { + file { $path: + mode => 755 + } + service { sleeper: + path => "../examples/root/etc/init.d", + running => 1 + } +} + +files { } + +sleeper { + require => files["yay"], + schedule => true +} diff --git a/examples/root/bin/sleeper b/examples/root/bin/sleeper deleted file mode 100755 index 980d66ac1..000000000 --- a/examples/root/bin/sleeper +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby -w - -### -# sleep indefinitely as a debug - -require 'getoptlong' - -#----------------------------------------------------------------- -def daemonize - outfile = "/tmp/sleeperout" - if pid = fork() - Process.detach(pid) - sleep 1 - # verify that we didn't have any problems starting the daemon - if FileTest.exists?(outfile) - $stderr.puts "Sleeper failed: %s" % File.read(outfile) - File.unlink(outfile) - exit(14) - else - exit(0) - end - end - Process.setsid - Dir.chdir("/") - begin - $stdin.reopen "/dev/null" - $stdout.reopen "/dev/null", "a" - $stderr.reopen $stdin - rescue => detail - File.open(outfile, "w") { |f| - f.puts detail - } - exit(12) - end -end -#----------------------------------------------------------------- - -debug = false - -result = GetoptLong.new( - [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], - [ "--help", "-h", GetoptLong::NO_ARGUMENT ] -) - -result.each { |opt,arg| - case opt - when "--help" - puts "There is no help yet" - exit - when "--debug" - debug = true - else - raise "Invalid option '#{opt}'" - end -} - -trap(:INT) { - exit -} - -unless debug - daemonize() -end - -# Sleep for no more than two minutes -sleep 120 -exit diff --git a/examples/root/etc/configfile b/examples/root/etc/configfile deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/root/etc/debian-passwd b/examples/root/etc/debian-passwd deleted file mode 100644 index 59cdf4acf..000000000 --- a/examples/root/etc/debian-passwd +++ /dev/null @@ -1,29 +0,0 @@ -root:x:0:0:root:/root:/bin/bash -daemon:x:1:1:daemon:/usr/sbin:/bin/sh -bin:x:2:2:bin:/bin:/bin/sh -sys:x:3:3:sys:/dev:/bin/sh -sync:x:4:65534:sync:/bin:/bin/sync -games:x:5:60:games:/usr/games:/bin/sh -man:x:6:12:man:/var/cache/man:/bin/sh -lp:x:7:7:lp:/var/spool/lpd:/bin/sh -mail:x:8:8:mail:/var/mail:/bin/sh -news:x:9:9:news:/var/spool/news:/bin/sh -uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh -proxy:x:13:13:proxy:/bin:/bin/sh -postgres:x:31:32:postgres:/var/lib/postgres:/bin/sh -www-data:x:33:33:www-data:/var/www:/bin/sh -backup:x:34:34:backup:/var/backups:/bin/sh -operator:x:37:37:Operator:/var:/bin/sh -list:x:38:38:Mailing List Manager:/var/list:/bin/sh -irc:x:39:39:ircd:/var/run/ircd:/bin/sh -gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh -nobody:x:65534:65534:nobody:/nonexistent:/bin/sh -sshd:x:102:65534::/var/run/sshd:/bin/false -gdm:x:101:101:Gnome Display Manager:/var/lib/gdm:/bin/false -telnetd:x:103:103::/usr/lib/telnetd:/bin/false -nagios:x:1000:1001::/home/nagios: -messagebus:x:104:107::/var/run/dbus:/bin/false -saned:x:109:109::/home/saned:/bin/false -ganglia:x:105:110:Ganglia Monitor:/var/lib/ganglia:/bin/false -zope:x:106:111::/var/lib/zope2.7/var:/bin/false -fbgetty:x:112:112::/home/fbgetty:/bin/false diff --git a/examples/root/etc/debian-syslog.conf b/examples/root/etc/debian-syslog.conf deleted file mode 100644 index 8f2925960..000000000 --- a/examples/root/etc/debian-syslog.conf +++ /dev/null @@ -1,71 +0,0 @@ -# /etc/syslog.conf Configuration file for syslogd. -# -# For more information see syslog.conf(5) -# manpage. - -# -# First some standard logfiles. Log by facility. -# - -auth,authpriv.* /var/log/auth.log -*.*;auth,authpriv.none -/var/log/syslog -#cron.* /var/log/cron.log -daemon.* -/var/log/daemon.log -kern.* -/var/log/kern.log -lpr.* -/var/log/lpr.log -mail.* -/var/log/mail.log -user.* -/var/log/user.log -uucp.* /var/log/uucp.log - -# -# Logging for the mail system. Split it up so that -# it is easy to write scripts to parse these files. -# -mail.info -/var/log/mail.info -mail.warn -/var/log/mail.warn -mail.err /var/log/mail.err - -# Logging for INN news system -# -news.crit /var/log/news/news.crit -news.err /var/log/news/news.err -news.notice -/var/log/news/news.notice - -# -# Some `catch-all' logfiles. -# -*.=debug;\ - auth,authpriv.none;\ - news.none;mail.none -/var/log/debug -*.=info;*.=notice;*.=warn;\ - auth,authpriv.none;\ - cron,daemon.none;\ - mail,news.none -/var/log/messages - -# -# Emergencies are sent to everybody logged in. -# -*.emerg * - -# -# I like to have messages displayed on the console, but only on a virtual -# console I usually leave idle. -# -#daemon,mail.*;\ -# news.=crit;news.=err;news.=notice;\ -# *.=debug;*.=info;\ -# *.=notice;*.=warn /dev/tty8 - -# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, -# you must invoke `xconsole' with the `-file' option: -# -# $ xconsole -file /dev/xconsole [...] -# -# NOTE: adjust the list below, or you'll go crazy if you have a reasonably -# busy site.. -# -daemon.*;mail.*;\ - news.crit;news.err;news.notice;\ - *.=debug;*.=info;\ - *.=notice;*.=warn |/dev/xconsole - diff --git a/examples/root/etc/init.d/sleeper b/examples/root/etc/init.d/sleeper deleted file mode 100755 index 6da5eae32..000000000 --- a/examples/root/etc/init.d/sleeper +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# $Id$ - -script=$0 -path=`echo $script | sed 's/etc..*/bin/'` - -PATH=$PATH:$path - -ps=`facter ps` - -if [ -z "$ps" ]; then - ps="ps -ef" -fi - -function start -{ - cd $path - ./sleeper -} - -function stop -{ - #if [ -n `which pgrep` ]; then - # pid=`pgrep sleeper` - #else - pid=`$ps | grep -v grep | grep sleeper | grep ruby | awk '{print $2}'` - #fi - if [ -n "$pid" ]; then - kill $pid - fi -} - -function restart -{ - stop - start -} - -function status -{ - #if [ -n `which pgrep` ]; then - # cmd="pgrep sleeper" - #else - #cmd="$ps | grep -v grep | grep sleeper | grep ruby | awk '{print $2}'" - #fi - #$cmd - $ps | grep -v grep | grep sleeper | grep ruby -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop; start - ;; - status) - output=`status` - #status - exit $? - ;; - *) - echo "Usage: $N {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/examples/root/etc/otherfile b/examples/root/etc/otherfile deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/root/etc/puppet/fileserver.conf b/examples/root/etc/puppet/fileserver.conf deleted file mode 100644 index 32dfcdd5c..000000000 --- a/examples/root/etc/puppet/fileserver.conf +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ - -[dist] - path /dist - allow *.madstop.com - -[plugins] - path /var/puppet/plugins - allow *.madstop.com - -[facts] - path /var/puppet/facts - allow *.madstop.com diff --git a/examples/root/etc/puppet/namespaceauth.conf b/examples/root/etc/puppet/namespaceauth.conf deleted file mode 100644 index fb08d428b..000000000 --- a/examples/root/etc/puppet/namespaceauth.conf +++ /dev/null @@ -1,20 +0,0 @@ -# This file is only necessary if your clients listen. -# Note that it affects all puppet daemons, including puppetmasterd, -# which is why puppetmaster is in there. -[fileserver] - allow *.madstop.com - -[puppetmaster] - allow *.madstop.com - -[pelementserver] - allow puppet.madstop.com - -[puppetrunner] - allow culain.madstop.com - -[puppetbucket] - allow *.madstop.com - -[puppetreports] - allow *.madstop.com diff --git a/examples/root/etc/puppet/puppet.conf b/examples/root/etc/puppet/puppet.conf deleted file mode 100644 index 151364ebd..000000000 --- a/examples/root/etc/puppet/puppet.conf +++ /dev/null @@ -1,10 +0,0 @@ -[puppetd] -report = true -factsync = true -pluginsync = true - -[puppetmasterd] -reports = store,rrdgraph,tagmail,log -node_terminus = ldap -ldapserver = culain.madstop.com -ldapbase = dc=madstop,dc=com diff --git a/examples/root/etc/puppet/tagmail.conf b/examples/root/etc/puppet/tagmail.conf deleted file mode 100644 index 31c77f4bc..000000000 --- a/examples/root/etc/puppet/tagmail.conf +++ /dev/null @@ -1 +0,0 @@ -all: user@domain.com diff --git a/examples/selectors b/examples/selectors new file mode 100644 index 000000000..a70399bc7 --- /dev/null +++ b/examples/selectors @@ -0,0 +1,28 @@ +# $Id$ +# + +$platform = SunOS + +$funtest = $platform ? { + SunOS => yayness, + AIX => goodness, + default => badness +} + +# this is a comment + +$filename = "/tmp/yayness" + +$sleeper = file { $filename: + mode => $platform ? { + SunOS => 644, + default => 755 + }, + create => $platform ? "SunOS" => true +} + +# i guess it has to be solved this way... + +#$platform ? sunos => file { $filename: +# mode => 644 +#} diff --git a/examples/simpletests b/examples/simpletests new file mode 100644 index 000000000..b4fd3234e --- /dev/null +++ b/examples/simpletests @@ -0,0 +1,11 @@ +# $Id$ + +file { + "/tmp/atest": ensure => file; + "/tmp/btest": ensure => file +} + +file { + "/tmp/ctest": ensure => file; + "/tmp/dtest": ensure => file; +} diff --git a/examples/svncommit b/examples/svncommit new file mode 100644 index 000000000..350cd8580 --- /dev/null +++ b/examples/svncommit @@ -0,0 +1,13 @@ +$path = "/usr/bin:/bin" + +file { "/tmp/svntests": + recurse => true, + checksum => md5 +} + +exec { "echo 'files have been updated'": + cwd => "/tmp/svntests", + refreshonly => true, + require => file["/tmp/svntests"], + path => $path +} -- cgit