SlideShare una empresa de Scribd logo
1 de 14
What is Puppet?
• Puppet is a configuration automation platform that is meant to
simplify various system administration tasks.
• Puppet uses a client/server formation where the servers,
called agent nodes talk to and pull down configuration profiles from
the master client, or Puppet master.
• Puppet is written in its own Puppet language, meant to be
accessible to system administrators.
• A module, located on the Puppet master, describes the desired
system.
• Puppet then translates the module into code and alters the agent
servers as needed when you run the puppet agent command on an
agent node, or automatically at the configured intervals.
• Puppet can be used to manage multiple servers across various
infrastructures
Setting up the Puppet Master
• Enable the “puppetlabs-release” repository on Ubuntu, unpackage it and update
the system
 wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
 sudo dpkg -i puppetlabs-release-trusty.deb
 sudo apt-get update
 sudo apt-get install puppetmaster-passenger
 sudo apt-get install puppetmaster
• Ensure you have latest version of puppet running
 puppet resource package puppetmaster ensure=latest
• Puppet master is controlled by Apache2. so it runs when Apache2 runs
 sudo service Apache2 stop | start | restart | status
• Make sure the hostname is “puppet” and hosts has entry
 sudo vi /etc/hostname - puppet
 sudo vi /etc/hosts - <ip> puppet , puppet.localdomain
<ip> agent-01, agent-01.localdomain
<ip> agent-02, apent-02.localdomain
• Lock the puppet version
 Create a new file sudo vi /etc/apt/preferences.d/00-puppet.pref
 Package: puppet puppet-common puppetmaster-passenger
 Pin: version 3.4*
 Pin-Priority: 501
Setting up the Puppet Master …
• Setup puppet master names and certificates
 Edit master’s puppet.conf file - sudo vi /etc/puppet/puppet.conf
 Delete the line with templatedir
 Under the [master] section add the following
- certname = puppet
- dns_alt_names = puppet, puppet.localdomain
• Master’s certificates set up
 delete old certificates - sudo rm –rf /var/lib/puppet/ssl
 Create a new CA certificate - sudo puppet master –verbose --no-daemonize
 Press Ctrl-C after Notice: Starting puppet master message to return to shell
 In case “Address in Use” error comes, it could be because puupet master is controlled by Apache2
and that needs to be stopped - sudo service Apache2 stop
 to list all certificates on master: sudo puppet cert list -all
 Start master - sudo service puppet start
 Signing certificates
 sudo puppet cert sign <agent-name>
Setting up the Puppet Agent
• Enable the “puppetlabs-release” repository on Ubuntu, unpackage it and
update the system
 wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
 sudo dpkg -i puppetlabs-release-trusty.deb
 sudo apt-get update
 sudo apt-get install puppet
• Ensure you have latest version of puppet running
 puppet resource package puppet ensure=latest
• Puppet is disabled by default.
 edit /etc/default/puppet and change start=yes
• Make sure the hostname is “puppet” and hosts has entry
 sudo vi /etc/hostname - agent-01 or host-01 or whatever is the hostname
 sudo vi /etc/hosts - <ip> puppet , puppet.localdomain
<ip> agent-01, agent-01.localdomain
• Lock the puppet version
 Create a new file sudo vi /etc/apt/preferences.d/00-puppet.pref
 Package: puppet puppet-common puppetmaster-passenger
 Pin: version 3.4*
 Pin-Priority: 501
Setting up the Puppet Agent …
• Setup puppet master name and certificates
 Edit agent’s puppet.conf file - sudo vi /etc/puppet/puppet.conf
 delete templatedir
 delete [master] and the lines below it.
 Add [agent]
server = puppet.localdomain
 Start puppet agent
 sudo service puppet start
 if no output (other than done), then it means the agent has connected
to master and is being managed by the master.
Gathering facts
• Puppet gathers facts about each of its nodes using a tool
called “facter”.
• Facter gathers basic facts about nodes (systems) such as
hardware details, network settings, OS type and version, IP
addresses, MAC addresses, SSH keys , etc
• These facts are then made available in puppet as variables.
• It is possible to add custom facts as needed.
• On master -
 sudo vi /etc/puppet/manifests/site.pp
 add the below lines
 file {'/tmp/example-ip': # resource type file and filename
 ensure => present, # make sure it exists
 mode => 0644, # file permissions
 content => "Here is my Public IP Address: ${ipaddress_eth0}.n", # note the ipaddress_eth0
 }
 On Agent
 sudo puppet agent –test -- will create file /tmp/example-ip and print node’s ip address
 Here is my Public IP Address: x.x.x.x.
