2. Hi,
my
name
is
Dave.
• DevOps
Engineer
at
Bazaarvoice.
• Started
working
with
puppet
in
2008
while
working
at
Bioware.
First
version
was
0.24.
• At
Bioware,
puppet
configured
over
14k
nodes
that
comprised
of
web
servers,
databases
and
game
servers.
• All
5
datacenters
(in
California,
Virginia,
Ireland,
Australia
and
Texas)
housed
puppet
managed
nodes
that
all
reported
back
to
a
centralized
puppet
dashboard.
• My
contact
info:
– hTp://www.linkedin.com/in/jamesbarcelo
3. Bazaarvoice
Plug
• We
do
embedded
DevOps!
• ApplicaYon
teams
are
responsible
for
their
applicaYon’s
operaYonal
success.
No
centralized
operaYons!
• 2.0
stack
is
100%
in
Amazon!
• Conferences!
• Work
on
awesome
projects
with
spiffy
tech
like
Cassandra
or
ElasYcSearch.
• Send
me
your
resume!
Dave.barcelo@bazzarvoice.com
4. Preview
presentaYon
• Puppet
in
the
legacy
stack.
• Puppet
in
the
Data
Infrastructure
Team.
– Focus
on
client/server.
• Puppet
in
the
Data
Services
Team.
– Focus
on
masterless
puppet.
5. Puppet
in
the
Legacy
Infrastructure
• TradiYonal
puppet
use
with
client/server.
• MulYple
levels
of
inheritance
using
node
inheritance.
• Puppet
managed
instances
are
configured
according
to
DNS
naming
convenYon:
node
/my-‐hostname/
{
…
…
}
6. • Some
issues
encountered:
– Very
hard
to
work
with.
Very
complex.
– Large
codebase.
Adds
to
complexity.
MulYple
teams
working
with
same
code
base.
– No
confidence
in
making
changes.
Side
effects
feared
ader
code
change.
A
jinga
tower
of
puppet
code.
– Too
many
pivot
points.
Many
places
to
configure.
Adds
to
complexity.
– Lots
of
code
rot.
Had
not
been
refactored.
8. Architecture
• Each
server
type
we
care
about
will
be
referenced
by
its
role.
We
only
care
about
roles,
not
hostnames.
• Centered
around
an
uber
IT
tools
server
that
runs
everything
ops
(including
puppet)
to
do
work
in
an
environment.
The
Mothership.
• Hiera
and
parameterized
classes
will
be
used
to
create
generic
puppet
modules
that
can
be
reused
for
different
roles.
• Development
will
be
centered
on
using
puppet
environments
on
the
Mothership
to
protect
devs
from
stepping
on
each
other.
9. Mothership
• Contains
a
cocktail
of
different
applicaYon
tools
for
doing
work
in
the
environment.
Tools
included:
– McollecYve/AcYveMQ
– Puppet
server
– Puppet
managed
operaYon
scripts.
• Motherships
configured
to
be
highly
available
in
regular
AWS
fashion(Autoscaling,
cluster
mulYple
acYveMQ,
etc).
• AdverYses
mulYple
puppet
environments
that
clients
can
switch
between
via
–environments.
12. Methods
of
passing
in
data
Gejng
environment
data
into
puppet
configuraYon.
• Hiera
datastore.
• Puppet
stdlib/tags.txt
• Cloud
formaYon
parameters
–
Universe,
VPC
13. Puppet
Stdlib/facts.d
•
Bootstrap
process
(EC2
user
data)
populates
/
etc/facter/facts.d/tags.txt
with
mappings.
These
mappings
become
facters.
• Example
of
data
in
tags.txt:
– Universe
value.
– Ec2
metadata.
/etc/facter/facts.d/tags.txt:
universe=dev
Tag_region=us-‐east-‐1
14. Hiera
datastore
• Hiera
is
used
extensively
where
different
data
needs
to
be
passed
into
puppet
according
to
context.
Different
contexts
would
include:
– Amazon
region.
– Instance
role.
– Universe.
• Example
usage:
$app_version
=
hiera(‘app_version’,
nil)
18. Puppet
code
on
the
Mothership
• The
files
that
do
the
things:
– /etc/puppet/puppet.conf
– /etc/puppet/env/global_hieradata/
environments.json
– /etc/puppet/puppetmaster.conf
– /etc/puppet_env/{puppet_env}/…
• manifests/…
• modules/…
27. Architecture
SYll
keeping
bits
of
the
Mothership
project:
• ApplicaYons/Services
scoped
in
zookeeper
by
Universe.
• Emphasis
is
put
on
making
things
simpler.
Puppet
code
will
not
be
monolithic.
Individual
applicaYon
teams
will
only
need
to
maintain
there
own
modules/manifests.
• Changes
to
modules/manifests
will
not
impact
other
teams.
28. Methods
of
passing
in
data
• The
usual
suspects:
– Puppet
stdlib/tags.txt.
– Hiera.
– Cloud
formaYon
parameters
–
Universe,
VPC
• Some
new
ones:
– EC2
data/metadata
-‐>
facter.
– Zookeeper.
– Cloud
formaYon
parameters
-‐
DeployTag
32. Puppet
code
in
Masterless
• No
more
Mothership.
All
work
is
done
via
puppet
apply.
– /etc/hiera.yaml
– /etc/puppet/manifests/{role}.pp
– /etc/puppet/manifests/00_common.pp
– /etc/puppet/manifests/01_users.pp
– /etc/puppet/modules/…
34. /etc/puppet/manifests/{role}.pp
import
'00_common'
node
default
{
#
This
class
contains
common
modules
that
should
be
used
by
all
roles.
class
{
'common':
}
class
{
'acYvemq’:
}
-‐>
class
{
'mcollecYve':
server
=>
true,
client
=>
true,
}
}
35. /etc/puppet/manifests/
00_common.pp
import
'01_users'
#####################################
#
Common
#####################################
class
common
{
class
{
'stdlib':
}
file
{
'/opt/bazaarvoice':
ensure
=>
directory,
}
#
Authorized
keys
for
project
developers.
class
{
'user_setup':
stage
=>
setup,
}
host
{
'internal_ip':
ensure
=>
'present',
name
=>
$fqdn,
ip
=>
$ipaddress,
}
class
{
'prompt':
}
}