changeset 32:6bbc86f6cee5 puppet-3.6

Tidy up ordering and dependencies (including making sure we have a necessary file for Fail2Ban to start)
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2015 19:33:06 +0000
parents cc7557a9cc7b
children 5c7fc7b7262c
files manifests/templates.pp modules/postfix/manifests/init.pp modules/website/manifests/php.pp
diffstat 3 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/manifests/templates.pp	Sat Mar 14 19:32:15 2015 +0000
+++ b/manifests/templates.pp	Sat Mar 14 19:33:06 2015 +0000
@@ -1,3 +1,10 @@
+# Make sure packages come after their repos
+YumRepo<| |> -> Package<| |>
+
+# Make sure all files are in  place before starting services
+File<| |> -> Service<| |>
+
+
 class basenode {
 	$os = $operatingsystem
 	$osver = "v${operatingsystemrelease}"
@@ -73,7 +80,8 @@
 	}
 	file { '/etc/pki/rpm-gpg/RPM-GPG-KEY-IBBoard-OBS':
 		ensure => present,
-		source => 'puppet:///common/RPM-GPG-KEY-IBBoard-OBS'
+		source => 'puppet:///common/RPM-GPG-KEY-IBBoard-OBS',
+		before => YumRepo['ibboard'],
 	}
 	yumrepo { 'webtatic':
 		mirrorlist => 'http://mirror.webtatic.com/yum/el6/$basearch/mirrorlist',
@@ -85,7 +93,8 @@
 	}
 	file { '/etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy':
 		ensure => present,
-		source => 'puppet:///common/RPM-GPG-KEY-webtatic-andy'
+		source => 'puppet:///common/RPM-GPG-KEY-webtatic-andy',
+		before => YumRepo['webtatic'],
 	}
 }
 
@@ -211,6 +220,13 @@
 		content => '[Definition]
 logtarget = /var/log/fail2ban.log'
 	}
+	# Because one of our rules checks fail2ban's log, but the service dies without the file
+	file { '/var/log/fail2ban.log':
+		ensure => present,
+		owner => 'root',
+		group => 'root',
+		mode => '0600',
+	}
 }
 
 #Our web server with our configs, not just a stock one
--- a/modules/postfix/manifests/init.pp	Sat Mar 14 19:32:15 2015 +0000
+++ b/modules/postfix/manifests/init.pp	Sat Mar 14 19:33:06 2015 +0000
@@ -3,11 +3,9 @@
   ){
   package { 'sendmail':
     ensure => 'absent',
-    notify => Package['postfix']
   }
   service { 'sendmail':
     ensure => stopped,
-    notify => Package['sendmail']
   }
   package { 'postfix':
     ensure => latest;
@@ -30,7 +28,6 @@
   }
   file { '/etc/postfix/main.cf':
     content => template('postfix/main.cf.erb'),
-    require => [ Package['postfix'], Class['dovecot'] ],
   }
   file { '/etc/postfix/master.cf':
     source => 'puppet:///common/postfix/master.cf'
--- a/modules/website/manifests/php.pp	Sat Mar 14 19:32:15 2015 +0000
+++ b/modules/website/manifests/php.pp	Sat Mar 14 19:33:06 2015 +0000
@@ -4,11 +4,13 @@
     ) {
   File {
       notify => Service['httpd'],
+      tag => 'website',
   }
   Package {
       notify => Service['httpd'],
+      tag => 'website',
   }
-  Package <| |> -> File <| |>
+  Package <| tag == 'website' |> -> File <| tag == 'website' |>
   $packages = [ "php${suffix}", "php${suffix}-mcrypt", "php${suffix}-mbstring", "php${suffix}-xml", "php${suffix}-gd" ]
   package { $packages:
     ensure => latest,