Puppet manifest with module
• Modules are useful for grouping tasks together.
• There are many modules available in the Puppet community,
and you can even write your own.
• On master - install puppetlabs-apache module from forgeapi
 sudo puppet module install puppetlabs-apache or <module-name>
 edit site.pp (sudo vi /etc/puppet/manifests/site.pp) and add the below lines
 node 'host-01' {
 class { 'apache': } # use apache module
 apache::vhost { ‘mysite.com': # define vhost resource
 port => '80',
 docroot => '/var/www/html'
 }
 },
 On Agent
 sudo puppet agent –test
 Should see output with Apache2 getting installed
Puppet code
 Puppet code is primarily composed of resource declarations.
 A resource describes something about the state of the system,
such as a certain user or file should exist, or a package should
be installed.
 Example of user resource declaration
user { ‘ranjit':
ensure => present,
uid => '1000',
gid => '1000',
shell => '/bin/bash',
home => '/home/ranjit'
}
 Example of resource declaration
resource_type { ‘resource_name':
attribute => value,
…..
}
 To list all resource types: sudo puppet resource --types
Manifests & Classes
 Puppet programs are called manifests.
 Manifests are composed of puppet code with a .pp extension.
Default main manifest installed via apt is “site.pp”. Another
example of manifest is node, for installing Apache on agent.
 Classes - A class definition is where the code that composes a
class lives. Defining a class makes the class available to be
used in manifests, but does not actually evaluate to anything.
 Class Definition
class myclass {
…… (puppet code)
}
 Class Declaration - include myclass. This will cause puppet
to evaluate puppet code in “myclass”
 A resource like class declaration occurs when a class is
declared like a resource. E.g. class {‘apache’:}
Modules
 A module is a collection of manifests and data
(such as facts, files, and templates), and they
have a specific directory structure.
 Modules are useful for organizing your Puppet
code, because they allow you to split your code
into multiple manifests.
 To add a module to Puppet, place it in
the /etc/puppet/modules directory
Developing a manifest
 Using Puppet to set up LAMP stack on Ubuntu.
 The following resources are needed on Ubuntu server
1. Apache2 installed and running
2. MySQL server package installed and running
3. php5 package installed and a test php script file present
4. update apt before and after installing packages
 For this we write a manifest with the following types of resource declarations
1. exec - to execute commands – e.g. apt-get update
2. package – to install packages via apt-get
3. Service - to ensure that a service is running
4. File – to ensure that certain file exists.
 Create manifest on the node where you want to install lamp
sudo vi /etc/puppet/manifests/lamp.pp
sudo puppet apply –test
 See the attached lamp.pp file
Installing lamp on multiple nodes
 Use modules to install lamp on multiple nodes.
 Create a directory - lamp/manifests in /etc/puppet/modules
 Create a file – init.pp in lamp/manifests
(/etc/puppet/modules/lamp/manifests/init.pp)
 Add the following lines in init.pp
1. class lamp {
2. // add the code in lamp.pp here
3. }
 On puppet master, in site.pp, add the following
1. node default{ include lamp } OR
2. node ‘host-01’ {
3. include lamp
4. }
5. A node block allows you to specify Puppet code that will only apply to certain agent
nodes. The default node applies to every agent node that does not have a node block
specified
 On puppet agent, do the following
sudo puppet agent –test --verbose
see the output
 lamp is installed on agent
Installaling Puppet Master and Agent

Más contenido relacionado

La actualidad más candente

Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To RunningGiacomo Vacca
 
Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeDanielle Madeley
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHErica Windisch
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefMatt Ray
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...Puppet
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash courseMarcus Deglos
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 PresentationSreenivas Makam
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCarlos Sanchez
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
 
Docker Security Deep Dive by Ying Li and David Lawrence
Docker Security Deep Dive by Ying Li and David LawrenceDocker Security Deep Dive by Ying Li and David Lawrence
Docker Security Deep Dive by Ying Li and David LawrenceDocker, Inc.
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsCarlos Sanchez
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesLuciano Fiandesio
 
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet
 

La actualidad más candente (20)

Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To Running
 
Docker Started
Docker StartedDocker Started
Docker Started
 
Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and code
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
 
Docker
DockerDocker
Docker
 
Django via Docker
Django via DockerDjango via Docker
Django via Docker
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker up and running
Docker up and runningDocker up and running
Docker up and running
 
Docker Security Deep Dive by Ying Li and David Lawrence
Docker Security Deep Dive by Ying Li and David LawrenceDocker Security Deep Dive by Ying Li and David Lawrence
Docker Security Deep Dive by Ying Li and David Lawrence
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3 Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
Puppet Camp Seattle 2014: Docker and Puppet: 1+1=3
 

