Permalink
Browse files

reworked everything. There *has* to be a better way to handle dependa…

…ncies of classes. I am saying require => "some resource" way too many times. Looking for a better way.
  • Loading branch information...
1 parent 5b3b4df commit ee57044e083222512a0243d3d3bb1c081c5e6a48 @uberj committed Dec 1, 2011
Showing with 122 additions and 104 deletions.
  1. 0 tinydns/README
  2. +24 −0 tinydns/manifests/daemontools.pp
  3. +51 −104 tinydns/manifests/setup.pp
  4. +25 −0 tinydns/manifests/users.pp
  5. +22 −0 tinydns/manifests/utils.pp
View
No changes.
@@ -0,0 +1,24 @@
+# This class needs to have the daemontools package installed.
+class tinydns::daemontools {
+ Package['daemontools'] -> Class['tinydns::daemontools']
+
+ service { "dnscache":
+ provider => "daemontools",
+ path => "/etc/dnscache";
+ }
+
+ service { "dnscache-log":
+ provider => "daemontools",
+ path => "/etc/dnscache/log";
+ }
+
+ service { "tinydns":
+ provider => "daemontools",
+ path => "/etc/tinydns";
+ }
+
+ service { "tinydns-log":
+ provider => "daemontools",
+ path => "/etc/tinydns/log";
+ }
+}
View
@@ -1,128 +1,75 @@
class tinydns::setup {
+ include tinydns::users
+ include tinydns::daemontools
+ include tinydns::utils # Contains all packages.
+ #exec { "rebuild-tinydns-data":
+ # cwd => "/etc/tinydns/root",
+ # command => "/usr/bin/make",
+ # refreshonly => true,
+ # require => [Package["djbdns"], Exec["tinydns-setup"], Exec["dnscache-setup"]],
+ # notify => Service["dnscache"]
+ #}
- exec { "rebuild-tinydns-data":
- cwd => "/etc/tinydns/root",
- command => "/usr/bin/make",
- refreshonly => true,
- require => [Package["djbdns"], Exec["tinydns-setup"], Exec["dnscache-setup"]],
- notify => Service["dnscache"]
+ exec {
+ "tinydns-setup":
+ command => "/usr/bin/tinydns-conf tinydns dnslog /etc/tinydns 127.0.0.1",
+ creates => "/etc/tinydns",
+ require => [Class['tinydns::utils'],Class['tinydns::users']]
}
- exec { "tinydns-setup":
- command => "/usr/bin/tinydns-conf tinydns dnslog /etc/tinydns 127.0.0.1",
- creates => "/etc/tinydns",
- require => Package["djbdns"]
+ exec {
+ "dnscache-setup":
+ command => "/usr/bin/dnscache-conf dnscache dnslog /etc/dnscache $ipaddress",
+ creates => "/etc/dnscache",
+ require => [Class['tinydns::utils'],Class['tinydns::users']]
}
- exec { "dnscache-setup":
- command => "/usr/bin/dnscache-conf dnscache dnslog /etc/dnscache $ipaddress",
- creates => "/etc/dnscache",
- require => Package["djbdns"]
- }
-
- user { "tinydns":
- ensure => present,
- comment => "Tinydns User",
- home => "/dev/null",
- shell => "/bin/false",
- uid => 30000,
- }
-
- user { "dnscache":
- ensure => present,
- comment => "Dnscache User",
- home => "/dev/null",
- shell => "/bin/false",
- uid => 30001,
- }
-
- user { "dnslog":
- ensure => present,
- comment => "Djbdns Log User",
- home => "/dev/null",
- shell => "/bin/false",
- uid => 30002,
- }
-
- package { "djbdns":
- ensure => "present",
- source => "/etc/puppet/modules/tinydns/files/djbdns_1.05-4+lenny1_amd64.deb",
- provider => dpkg,
- }
-
- package { "make":
- ensure => "present"
- }
-
- package { "bsdutils":
- ensure => "present"
- }
- package { "daemontools":
- ensure => "present"
- }
- package { "daemontools-run":
- ensure => "present"
- }
-
- file { "/etc/service":
- ensure => directory,
- mode => 0640,
- }
- file { "/etc/service/tinydns":
- ensure => link,
- target => "/etc/tinydns",
- require => [File['/etc/service'], Exec["tinydns-setup"], Exec["dnscache-setup"]]
- }
+ file {
- file { "/etc/service/dnscache":
- ensure => link,
- target => "/etc/dnscache",
- require => [File['/etc/service'], Exec["tinydns-setup"], Exec["dnscache-setup"]]
+ "/etc/service":
+ ensure => directory,
+ mode => 0640,
+ require => [Exec["tinydns-setup"], Exec["dnscache-setup"]],
}
-
- service { "dnscache":
- provider => "daemontools",
- path => "/etc/dnscache";
+ file {
+ "/etc/service/tinydns":
+ ensure => link,
+ target => "/etc/tinydns",
+ require => [Exec["tinydns-setup"], Exec["dnscache-setup"]],
}
-
- service { "dnscache-log":
- provider => "daemontools",
- path => "/etc/dnscache/log";
+ file {
+ "/etc/service/dnscache":
+ ensure => link,
+ target => "/etc/dnscache",
+ require => [Exec["tinydns-setup"], Exec["dnscache-setup"]],
}
- service { "tinydns":
- provider => "daemontools",
- path => "/etc/tinydns";
- }
-
- service { "tinydns-log":
- provider => "daemontools",
- path => "/etc/tinydns/log";
- }
file { "/etc/tinydns/log/run":
+ require => Exec["tinydns-setup"],
+ notify => Service["tinydns-log"],
ensure => present,
owner => "root",
group => "root",
mode => "0755",
source => "puppet:///modules/tinydns/tinydns-log",
- require => [Exec["tinydns-setup"], Package["daemontools"], Package["bsdutils"]],
- notify => Service["tinydns-log"]
}
- file { "/etc/dnscache/log/run":
- owner => "root",
- group => "root",
- mode => "0755",
- source => "puppet:///modules/tinydns/dnscache-log",
- require => [Exec["dnscache-setup"], Package["daemontools"], Package["bsdutils"]],
- notify => Service["dnscache-log"]
- }
- file { "/etc/dnscache/root/servers/internal":
- ensure => present,
- content => "127.0.0.1",
- require => Exec['dnscache-setup'],
+ file {
+ "/etc/dnscache/log/run":
+ require => Exec["dnscache-setup"],
+ notify => Service["dnscache-log"],
+ owner => "root",
+ group => "root",
+ mode => "0755",
+ source => "puppet:///modules/tinydns/dnscache-log",
+ }
+ file {
+ "/etc/dnscache/root/servers/internal":
+ require => Exec["dnscache-setup"],
+ ensure => present,
+ content => "127.0.0.1",
}
}
View
@@ -0,0 +1,25 @@
+class tinydns::users {
+ user { "tinydns":
+ ensure => present,
+ comment => "Tinydns User",
+ home => "/dev/null",
+ shell => "/bin/false",
+ uid => 30000,
+ }
+
+ user { "dnscache":
+ ensure => present,
+ comment => "Dnscache User",
+ home => "/dev/null",
+ shell => "/bin/false",
+ uid => 30001,
+ }
+
+ user { "dnslog":
+ ensure => present,
+ comment => "Djbdns Log User",
+ home => "/dev/null",
+ shell => "/bin/false",
+ uid => 30002,
+ }
+}
View
@@ -0,0 +1,22 @@
+ class tinydns::utils {
+ package { "djbdns":
+ ensure => "present",
+ source => "/etc/puppet/modules/tinydns/files/djbdns_1.05-4+lenny1_amd64.deb",
+ provider => dpkg,
+ }
+
+ package { "make":
+ ensure => "present"
+ }
+
+ package { "bsdutils":
+ ensure => "present"
+ }
+
+ package { "daemontools":
+ ensure => "present"
+ }
+ package { "daemontools-run":
+ ensure => "present"
+ }
+ }

0 comments on commit ee57044

Please sign in to comment.