puppet: Use common::line instead of our own common::append

(imported from commit 230efb3409eaa451fa28d1655b27a2f5e5f9d382)
This commit is contained in:
Zev Benjamin 2013-02-07 16:43:54 -05:00
parent eba1008b1c
commit a7ca48e2ff
3 changed files with 17 additions and 24 deletions

View File

@ -1,15 +0,0 @@
## START LIBRARY FUNCTIONS
# Usage: Variant on common:append_if_no_such_line that initializes the
# File object for you.
define common::append ($file, $line) {
file { $file:
ensure => file,
}
exec { "/bin/echo '$line' >> '$file'":
unless => "/bin/grep -Fxqe '$line' '$file'",
path => "/bin",
subscribe => File[$file],
}
}

View File

@ -94,10 +94,15 @@ class humbug::base {
source => '/root/humbug/servers/puppet/files/apt/apt.conf.d/02periodic',
}
common::append { '/etc/ssh/sshd_config':
file { '/etc/ssh/sshd_config':
require => Package['openssh-server'],
ensure => file,
}
common::line { 'no_password_auth':
file => '/etc/ssh/sshd_config',
line => 'PasswordAuthentication no',
require => Package['openssh-server'],
}
service { 'ssh':

View File

@ -29,21 +29,24 @@ class humbug::postgres {
source => "/root/humbug/servers/puppet/files/postgresql/pg_hba.conf",
}
common::append_if_no_such_line { 'shmmax':
require => Package['postgresql-9.1'],
common::line { 'shmmax':
require => [ Package['postgresql-9.1'],
File["/etc/sysctl.d/30-postgresql-shm.conf"] ],
file => '/etc/sysctl.d/30-postgresql-shm.conf',
line => 'kernel.shmmax = 6979321856'
line => 'kernel.shmmax = 6979321856',
}
common::append_if_no_such_line { 'shmall':
require => Package['postgresql-9.1'],
common::line { 'shmall':
require => [ Package['postgresql-9.1'],
File["/etc/sysctl.d/30-postgresql-shm.conf"] ],
file => '/etc/sysctl.d/30-postgresql-shm.conf',
line => 'kernel.shmall = 1703936'
line => 'kernel.shmall = 1703936',
}
exec { "sysctl_p":
command => "/sbin/sysctl -p /etc/sysctl.d/30-postgresql-shm.conf",
require => [ Common::Append_if_no_such_line['shmmax'],
Common::Append_if_no_such_line['shmall'],
require => [ Common::Line['shmmax'],
Common::Line['shmall'],
],
}