SlideShare uma empresa Scribd logo
1 de 19
Introduction to Puppet
Scripting




Shawn S. Smiley
Lead Architect
Achieve Internet
shawn.smiley@achieveinternet.com
What is puppet?

                  “Puppet is IT automation software
                  that helps system administrators
                  manage infrastructure throughout its
                  lifecycle, from provisioning and
                  configuration to patch management
                  and compliance.”




Source: www.puppetlabs.com/puppet/what-is-puppet
What does that mean?

                                       • You can setup a new server in
                                         minutes vs. hours!
                                       • You can be sure your server
                                         configurations are consistent.
                                       • You can easily deploy
                                         configuration changes to
                                         multiple servers.




Image Source: http://www.forbes.com/sites/kenkrogue/2012/09/07/the-most-important-interview-question-never-asked/
Quick Demo




Image source: http://gyaniji.blogspot.com/2011/12/demo-of-ad-posting-job.html
What happened?

• Puppet analyzed the scripts to build a picture of what the
  server should look like.
• Puppet then compared that to what the server actually
  looks like.
• It then generates and executes scripts to make the server
  configuration match that in the puppet scripts.
How vs. What

• Why is it better to describe what a system looks like
  rather than how to configure a system?
• When you describe what a system looks like, you can
  repeatedly rerun the process without fear of breaking the
  system.
• Can build platform independent scripts.
What are the pieces?

•   Puppet Software
•   Module Library
•   Node configuration file
•   [optional] Puppet Master
Modules

What are they?
• Self-contained packages that describe an aspect of a
  system (e.g. “Apache” or “MySQL”)

Are there existing packages I can leverage?
• http://forge.puppetlabs.com
• http://github.com

Where do I put them?
• /usr/share/puppet/modules
• /etc/puppet/modules
File Organization

• manifests
      • site.pp
      • nodes.pp
• modules
      • module1
       • manifests
             init.pp
       • files
       • templates
      • module2
Demo: Folder Structure




Image source: http://gyaniji.blogspot.com/2011/12/demo-of-ad-posting-job.html
Basic Syntax

• Follows basic Ruby language syntax.
• Does not fully implement the Ruby language though, only
  a subset is allowed in your puppet files.
To define an item:                To execute an item:
type title($arg1) {               include “title”
  description of resource state
}                                 type {“title”: }

                                  type {“title”:
                                    arg1 => ‘hello’
                                   }
Demo: Simple script




Image source: http://gyaniji.blogspot.com/2011/12/demo-of-ad-posting-job.html
Resource Types

• Are puppet libraries that are used to interact with the
  system.
• Puppet comes with a wide range of resource types:
       •   exec
       •   package
       •   file
       •   service
       •   notify
Full list:
http://docs.puppetlabs.com/references/latest/type.html
Facter

What are facts?
• Global variables with information about the system that
  the script is running on.

How do I see the available variables?
• facter -p

How do I use them?
• $::variable_name
Templates

• Templates are files that use a simple markup language to
  insert dynamic values.
• Templates have an .erb extension
• Typically used with the File resource. e.g.:

   file {'ntp.conf':
     path => '/etc/ntp.conf',
     ensure => file,
     content => template('ntp/ntp.conf.erb'),
     owner => root,
     mode => 0644,
   }
Relationships

• Package[“ntp”] -> File[„ntp.conf‟] ~> Service[„ntpd‟]
• “before”, “require”
• “subscribe”, “notify”



http://docs.puppetlabs.com/puppet/2.7/reference/lang_relati
onships.html#relationship-metaparameters

http://docs.puppetlabs.com/puppet/2.7/reference/lang_relati
onships.html#chaining-arrows
User-Defined Types

• Similar to functions in most languages.
• Only way to do iterations currently.
         • Call the Type with an array.


 define apache::vhost() {
   $docroot = “/var/www/${name}”
 }

 $sites = [‘site1’, ‘site2’]
 apache::vhost {$sites: }
References

Books
• Managing Infrastructure with Puppet
  (ISBN: 978-1-4493-0763-9)
• Pro Puppet (ISBN: 978-1-4302-3057-1)

Websites
• http://www.puppetlabs.com
• http://docs.puppetlabs.com/
• http://forge.puppetlabs.com/
Q&A

Mais conteúdo relacionado

Mais procurados

Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
andymccurdy
 
Using Puppet - Real World Configuration Management
Using Puppet - Real World Configuration ManagementUsing Puppet - Real World Configuration Management
Using Puppet - Real World Configuration Management
James Turnbull
 

Mais procurados (20)

Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & Ansible
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Using Puppet - Real World Configuration Management
Using Puppet - Real World Configuration ManagementUsing Puppet - Real World Configuration Management
Using Puppet - Real World Configuration Management
 