Destacado

Designing Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternDesigning Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternPuppet
 
PuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbqueryPuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbqueryPuppet
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...Puppet
 
Provisioning environments. A simplistic approach
Provisioning  environments. A simplistic approachProvisioning  environments. A simplistic approach
Provisioning environments. A simplistic approachEder Roger Souza
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPuppet
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 
Icinga 2 and Puppet automate monitoring
Icinga 2 and Puppet  automate monitoringIcinga 2 and Puppet  automate monitoring
Icinga 2 and Puppet automate monitoringIcinga
 
Intro to Puppet Enterprise
Intro to Puppet EnterpriseIntro to Puppet Enterprise
Intro to Puppet EnterprisePuppet
 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsTomas Doran
 
Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Puppet
 
Managing Puppet using MCollective
Managing Puppet using MCollectiveManaging Puppet using MCollective
Managing Puppet using MCollectivePuppet
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetMichael Lessard
 
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and KibanaPuppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibanapkill
 
Building On Puppet and Puppet Forge
Building On Puppet and Puppet ForgeBuilding On Puppet and Puppet Forge
Building On Puppet and Puppet ForgePuppet
 
사용자 01
사용자 01사용자 01
사용자 01rururuadf
 
Best LCD Projector
Best LCD ProjectorBest LCD Projector
Best LCD Projectorjasongknight
 
Introduction of hook and loop velcro products -propad
Introduction of hook and loop velcro products -propadIntroduction of hook and loop velcro products -propad
Introduction of hook and loop velcro products -propadSammi Liang
 
Portable LCD Projector
Portable LCD ProjectorPortable LCD Projector
Portable LCD Projectorjasongknight
 
Laporan observasi pddk
Laporan observasi pddkLaporan observasi pddk
Laporan observasi pddkLindka95
 

Destacado (20)

Designing Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternDesigning Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles Pattern
 
PuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbqueryPuppetDB, Puppet Explorer and puppetdbquery
PuppetDB, Puppet Explorer and puppetdbquery
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
 
Provisioning environments. A simplistic approach
Provisioning  environments. A simplistic approachProvisioning  environments. A simplistic approach
Provisioning environments. A simplistic approach
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with Chocolatey
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
Icinga 2 and Puppet automate monitoring
Icinga 2 and Puppet  automate monitoringIcinga 2 and Puppet  automate monitoring
Icinga 2 and Puppet automate monitoring
 
Intro to Puppet Enterprise
Intro to Puppet EnterpriseIntro to Puppet Enterprise
Intro to Puppet Enterprise
 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
 
Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013Managing Windows Systems with Puppet - PuppetConf 2013
Managing Windows Systems with Puppet - PuppetConf 2013
 
Managing Puppet using MCollective
Managing Puppet using MCollectiveManaging Puppet using MCollective
Managing Puppet using MCollective
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with Puppet
 
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and KibanaPuppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
 
Building On Puppet and Puppet Forge
Building On Puppet and Puppet ForgeBuilding On Puppet and Puppet Forge
Building On Puppet and Puppet Forge
 
사용자 01
사용자 01사용자 01
사용자 01
 
Best LCD Projector
Best LCD ProjectorBest LCD Projector
Best LCD Projector
 
Introduction of hook and loop velcro products -propad
Introduction of hook and loop velcro products -propadIntroduction of hook and loop velcro products -propad
Introduction of hook and loop velcro products -propad
 
Portable LCD Projector
Portable LCD ProjectorPortable LCD Projector
Portable LCD Projector
 
Laporan observasi pddk
Laporan observasi pddkLaporan observasi pddk
Laporan observasi pddk
 

Similar a Installaling Puppet Master and Agent

Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrapeSharad Aggarwal
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceohadlevy
 
Scalable Systems Management with Puppet
Scalable Systems Management with PuppetScalable Systems Management with Puppet
Scalable Systems Management with PuppetPuppet
 
Scalable systems management with puppet
Scalable systems management with puppetScalable systems management with puppet
Scalable systems management with puppetPuppet
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
DevOps Series: Extending vagrant with Puppet for configuration management
DevOps Series: Extending vagrant with Puppet for configuration managementDevOps Series: Extending vagrant with Puppet for configuration management
DevOps Series: Extending vagrant with Puppet for configuration managementFelipe
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developerssagarhere4u
 
Learning Puppet Chapter 1
Learning Puppet Chapter 1Learning Puppet Chapter 1
Learning Puppet Chapter 1Vishal Biyani
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPuppet
 
