Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 11, 2016
0 parents commit acc6639
Show file tree
Hide file tree
Showing 53 changed files with 2,453 additions and 0 deletions.
Binary file added 9781590599785.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Chapter 4/.DS_Store
Binary file not shown.
Empty file added Chapter 4/fileserver.conf
Empty file.
Binary file added Chapter 4/manifests/.DS_Store
Binary file not shown.
Binary file added Chapter 4/manifests/classes/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions Chapter 4/manifests/classes/administrators.pp
@@ -0,0 +1,6 @@
class administrators inherits virt_users {
realize(
Group["administration"]
)
User["jsmith"] { groups => "administration" }
}
29 changes: 29 additions & 0 deletions Chapter 4/manifests/classes/baseapps.pp
@@ -0,0 +1,29 @@
class baseapps {

$packagelist = ["joe", "perl", "rubygems"]

package { $packagelist:
ensure => installed }
}

class sshd {

case $operatingsystem {
fedora: { $ssh_packages = ["openssh", "openssh-server", "openssh-clients"] }
debian: { $ssh_packages = ["openssh-server", "openssh-client"] }
default: { $ssh_packages = ["openssh", "openssh-server"] }
}

package { $ssh_packages: ensure => installed }

service { sshd:
name => $operatingsystem ? {
fedora => "sshd",
debian => "ssh",
default => "sshd",
},
enable => true,
ensure => running
}

}
7 changes: 7 additions & 0 deletions Chapter 4/manifests/classes/mail_team.pp
@@ -0,0 +1,7 @@
class mail_team inherits virt_users {
realize(
Group["mail_team"]
)
User["mjones"] { groups => "mail_team" }
}

10 changes: 10 additions & 0 deletions Chapter 4/manifests/classes/staff.pp
@@ -0,0 +1,10 @@
class staff {
include virt_users, virt_groups
realize(
Group["staff"],
Group["administration"],
User["jsmith"],
User["mjones"]
)
}

7 changes: 7 additions & 0 deletions Chapter 4/manifests/groups/mysql_group.pp
@@ -0,0 +1,7 @@
class mysql_group {
group { "mysql":
gid => "501",
ensure => present
}
}

16 changes: 16 additions & 0 deletions Chapter 4/manifests/groups/virt_groups.pp
@@ -0,0 +1,16 @@
class virt_groups {
@group { "staff":
gid => "1000",
ensure => present,
}

@group { "administration":
gid => "1501",
ensure => present,
}

@group { "mail_team":
gid => "1502",
ensure => present,
}
}
16 changes: 16 additions & 0 deletions Chapter 4/manifests/nodes.pp
@@ -0,0 +1,16 @@

node 'puppetmaster.testing.com' inherits basenode {}
node 'www.testing.com' inherits webserver {
virtual_host { "test1.testing.com":
ip => "192.168.0.1"
}
virtual_host { "test2.testing.com":
ip => "192.168.0.2"
}
}
node 'db.testing.com' inherits dbserver {}
node 'mail.testing.com' inherits mailserver {}


node 'debian.lovedthanlost.net' inherits mailserver {}

9 changes: 9 additions & 0 deletions Chapter 4/manifests/os/debian.pp
@@ -0,0 +1,9 @@
class debian {

$disableservices = ["hplip", "avahi-daemon", "rsync", "spamassassin"]

service { $disableservices:
enable => false,
ensure => stopped,
}
}
9 changes: 9 additions & 0 deletions Chapter 4/manifests/os/fedora.pp
@@ -0,0 +1,9 @@
class fedora {

yumrepo { "testing.com-repo":
baseurl => "http://repos.testing.com/fedora/$lsbdistrelease/",
descr => "Testing.com's YUM repository",
enabled => 1,
gpgcheck => 0,
}
}
10 changes: 10 additions & 0 deletions Chapter 4/manifests/site.pp
@@ -0,0 +1,10 @@
import "templates.pp"
import "nodes.pp"
import "groups/*"
import "users/*"
import "os/*"
import "classes/*"


filebucket { main: server => puppet }
File { backup => main }
22 changes: 22 additions & 0 deletions Chapter 4/manifests/templates.pp
@@ -0,0 +1,22 @@
node basenode {
case $operatingsystem {
fedora: { include fedora }
debian: { include debian }
default: { include fedora}
}
# include baseapps, sshd,
include staff, administrators
}

node default inherits basenode {}

node webserver inherits basenode {
include apache
}
node dbserver inherits basenode {
include mysql
}
node mailserver inherits basenode {
# include postfix
include mail_team
}
10 changes: 10 additions & 0 deletions Chapter 4/manifests/users/mysql_user.pp
@@ -0,0 +1,10 @@
class mysql_user {
user { "mysql":
ensure => "present",
uid => "501",
gid => "501",
comment => "MySQL",
home => "/var/lib/mysql",
shell => "/sbin/nologin",
}
}
19 changes: 19 additions & 0 deletions Chapter 4/manifests/users/virt_users.pp
@@ -0,0 +1,19 @@
class virt_users {
@user { "jsmith":
ensure => "present",
uid => "1001",
gid => "1000",
comment => "Jane Smith",
home => "/nfs/IT/home/jsmith",
shell => "/bin/bash",
}

@user { "mjones":
ensure => "present",
uid => "1002",
gid => "1000",
comment => "Mary Jones",
home => "/nfs/IT/home/mjones",
shell => "/bin/bash",
}
}
Binary file added Chapter 4/modules/.DS_Store
Binary file not shown.
Binary file added Chapter 4/modules/apache/.DS_Store
Binary file not shown.

0 comments on commit acc6639

Please sign in to comment.