summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2014-08-12 16:10:52 -0300
committerdrebs <drebs@riseup.net>2014-08-13 12:48:23 -0300
commit2f2e3b6fca2d9c3080e85f531e576f83b791a692 (patch)
treefd417e85762f9a1066494c88fb4a03d33ad101e9
parentb0353cd961c5bb8642535a3f9284a6d74c96644b (diff)
downloadpuppet-puppet-2f2e3b6fca2d9c3080e85f531e576f83b791a692.tar.gz
puppet-puppet-2f2e3b6fca2d9c3080e85f531e576f83b791a692.tar.bz2
Add standalone class.
-rw-r--r--files/puppet2
-rw-r--r--manifests/base.pp28
-rw-r--r--manifests/daemon.pp26
-rw-r--r--manifests/master.pp2
-rw-r--r--manifests/repo.pp (renamed from manifests/master/update.pp)58
-rw-r--r--manifests/standalone.pp13
6 files changed, 81 insertions, 48 deletions
diff --git a/files/puppet b/files/puppet
index d9f5fd4..3b85c50 100644
--- a/files/puppet
+++ b/files/puppet
@@ -1,7 +1,7 @@
# Defaults for puppet - sourced by /etc/init.d/puppet
# Start puppet on boot?
-START=yes
+START=<?= start_on_boot ? "yes" : "no" ?>
# Startup options
DAEMON_OPTS=""
diff --git a/manifests/base.pp b/manifests/base.pp
new file mode 100644
index 0000000..299ecc6
--- /dev/null
+++ b/manifests/base.pp
@@ -0,0 +1,28 @@
+# manage puppet package
+class puppet::base(
+ $start_on_boot = false
+) {
+ include puppet
+
+ case $ensure {
+ '': {
+ $daemon_ensure = $::lsbdistcodename ? {
+ 'squeeze' => 'latest',
+ default => installed,
+ }
+ }
+ }
+
+ package { "puppet":
+ ensure => $daemon_ensure,
+ }
+
+ file { "/etc/default/puppet":
+ source => "puppet:///modules/puppet/puppet",
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ ensure => present,
+ }
+
+}
diff --git a/manifests/daemon.pp b/manifests/daemon.pp
index c8a5b1e..59d83ba 100644
--- a/manifests/daemon.pp
+++ b/manifests/daemon.pp
@@ -1,3 +1,4 @@
+# manage puppet service
class puppet::daemon(
$master = false,
$ensure = hiera('puppet::daemon::ensure', ''),
@@ -6,29 +7,12 @@ class puppet::daemon(
$configtimeout = hiera('puppet::daemon::configtimeout', "120"),
$server = hiera('puppet::daemon::server', "puppet.${::domain}")
) {
- include puppet
-
- case $ensure {
- '': {
- $daemon_ensure = $::lsbdistcodename ? {
- 'squeeze' => 'latest',
- default => installed,
- }
- }
- }
-
- package { "puppet":
- ensure => $daemon_ensure,
- require => Package["cron"],
+ class { "puppet::base":
+ start_on_boot => true
}
- file { "/etc/default/puppet":
- source => "puppet:///modules/puppet/puppet",
- owner => "root",
- group => "root",
- mode => 0644,
- ensure => present,
- notify => Service["puppet"],
+ package { "cron":
+ ensure => installed,
}
service { "puppet":
diff --git a/manifests/master.pp b/manifests/master.pp
index 94727d1..cd9852a 100644
--- a/manifests/master.pp
+++ b/manifests/master.pp
@@ -115,7 +115,7 @@ class puppet::master(
}
# update config
- class { 'puppet::master::update':
+ class { 'puppet::repo::update':
ensure => $main ? {
true => present,
default => absent,
diff --git a/manifests/master/update.pp b/manifests/repo.pp
index 4c7a42c..1623a3c 100644
--- a/manifests/master/update.pp
+++ b/manifests/repo.pp
@@ -1,7 +1,7 @@
-class puppet::master::update(
- $ensure = present,
- $method = hiera('puppet::master::update::method', 'cron')
-) {
+# manage a git repo that updates /etc/puppet
+class puppet::repo {
+ include puppet
+
# make sure we have a puppet repo
exec { "make-puppet-repo":
command => "/bin/sh -c 'mkdir -p /var/git/repositories/puppet.git && cd /var/git/repositories/puppet.git && git --bare init'",
@@ -10,27 +10,6 @@ class puppet::master::update(
require => [ User['gitolite'], File['/var/git/repositories'] ],
}
- # puppet update script
- file { "/usr/local/sbin/update-puppet-conf.sh":
- source => "puppet:///modules/puppet/update-puppet-conf.sh",
- owner => "puppet",
- group => "puppet",
- mode => 0750,
- ensure => present,
- }
-
- # cron rule to update puppet config repository every 5 minutes
- cron { "puppet-update":
- command => "/usr/local/sbin/update-puppet-conf.sh > /dev/null 2>&1",
- user => puppet,
- minute => "*/5",
- ensure => $method ? {
- 'cron' => $ensure,
- default => absent,
- },
- require => [ File["/usr/local/sbin/update-puppet-conf.sh"], User["puppet"] ],
- }
-
# use a post-update hook
file { '/var/git/repositories/puppet.git/hooks/post-update':
mode => 0750,
@@ -64,3 +43,32 @@ class puppet::master::update(
}
}
}
+
+class puppet::repo::update(
+ $ensure = present,
+ $method = hiera('puppet::update::method', 'cron')
+) {
+ include puppet::repo
+
+ # puppet update script
+ file { "/usr/local/sbin/update-puppet-conf.sh":
+ source => "puppet:///modules/puppet/update-puppet-conf.sh",
+ owner => "puppet",
+ group => "puppet",
+ mode => 0750,
+ ensure => present,
+ }
+
+ # cron rule to update puppet config repository every 5 minutes
+ cron { "puppet-update":
+ command => "/usr/local/sbin/update-puppet-conf.sh > /dev/null 2>&1",
+ user => puppet,
+ minute => "*/5",
+ ensure => $method ? {
+ 'cron' => $ensure,
+ default => absent,
+ },
+ require => [ File["/usr/local/sbin/update-puppet-conf.sh"], User["puppet"] ],
+ }
+
+}
diff --git a/manifests/standalone.pp b/manifests/standalone.pp
new file mode 100644
index 0000000..342fbe4
--- /dev/null
+++ b/manifests/standalone.pp
@@ -0,0 +1,13 @@
+# manage a puppet standalone installation with no agent
+class puppet::standalone {
+
+ include puppet::base # agent will not start on boot by default
+ include puppet::repo
+
+ service { "puppet":
+ enable => false,
+ ensure => stopped,
+ hasrestart => true,
+ require => [ Package["puppet"], File["/etc/default/puppet"] ],
+ }
+}