Learn Puppet : Quest Guide for the Learning VM
Learn Puppet : Quest Guide for the Learning VMLearn Puppet : Quest Guide for the Learning VM
Learn Puppet : Quest Guide for the Learning VM
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Using Puppet in Small Infrastructures
Using Puppet in Small InfrastructuresUsing Puppet in Small Infrastructures
Using Puppet in Small Infrastructures
 
Ansible Case Studies
Ansible Case StudiesAnsible Case Studies
Ansible Case Studies
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
Portland PUG April 2014: Beaker 101: Acceptance Test EverythingPortland PUG April 2014: Beaker 101: Acceptance Test Everything
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
 
Ansible
AnsibleAnsible
Ansible
 
Augeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeAugeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet tree
 
Network automation (NetDevOps) with Ansible
Network automation (NetDevOps) with AnsibleNetwork automation (NetDevOps) with Ansible
Network automation (NetDevOps) with Ansible
 
De-centralise and Conquer: Masterless Puppet in a Dynamic Environment
De-centralise and Conquer: Masterless Puppet in a Dynamic EnvironmentDe-centralise and Conquer: Masterless Puppet in a Dynamic Environment
De-centralise and Conquer: Masterless Puppet in a Dynamic Environment
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 
Superb Supervision of Short-lived Servers with Sensu
Superb Supervision of Short-lived Servers with SensuSuperb Supervision of Short-lived Servers with Sensu
Superb Supervision of Short-lived Servers with Sensu
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
 

Destaque (8)

The importance of puppets
The importance of puppetsThe importance of puppets
The importance of puppets
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with Puppet
 
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
 
Introduction to Puppetry
Introduction to PuppetryIntroduction to Puppetry
Introduction to Puppetry
 
Demystifying TLS
Demystifying TLSDemystifying TLS
Demystifying TLS
 
Puppets ppt
Puppets pptPuppets ppt
Puppets ppt
 
Introduction to Puppet Enterprise
Introduction to Puppet EnterpriseIntroduction to Puppet Enterprise
Introduction to Puppet Enterprise
 
College fest anchoring script
College fest anchoring scriptCollege fest anchoring script
College fest anchoring script
 

Semelhante a Introduction to Puppet Scripting

State of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DCState of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DC
Puppet
 

Semelhante a Introduction to Puppet Scripting (20)

Ansible top 10 - 2018
Ansible top 10 -  2018Ansible top 10 -  2018
Ansible top 10 - 2018
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Puppet talk at OSCON 2010.
Puppet talk at OSCON 2010.Puppet talk at OSCON 2010.
Puppet talk at OSCON 2010.
 
DCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production ParityDCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production Parity
 
Portable infrastructure with puppet
Portable infrastructure with puppetPortable infrastructure with puppet
Portable infrastructure with puppet
 
Ansible: What, Why & How
Ansible: What, Why & HowAnsible: What, Why & How
Ansible: What, Why & How
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
 
Devops
DevopsDevops
Devops
 
Puppet Keynote by Ralph Luchs
Puppet Keynote by Ralph LuchsPuppet Keynote by Ralph Luchs
Puppet Keynote by Ralph Luchs
 
Puppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPuppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for Deployments
 
PowerPoint Presentation
PowerPoint PresentationPowerPoint Presentation
PowerPoint Presentation
 
Habitat Overview
Habitat OverviewHabitat Overview
Habitat Overview
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
 
Top 10 dev ops tools (1)
Top 10 dev ops tools (1)Top 10 dev ops tools (1)
Top 10 dev ops tools (1)
 
State of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DCState of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DC
 
Ninja, Choose Your Weapon!
Ninja, Choose Your Weapon!Ninja, Choose Your Weapon!
Ninja, Choose Your Weapon!
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
 

Mais de Achieve Internet

Drupal secure code checklist
Drupal secure code checklistDrupal secure code checklist
Drupal secure code checklist
Achieve Internet
 

Mais de Achieve Internet (11)

Planning & Executing Custom Drupal Integration Projects
Planning & Executing Custom Drupal Integration ProjectsPlanning & Executing Custom Drupal Integration Projects
Planning & Executing Custom Drupal Integration Projects
 
Communicating Drupal: Documentation and Discovery
Communicating Drupal: Documentation and DiscoveryCommunicating Drupal: Documentation and Discovery
Communicating Drupal: Documentation and Discovery
 
Advancing Healthcare Technology with Open Source Software
Advancing Healthcare Technology with Open Source SoftwareAdvancing Healthcare Technology with Open Source Software
Advancing Healthcare Technology with Open Source Software
 
Showcasing Human Capital: How to Effectively Market a Professional Services Firm
Showcasing Human Capital: How to Effectively Market a Professional Services FirmShowcasing Human Capital: How to Effectively Market a Professional Services Firm
Showcasing Human Capital: How to Effectively Market a Professional Services Firm
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Drupal secure code checklist
Drupal secure code checklistDrupal secure code checklist
Drupal secure code checklist
 