June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules Puppet
 
Using Puppet in Small Infrastructures
Using Puppet in Small InfrastructuresUsing Puppet in Small Infrastructures
Using Puppet in Small InfrastructuresRachel Andrew
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntuIker Coranti
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet
 

Similar a Installaling Puppet Master and Agent (20)

Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrape
 
Puppet_training
Puppet_trainingPuppet_training
Puppet_training
 
Puppet demo
Puppet demoPuppet demo
Puppet demo
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conference
 
Scalable Systems Management with Puppet
Scalable Systems Management with PuppetScalable Systems Management with Puppet
Scalable Systems Management with Puppet
 
Scalable systems management with puppet
Scalable systems management with puppetScalable systems management with puppet
Scalable systems management with puppet
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
DevOps Series: Extending vagrant with Puppet for configuration management
DevOps Series: Extending vagrant with Puppet for configuration managementDevOps Series: Extending vagrant with Puppet for configuration management
DevOps Series: Extending vagrant with Puppet for configuration management
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developers
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Learning Puppet Chapter 1
Learning Puppet Chapter 1Learning Puppet Chapter 1
Learning Puppet Chapter 1
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modules
 
June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules
 
Puppet
PuppetPuppet
Puppet
 
Using Puppet in Small Infrastructures
Using Puppet in Small InfrastructuresUsing Puppet in Small Infrastructures
Using Puppet in Small Infrastructures
 
Puppet
PuppetPuppet
Puppet
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntu
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp
 

