Puppet and Vagrant in Development   View details and rate at https://joind.in/6709
Puppet and Vagrant in Development   Puppet is:       Automation software to      help   system   admins        manage in...
Puppet and Vagrant in Development   Puppet Components:       Puppet Master       Puppet Agent       Puppet Enterprise ...
Puppet and Vagrant in Development   Third-party Product Needs:       Ruby       Apache HTTP server       Phusion Passe...
Puppet and Vagrant in Development   Supported Operating Systems:       RHEL       CentOS       Ubuntu       Debian   ...
Puppet and Vagrant in Development   Pieces       Modules for        popular        configurations       Compose        ...
Puppet and Vagrant in Development   Workflow       Node informs Puppet Master of status       Puppet Master compiles a ...
Puppet and Vagrant in Development
Puppet and Vagrant in Development   Sample Usages       Roll out another node in a cluster                   Webserver ...
Puppet and Vagrant in Development   Puppet Resources       Puppet defines resources in a arrayish languageUser { dave:  ...
Puppet and Vagrant in Development   Puppet Adding a Resources       What does it look like:$ puppet resource user dave e...
Puppet and Vagrant in Development   Puppet Manifests       Can inform Puppet what to do in bulk using        manifests.$...
Puppet and Vagrant in Development   Puppet Manifest Classes       The Puppet manifests can become complex.Class ntp {   ...
Puppet and Vagrant in Development   Puppet Training       Materials available on PuppetLabs site for FREE        downloa...
Puppet and Vagrant in Development   Provisioned Your Way       VirtualBox – through 3rd party       VMWare – direct Pup...
Puppet and Vagrant in Development   Vagrant       Virtualized development made easy                  Lowers setup time ...
Puppet and Vagrant in Development   Vagrant setup items needed for this example       Get VirtualBox from Oracles downlo...
Puppet and Vagrant in Development   Vagrant Basic How To       Create a directory and change to the new directory       ...
Puppet and Vagrant in Development   Benefits of Using Vagrant       Solo Developers                   Maintain consiste...
Puppet and Vagrant in Development   Vagrant Configuration       Vagrantfile                  Simply Ruby code which typ...
Puppet and Vagrant in Development   Vagrant Base Box       Many base boxes available over the Internet, or you        ca...
Puppet and Vagrant in Development   Testing/Running       To launch the bootup/provision we simply tell        Vagrant “...
Puppet and Vagrant in Development   SSH       Vagrant makes SSH easy to the virtual machine        from within the proje...
Puppet and Vagrant in Development   Provisioning       Using Chef or Puppet we can create a manifest to        alter the...
Puppet and Vagrant in Development   Port Forwarding       By default your host machine should be able to        access t...
Puppet and Vagrant in Development   Packaging       Start with a Base Box                   Customize it as needed, unl...
Puppet and Vagrant in Development   Advanced Capabilities of Vagrant       Many   advanced      topics     available   u...
Puppet and Vagrant in Development   Resources       http://vagrantup.com       http://puppetlabs.com       http://opsc...
Puppet and Vagrant in Development   Thank you                   Adam Culp            http://www.geekyboy.com           ht...
Upcoming SlideShare
Loading in...5
×

Puppet and Vagrant in development

8,910

Published on

Using Puppet and Vagrant to create development environments.

Puppet and Vagrant in development

  1. 1. Puppet and Vagrant in Development View details and rate at https://joind.in/6709
  2. 2. Puppet and Vagrant in Development Puppet is:  Automation software to help system admins manage infrastructure.  Automates provisioning and configuration  Automate repetitive tasks  Ensure stability through consistency  Open source and commercial versions
  3. 3. Puppet and Vagrant in Development Puppet Components:  Puppet Master  Puppet Agent  Puppet Enterprise Console (not in open source)  Puppet Module Tool  Puppet Compliance  Mcollective  Facter
  4. 4. Puppet and Vagrant in Development Third-party Product Needs:  Ruby  Apache HTTP server  Phusion Passenger  ActiveMQ  Ruby on Rails
  5. 5. Puppet and Vagrant in Development Supported Operating Systems:  RHEL  CentOS  Ubuntu  Debian  Scientific Linux  Oracle Linux  SUSE  Solaris  Windows
  6. 6. Puppet and Vagrant in Development Pieces  Modules for popular configurations  Compose application stack needed  Rollout to the node
  7. 7. Puppet and Vagrant in Development Workflow  Node informs Puppet Master of status  Puppet Master compiles a catalog  Node complies with catalog  Puppet Agent on client reports back to Puppet Master  Puppet Master reports to Report Collector.
  8. 8. Puppet and Vagrant in Development
  9. 9. Puppet and Vagrant in Development Sample Usages  Roll out another node in a cluster  Webserver  Email server  Database server  Etc.  Add another workstation  Create lifecycle machine  Development  Testing  Staging  Production
  10. 10. Puppet and Vagrant in Development Puppet Resources  Puppet defines resources in a arrayish languageUser { dave: Ensure => present, uid => 507, gid => admin, shell => /bin/zsh, home => /home/dave, managehome => true,}  We can see the parts of the structure  Type = User  Title = Dave  Attributes  Values
  11. 11. Puppet and Vagrant in Development Puppet Adding a Resources  What does it look like:$ puppet resource user dave ensure=present shell=”/bin/zsh”home=”/home/dave” managehome=true  Would output:Notice: /User[dave]/ensure: createdUser { dave: Ensure => present, uid => 507, gid => admin, shell => /bin/zsh, home => /home/dave, managehome => true,}
  12. 12. Puppet and Vagrant in Development Puppet Manifests  Can inform Puppet what to do in bulk using manifests.$ puppet apply my_test_manifest.pp  Manifest would look like:# /path/to/my_test_manifest.ppUser { dave: Ensure => present, uid => 507, gid => admin, shell => /bin/zsh, home => /home/dave, managehome => true,}
  13. 13. Puppet and Vagrant in Development Puppet Manifest Classes  The Puppet manifests can become complex.Class ntp { package { ntp: ensure => installed, } service { ntp: name => ntpd, ensure => running, enable => true, subscribe => File[ntp.conf], }}
  14. 14. Puppet and Vagrant in Development Puppet Training  Materials available on PuppetLabs site for FREE download.  Learning Puppet Tutorial  Learn Puppet VM to train on (VMWare or VirtualBox)  Module cheatsheet  Core types cheatsheet  Users Guide  Dashboard Manual
  15. 15. Puppet and Vagrant in Development Provisioned Your Way  VirtualBox – through 3rd party  VMWare – direct Puppet support  Cloud – direct Puppet support  Traditional hardware - standard
  16. 16. Puppet and Vagrant in Development Vagrant  Virtualized development made easy  Lowers setup time  Eliminates “works on my machine” excuse  Uses Oracle VirtualBox  Can use Puppet or Chef  FREE and open source
  17. 17. Puppet and Vagrant in Development Vagrant setup items needed for this example  Get VirtualBox from Oracles download page  Install Ruby  Required by Vagrant, Chef and/or Puppet.  Install Vagrant  Talks to VirtualBox and builds virtual machine based on a “base box”.  Decide on whether to use Chef or Puppet.  Enables setup and configuration of advanced services you may need in your environment.
  18. 18. Puppet and Vagrant in Development Vagrant Basic How To  Create a directory and change to the new directory via command line.  Execute three simple commands:$ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box$ vagrant init lucid32$ vagrant up  We now have a working Ubuntu (Lucid Lynx 32 bit) linux server running. However it is very “bare bones”.  List installed Boxes$ vagrant box list
  19. 19. Puppet and Vagrant in Development Benefits of Using Vagrant  Solo Developers  Maintain consistency across multiple projects.  Run multiple environments on a single home machine. (Dev., Test, Staging)  Easily tear down and rebuild  Teams  Identical development environments. Consistent and portable.  Companies  Easier onboarding of new talent.  Build development environment once and distribute to teams.
  20. 20. Puppet and Vagrant in Development Vagrant Configuration  Vagrantfile  Simply Ruby code which typically contains a Vagrant configuration block.  First thing loaded by Vagrant.  Basic file created when init is called from within a directory.  Add more options for more configuration.
  21. 21. Puppet and Vagrant in Development Vagrant Base Box  Many base boxes available over the Internet, or you can create your own. Creation convention should be followed  A base box must be added via local file or HTTP$ vagrant box add {name} {location to pull from}  Or you can remove current base boxes$ vagrant box remove {name}  Base box is defined in the VagrantfileVagrant::Config.run do |config| config.vm.box = “lucid32”end
  22. 22. Puppet and Vagrant in Development Testing/Running  To launch the bootup/provision we simply tell Vagrant “up”.$ vagrant up  Or if you “suspended” to shut down last time you would use “resume”.  To shut down we can either “suspend” to save the current state of the machine (does not return disk space, about 1GB), “destroy” everything (requires re-provision), or “halt” which is a graceful shutdown.$ vagrant destroy$ vagrant halt
  23. 23. Puppet and Vagrant in Development SSH  Vagrant makes SSH easy to the virtual machine from within the project directory.$ vagrant ssh  Project files are available at /vagrant by default, but can be changed.  The VM has both read and write access to the shared folder.  To gain root (su) access the password is vagrant
  24. 24. Puppet and Vagrant in Development Provisioning  Using Chef or Puppet we can create a manifest to alter the VM.  Install apps  Edit config files  Many tasks needed to go from Base Box to desired environment.  Manifests (or recipe for Chef)  Manifests sub-directory within project.  Default.pp is the default file loaded.
  25. 25. Puppet and Vagrant in Development Port Forwarding  By default your host machine should be able to access the virtual machine by IP address. However, we need to activate port forwarding for services.  For HTTP:Vagrant::Config.run do |config| # Forward guest port 80 to host port 4567 config.vm.forward_port 80, 4567end  Then we simply reload Vagrant.$ vagrant reload
  26. 26. Puppet and Vagrant in Development Packaging  Start with a Base Box  Customize it as needed, unless relying solely on provisioning with Chef or Puppet.  Run command to package$ vagrant package –vagrantfile Vagrantfile.pkg  Creates package.box in same directory.  Distribute via raw file or via HTTP, for others.  Other users can now use:$ vagrant box add my_box /path/to/the/package.box$ vagrant init my_box$ vagrant up
  27. 27. Puppet and Vagrant in Development Advanced Capabilities of Vagrant  Many advanced topics available under Documentation on the Vagrant site.  Modules within Manifests to encapsulate Puppet files.  Create your own Base Boxes  Multi-VM Environment  Plugins  NFS Shared Folders
  28. 28. Puppet and Vagrant in Development Resources  http://vagrantup.com  http://puppetlabs.com  http://opscode.com/chef/  http://virtualbox.org View details and rate at https://joind.in/6709
  29. 29. Puppet and Vagrant in Development Thank you Adam Culp http://www.geekyboy.com http://github.com/adamculp Twitter @adamculp

×