Helping the LatinGRAMMYs Reach a Global Audience
Helping the LatinGRAMMYs Reach a Global Audience Helping the LatinGRAMMYs Reach a Global Audience
Helping the LatinGRAMMYs Reach a Global Audience
 
Drupal and the Future of Healthcare
Drupal and the Future of HealthcareDrupal and the Future of Healthcare
Drupal and the Future of Healthcare
 
Responsive Web Design_2013
Responsive Web Design_2013Responsive Web Design_2013
Responsive Web Design_2013
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Introduction to Puppet Scripting

  • 1. Introduction to Puppet Scripting Shawn S. Smiley Lead Architect Achieve Internet shawn.smiley@achieveinternet.com
  • 2. What is puppet? “Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance.” Source: www.puppetlabs.com/puppet/what-is-puppet
  • 3. What does that mean? • You can setup a new server in minutes vs. hours! • You can be sure your server configurations are consistent. • You can easily deploy configuration changes to multiple servers. Image Source: http://www.forbes.com/sites/kenkrogue/2012/09/07/the-most-important-interview-question-never-asked/
  • 4. Quick Demo Image source: http://gyaniji.blogspot.com/2011/12/demo-of-ad-posting-job.html
  • 5. What happened? • Puppet analyzed the scripts to build a picture of what the server should look like. • Puppet then compared that to what the server actually looks like. • It then generates and executes scripts to make the server configuration match that in the puppet scripts.
  • 6. How vs. What • Why is it better to describe what a system looks like rather than how to configure a system? • When you describe what a system looks like, you can repeatedly rerun the process without fear of breaking the system. • Can build platform independent scripts.
  • 7. What are the pieces? • Puppet Software • Module Library • Node configuration file • [optional] Puppet Master
  • 8. Modules What are they? • Self-contained packages that describe an aspect of a system (e.g. “Apache” or “MySQL”) Are there existing packages I can leverage? • http://forge.puppetlabs.com • http://github.com Where do I put them? • /usr/share/puppet/modules • /etc/puppet/modules
  • 9. File Organization • manifests • site.pp • nodes.pp • modules • module1 • manifests  init.pp • files • templates • module2
  • 10. Demo: Folder Structure Image source: http://gyaniji.blogspot.com/2011/12/demo-of-ad-posting-job.html
  • 11. Basic Syntax • Follows basic Ruby language syntax. • Does not fully implement the Ruby language though, only a subset is allowed in your puppet files. To define an item: To execute an item: type title($arg1) { include “title” description of resource state } type {“title”: } type {“title”: arg1 => ‘hello’ }
  • 12. Demo: Simple script Image source: http://gyaniji.blogspot.com/2011/12/demo-of-ad-posting-job.html
  • 13. Resource Types • Are puppet libraries that are used to interact with the system. • Puppet comes with a wide range of resource types: • exec • package • file • service • notify Full list: http://docs.puppetlabs.com/references/latest/type.html
  • 14. Facter What are facts? • Global variables with information about the system that the script is running on. How do I see the available variables? • facter -p How do I use them? • $::variable_name
  • 15. Templates • Templates are files that use a simple markup language to insert dynamic values. • Templates have an .erb extension • Typically used with the File resource. e.g.: file {'ntp.conf': path => '/etc/ntp.conf', ensure => file, content => template('ntp/ntp.conf.erb'), owner => root, mode => 0644, }
  • 16. Relationships • Package[“ntp”] -> File[„ntp.conf‟] ~> Service[„ntpd‟] • “before”, “require” • “subscribe”, “notify” http://docs.puppetlabs.com/puppet/2.7/reference/lang_relati onships.html#relationship-metaparameters http://docs.puppetlabs.com/puppet/2.7/reference/lang_relati onships.html#chaining-arrows
  • 17. User-Defined Types • Similar to functions in most languages. • Only way to do iterations currently. • Call the Type with an array. define apache::vhost() { $docroot = “/var/www/${name}” } $sites = [‘site1’, ‘site2’] apache::vhost {$sites: }
  • 18. References Books • Managing Infrastructure with Puppet (ISBN: 978-1-4493-0763-9) • Pro Puppet (ISBN: 978-1-4302-3057-1) Websites • http://www.puppetlabs.com • http://docs.puppetlabs.com/ • http://forge.puppetlabs.com/
  • 19. Q&A

Notas do Editor

  1. Startup an AWS instance and run puppet apply to show what puppet does.
  2. Default modulepath: /etc/puppet/modules:/usr/share/puppet/modules
  3. Show the File Structure and examples of some modules.
  4. Defining an item is called a “Resource Declaration”
  5. Demo a simple module: The Lynx module.