Installaling Puppet Master and Agent

  • 1.
  • 2. What is Puppet? • Puppet is a configuration automation platform that is meant to simplify various system administration tasks. • Puppet uses a client/server formation where the servers, called agent nodes talk to and pull down configuration profiles from the master client, or Puppet master. • Puppet is written in its own Puppet language, meant to be accessible to system administrators. • A module, located on the Puppet master, describes the desired system. • Puppet then translates the module into code and alters the agent servers as needed when you run the puppet agent command on an agent node, or automatically at the configured intervals. • Puppet can be used to manage multiple servers across various infrastructures
  • 3. Setting up the Puppet Master • Enable the “puppetlabs-release” repository on Ubuntu, unpackage it and update the system  wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb  sudo dpkg -i puppetlabs-release-trusty.deb  sudo apt-get update  sudo apt-get install puppetmaster-passenger  sudo apt-get install puppetmaster • Ensure you have latest version of puppet running  puppet resource package puppetmaster ensure=latest • Puppet master is controlled by Apache2. so it runs when Apache2 runs  sudo service Apache2 stop | start | restart | status • Make sure the hostname is “puppet” and hosts has entry  sudo vi /etc/hostname - puppet  sudo vi /etc/hosts - <ip> puppet , puppet.localdomain <ip> agent-01, agent-01.localdomain <ip> agent-02, apent-02.localdomain • Lock the puppet version  Create a new file sudo vi /etc/apt/preferences.d/00-puppet.pref  Package: puppet puppet-common puppetmaster-passenger  Pin: version 3.4*  Pin-Priority: 501
  • 4. Setting up the Puppet Master … • Setup puppet master names and certificates  Edit master’s puppet.conf file - sudo vi /etc/puppet/puppet.conf  Delete the line with templatedir  Under the [master] section add the following - certname = puppet - dns_alt_names = puppet, puppet.localdomain • Master’s certificates set up  delete old certificates - sudo rm –rf /var/lib/puppet/ssl  Create a new CA certificate - sudo puppet master –verbose --no-daemonize  Press Ctrl-C after Notice: Starting puppet master message to return to shell  In case “Address in Use” error comes, it could be because puupet master is controlled by Apache2 and that needs to be stopped - sudo service Apache2 stop  to list all certificates on master: sudo puppet cert list -all  Start master - sudo service puppet start  Signing certificates  sudo puppet cert sign <agent-name>
  • 5. Setting up the Puppet Agent • Enable the “puppetlabs-release” repository on Ubuntu, unpackage it and update the system  wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb  sudo dpkg -i puppetlabs-release-trusty.deb  sudo apt-get update  sudo apt-get install puppet • Ensure you have latest version of puppet running  puppet resource package puppet ensure=latest • Puppet is disabled by default.  edit /etc/default/puppet and change start=yes • Make sure the hostname is “puppet” and hosts has entry  sudo vi /etc/hostname - agent-01 or host-01 or whatever is the hostname  sudo vi /etc/hosts - <ip> puppet , puppet.localdomain <ip> agent-01, agent-01.localdomain • Lock the puppet version  Create a new file sudo vi /etc/apt/preferences.d/00-puppet.pref  Package: puppet puppet-common puppetmaster-passenger  Pin: version 3.4*  Pin-Priority: 501
  • 6. Setting up the Puppet Agent … • Setup puppet master name and certificates  Edit agent’s puppet.conf file - sudo vi /etc/puppet/puppet.conf  delete templatedir  delete [master] and the lines below it.  Add [agent] server = puppet.localdomain  Start puppet agent  sudo service puppet start  if no output (other than done), then it means the agent has connected to master and is being managed by the master.
  • 7. Gathering facts • Puppet gathers facts about each of its nodes using a tool called “facter”. • Facter gathers basic facts about nodes (systems) such as hardware details, network settings, OS type and version, IP addresses, MAC addresses, SSH keys , etc • These facts are then made available in puppet as variables. • It is possible to add custom facts as needed. • On master -  sudo vi /etc/puppet/manifests/site.pp  add the below lines  file {'/tmp/example-ip': # resource type file and filename  ensure => present, # make sure it exists  mode => 0644, # file permissions  content => "Here is my Public IP Address: ${ipaddress_eth0}.n", # note the ipaddress_eth0  }  On Agent  sudo puppet agent –test -- will create file /tmp/example-ip and print node’s ip address  Here is my Public IP Address: x.x.x.x.
  • 8. Puppet manifest with module • Modules are useful for grouping tasks together. • There are many modules available in the Puppet community, and you can even write your own. • On master - install puppetlabs-apache module from forgeapi  sudo puppet module install puppetlabs-apache or <module-name>  edit site.pp (sudo vi /etc/puppet/manifests/site.pp) and add the below lines  node 'host-01' {  class { 'apache': } # use apache module  apache::vhost { ‘mysite.com': # define vhost resource  port => '80',  docroot => '/var/www/html'  }  },  On Agent  sudo puppet agent –test  Should see output with Apache2 getting installed
  • 9. Puppet code  Puppet code is primarily composed of resource declarations.  A resource describes something about the state of the system, such as a certain user or file should exist, or a package should be installed.  Example of user resource declaration user { ‘ranjit': ensure => present, uid => '1000', gid => '1000', shell => '/bin/bash', home => '/home/ranjit' }  Example of resource declaration resource_type { ‘resource_name': attribute => value, ….. }  To list all resource types: sudo puppet resource --types
  • 10. Manifests & Classes  Puppet programs are called manifests.  Manifests are composed of puppet code with a .pp extension. Default main manifest installed via apt is “site.pp”. Another example of manifest is node, for installing Apache on agent.  Classes - A class definition is where the code that composes a class lives. Defining a class makes the class available to be used in manifests, but does not actually evaluate to anything.  Class Definition class myclass { …… (puppet code) }  Class Declaration - include myclass. This will cause puppet to evaluate puppet code in “myclass”  A resource like class declaration occurs when a class is declared like a resource. E.g. class {‘apache’:}
  • 11. Modules  A module is a collection of manifests and data (such as facts, files, and templates), and they have a specific directory structure.  Modules are useful for organizing your Puppet code, because they allow you to split your code into multiple manifests.  To add a module to Puppet, place it in the /etc/puppet/modules directory
  • 12. Developing a manifest  Using Puppet to set up LAMP stack on Ubuntu.  The following resources are needed on Ubuntu server 1. Apache2 installed and running 2. MySQL server package installed and running 3. php5 package installed and a test php script file present 4. update apt before and after installing packages  For this we write a manifest with the following types of resource declarations 1. exec - to execute commands – e.g. apt-get update 2. package – to install packages via apt-get 3. Service - to ensure that a service is running 4. File – to ensure that certain file exists.  Create manifest on the node where you want to install lamp sudo vi /etc/puppet/manifests/lamp.pp sudo puppet apply –test  See the attached lamp.pp file
  • 13. Installing lamp on multiple nodes  Use modules to install lamp on multiple nodes.  Create a directory - lamp/manifests in /etc/puppet/modules  Create a file – init.pp in lamp/manifests (/etc/puppet/modules/lamp/manifests/init.pp)  Add the following lines in init.pp 1. class lamp { 2. // add the code in lamp.pp here 3. }  On puppet master, in site.pp, add the following 1. node default{ include lamp } OR 2. node ‘host-01’ { 3. include lamp 4. } 5. A node block allows you to specify Puppet code that will only apply to certain agent nodes. The default node applies to every agent node that does not have a node block specified  On puppet agent, do the following sudo puppet agent –test --verbose see the output  lamp is installed on agent