Puppet Examples
From ICO wiki
Jump to navigationJump to search
Näites toodud moodulid saad paigalda järgnevate käskudega:
puppet module install puppetlabs/ntp
puppet module install puppetlabs/apache
puppet module install puppetlabs/stdlib
puppet module install thias/samba
# /etc/puppet/manifests/site.pp
import "classes/*"
node basenode {
include peamine
include software
include tarkvara
include eemalda
include users
}
node 'client1.lab1' inherits basenode {
include rootkey
include ntpserver
include apachesrv
include jagamine
}
# /etc/puppet/manifests/classes/kokku.pp
class apachesrv {
class { 'apache': }
apache::vhost { 'www.planet.zz':
port => '80',
docroot => '/var/www/www.planet.zz',
}
file { "/var/www/www.planet.zz/index.html":
ensure => present,
content => "www.planet.zz\n<br\n>Server tootab\n",
}
file_line { 'host_planet':
ensure => present,
line => "127.0.0.1 www.planet.zz",
path => '/etc/hosts',
}
apache::vhost { 'weeb':
port => '80',
docroot => '/var/www/weeb',
}
file { "/var/www/weeb/index.html":
ensure => present,
content => "weeb\n<br\n>Server tootab\n",
}
file_line { 'host_weeb':
ensure => present,
line => "127.0.0.1 weeb",
path => '/etc/hosts',
}
}
class rootkey {
ssh_authorized_key { 'root_public_key':
user => 'root',
type => 'rsa',
key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQCb4qleB1hiGCXJZJkWIQqrfVtRSaS26qr9qgKGx80tqhy+SHcTXvDyiTfE+EbpXoH+OxZk3uu2U1J70GfqOO5t5LXp5Cawk/uFIzluwBsCMwUyuByB9wjtMS06DJFwGt7YXxCJd2P52VLQvG4QwprNvihVWzg43IrlY2FWSM3KIHvu8bSeyVRQf6uqREP88FPWJKqvmHFFOl9IQpEv0X83/+bCjkUZA501c19S8ZGs051mLIy9fv8kjH7yz3RIn4PYZSpO20p0l46s2gQGDCMG4Zx0Y5EM7exNjRzleHlAcTpCFfsGG6/+SZqO6nywTLVZwCsOLjXIfeDrDOau8t+n',
}
}
class ntpserver {
class { '::ntp':
servers => [ 'ntp.eenet.ee', 'ntp.ut.ee' ],
panic => false, #Hea kasutada virtuaalmasinate puhul.
}
}
class peamine {
file { "/etc/issue":
ensure => present,
mode => 600,
owner => root,
group => root,
content => "KALA",
}
}
class jagamine {
class { 'samba::server':
workgroup => 'WORKGROUP',
server_string => 'Fail server',
hosts_allow => [ '127.', '192.168.' ],
local_master => 'yes',
map_to_guest => 'Bad User',
preferred_master => 'yes',
shares => {
'homes' => [
'comment = Home Directories',
'browseable = no',
'writable = yes',
],
'pildid' => [
'comment = Pildid',
'path = /var/samba/pildid',
'browseable = yes',
'writable = yes',
'guest ok = yes',
'available = yes',
],
},
}
file { [ "/var/samba/", "/var/samba/pildid/" ]:
ensure => directory,
}
}
class software {
package {
["zsh"]: ensure => present
}
}
class tarkvara {
package {
["htop", "bpython"]: ensure => present
}
}
class eemalda {
package {
["cowsay"]: ensure => absent
}
}
class users {
user { "polekala":
ensure => present,
home => "/home/polekala",
managehome => true,
shell => "/bin/zsh",
}
}