Merge branch 'master' of bitbucket.org:tmakinen/puppet
This commit is contained in:
commit
a0237e2649
4 changed files with 79 additions and 17 deletions
|
@ -67,7 +67,7 @@ class network::hostname {
|
|||
"debian","ubuntu": {
|
||||
file { "/etc/hostname":
|
||||
ensure => present,
|
||||
content => "${homename}\n",
|
||||
content => "${::homename}\n",
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
|
@ -77,7 +77,7 @@ class network::hostname {
|
|||
if versioncmp($::operatingsystemrelease, "17") == 1 {
|
||||
file { "/etc/hostname":
|
||||
ensure => present,
|
||||
content => "${homename}\n",
|
||||
content => "${::homename}\n",
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
|
@ -85,25 +85,30 @@ class network::hostname {
|
|||
} else {
|
||||
augeas { "set-hostname":
|
||||
context => "/files/etc/sysconfig/network",
|
||||
changes => "set HOSTNAME ${homename}",
|
||||
changes => "set HOSTNAME ${::homename}",
|
||||
}
|
||||
}
|
||||
}
|
||||
"centos","redhat": {
|
||||
augeas { "set-hostname":
|
||||
context => "/files/etc/sysconfig/network",
|
||||
changes => "set HOSTNAME ${homename}",
|
||||
changes => "set HOSTNAME ${::homename}",
|
||||
}
|
||||
}
|
||||
"openbsd": {
|
||||
file { "/etc/myname":
|
||||
ensure => present,
|
||||
content => "${homename}\n",
|
||||
content => "${::homename}\n",
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "wheel",
|
||||
}
|
||||
}
|
||||
"openwrt": {
|
||||
uci::set { "system.@system[0].hostname":
|
||||
value => $::homename,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("network::hostname not supported on ${::operatingsystem}")
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ class puppet::client {
|
|||
}
|
||||
|
||||
case $::operatingsystem {
|
||||
openbsd: { $vardir = "/var/puppet" }
|
||||
"openbsd": { $vardir = "/var/puppet" }
|
||||
"openwrt": { $vardir = "/etc/puppet" }
|
||||
default: { $vardir = "/var/lib/puppet" }
|
||||
}
|
||||
|
||||
|
@ -140,22 +141,29 @@ class puppet::client {
|
|||
|
||||
file { "/usr/local/sbin/puppet-check":
|
||||
ensure => present,
|
||||
name => $::operatingsystem ? {
|
||||
"openwrt" => "/usr/sbin/puppet-check",
|
||||
default => "/usr/local/sbin/puppet-check",
|
||||
},
|
||||
source => "puppet:///modules/puppet/puppet-check",
|
||||
mode => "0755",
|
||||
owner => "root",
|
||||
group => $::operatingsystem ? {
|
||||
openbsd => "wheel",
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
}
|
||||
cron { "puppet-check":
|
||||
ensure => present,
|
||||
environment => $::operatingsystem ? {
|
||||
openbsd => "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
|
||||
"openbsd" => "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
|
||||
default => undef,
|
||||
},
|
||||
command => "/usr/local/sbin/puppet-check",
|
||||
user => root,
|
||||
command => $::operatingsystem ? {
|
||||
"openwrt" => "/usr/sbin/puppet-check",
|
||||
default => "/usr/local/sbin/puppet-check",
|
||||
},
|
||||
user => "root",
|
||||
hour => 5,
|
||||
minute => fqdn_rand(60),
|
||||
require => File["/usr/local/sbin/puppet-check"],
|
||||
|
|
|
@ -107,8 +107,12 @@ class ssh::hostkeys {
|
|||
class ssh::server {
|
||||
|
||||
if $::operatingsystem != "OpenBSD" {
|
||||
package { "openssh-server":
|
||||
package { "ssh-server":
|
||||
ensure => installed,
|
||||
name => $::operatingsystem ? {
|
||||
"openwrt" => "dropbear",
|
||||
default => "openssh-server",
|
||||
},
|
||||
before => Service["sshd"],
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +120,7 @@ class ssh::server {
|
|||
service { "sshd":
|
||||
name => $::operatingsystem ? {
|
||||
"debian" => "ssh",
|
||||
"openwrt" => "dropbear",
|
||||
"ubuntu" => "ssh",
|
||||
default => "sshd",
|
||||
},
|
||||
|
|
44
uci/manifests/init.pp
Normal file
44
uci/manifests/init.pp
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
# Helper class for UCI commit
|
||||
#
|
||||
class uci {
|
||||
|
||||
if $::operatingsystem != "OpenWRT" {
|
||||
fail("uci not supported on ${::operatingsystem}")
|
||||
}
|
||||
|
||||
exec { "uci commit":
|
||||
user => "root",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Set value using UCI
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# UCI key to set
|
||||
# $value:
|
||||
# Value for given key
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
# uci::set { "uhttpd.main.listen_http":
|
||||
# value => "8080",
|
||||
# }
|
||||
#
|
||||
define uci::set($value) {
|
||||
|
||||
include uci
|
||||
|
||||
exec { "uci set ${name}=${value}":
|
||||
user => "root",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
unless => "uci get ${name} | egrep '^${value}\$'",
|
||||
notify => Exec["uci commit"],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue