• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Geeky Academy Week 3 :: Vagrant + Puppet
 

Geeky Academy Week 3 :: Vagrant + Puppet

on

  • 1,318 views

Geeky Academy Week 3 :: Vagrant + Puppet

Geeky Academy Week 3 :: Vagrant + Puppet
- Vagrant 101
- Vagrant 201
- Vagrant 301

Statistics

Views

Total Views
1,318
Views on SlideShare
1,318
Embed Views
0

Actions

Likes
6
Downloads
40
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Geeky Academy Week 3 :: Vagrant + Puppet Geeky Academy Week 3 :: Vagrant + Puppet Presentation Transcript

    • VAGRANT 3rd WEEK SATURDAY, JULY 06, 2013 – SUNDAY, JULY 07, 2013 GEEK ACADEMY 2013
    • INSTRUCTOR TEAM TAVEE SOMKIAT THAWATCHAI Tavee (Vee) Khunbida Somkiat (Pui) Puisungnuen Thawatchai (Boy) Jongsuwanpaisan Siam Chamnan Kit tavee@sprint3r.com Siam Chamnan Kit somkiat@sprint3r.com Siam Chamnan Kit thawatchai@sprint3r.com
    • What Vagrant ? o http://www.vagrantup.com/ o Based on VirtualBox and Ruby o Manage VM with Simple Command line o Run on o Windows o Linux o Mac OS
    • VAGRANT 101 GEEK ACADEMY 2013
    • Simple Command Line $ gem install vagrant $ vagrant box add base <box url> $ vagrant init $ vagrant up
    • Step 1 :: Installation with Ruby Gem $ gem install vagrant
    • Step 2 :: Add Base Box $ vagrant box add base http://files.vagrantup.com/precise32.box ……. [vagrant] Downloading withVagrant::Downloaders::File... [vagrant] Copying box to temporary location... [vagrant] Extracting box... [vagrant]Verifying box... [vagrant] Cleaning up downloaded box...
    • Step 2.1 :: Where is my box ? o http://www.vagrantbox.es/
    • Step 3 :: Configuration $ vagrant init ….. A `Vagrantfile` has been placed in this directory.You are now ready to `vagrant up` your first virtual environment! Please read the comments in theVagrantfile as well as documentation on `vagrantup.com` for more information on usingVagrant.
    • Vagrantfile Vagrant::Config.run do |config| config.vm.box = "base“ end
    • Step 4 :: Boot $ vagrant up …. [default] Importing base box 'base'... [default] Matching MAC address for NAT networking... [default] Clearing any previously set forwarded ports... [default] Fixed port collision for 22 => 2222. Now on port 2200. [default] Forwarding ports... [default] -- 22 => 2200 (adapter 1) [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] BootingVM... [default] Waiting forVM to boot.This can take a few minutes.
    • Ready to SSH User=vagrant Password=vagrant
    • Optional Command $ vagrant status $ vagrant halt $ vagrant destroy $ vagrant reload $ vagrant provision $ vagrant suspend $ vagrant resume
    • Summary for 101 o Reduce setup time o Simple o Self-service o Consistency o Repeat
    • VAGRANT 201 GEEK ACADEMY 2013 https://github.com/up1/geeky_devops
    • Working with Vagrantfile o Specified base box o Network Configuration o Sharing Folder o MultipleVM
    • Specified Base Box Vagrant::Config.run do |config| config.vm.box = "lucid32“ config.vm.box_url = "http://files.vagrantup.com/lucid32.box" config.vm.box_url = "c:demo-geekylucid32.box" end
    • Network Configuration Vagrant::Config.run do |config| config.vm.network :hostonly, "33.33.33.10" end
    • Sharing Folder Vagrant::Config.run do |config| config.vm.share_folder "foo", "/guest/path", "/host/path" end Path on VM Path on Local
    • Sharing Folder Vagrant::Config.run do |config| config.vm.share_folder "work", "/var/www", "./webapp” end
    • Multiple VM in Stack o Web Server o Application Server o Database Server o Caching Server o Messaging Server
    • Web Server and DB Server Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.host_name = "web01.internal" web_config.vm.network :hostonly, "192.168.0.100" end config.vm.define :db do |db_config| db_config.vm.host_name = "db01.internal" db_config.vm.network :hostonly, "192.168.0.101" end end
    • DEMO MORE o Flexible configuration o # of Server o Hostname o Manage IP
    • DEMO MORE o Web Server o web-01.vagrant.internal 33.33.33.11 o web-02.vagrant.internal 33.33.33.12 o DB Server o db-01.vagrant.internal 33.33.33.21
    • Servers nodes = { 'web' => [2, 10], 'db' => [1, 20], }
    • Create Servers nodes.each do |prefix, (count, ip_start)| count.times do |i| hostname = "%s-%02d" % [prefix, (i+1)] config.vm.define "#{hostname}" do |box| box.vm.host_name = "#{hostname}.vagrant.internal" box.vm.network :hostonly, "33.33.33.#{ip_start+i}“ end end end
    • VAGRANT 301 GEEK ACADEMY 2013
    • Vagrant with Puppet o https://puppetlabs.com o Configuration management with Code o Ruby o Repeatable
    • Demo :: Install all in one o Manage package with Puppet o Java o Apache Tomcat o Redis o RabbitMQ https://github.com/up1/geeky_devops demo-puppet
    • Structure of Puppet o puppet o manifests/default.pp o modules o java o manifests/init.pp o tomcat o manifests/init.pp o redis o manifests/init.pp o rabbitMQ o manifests/init.pp Starting point
    • Vagrantfile config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.manifest_file = "default.pp" puppet.module_path = "puppet/modules" end Vagrant provision Starting point
    • Default.pp include bootstrap include redis include java include tomcat include rabbitmq Step to execute modules
    • Structure of Puppet o puppet o manifests/default.pp o modules o java o manifests/init.pp o tomcat o manifests/init.pp o redis o manifests/init.pp o rabbitMQ o manifests/init.pp Starting point each module
    • Init.pp :: Java class java { package { "openjdk-7-jdk": ensure => installed, require => Exec['apt-get update'] } }
    • Init.pp :: Package Apache Tomcat class tomcat { package { "tomcat6": ensure => installed, require => Package['openjdk-7-jdk'], } package { "tomcat6-admin": ensure => installed, require => Package['tomcat6'], } }
    • Init.pp :: Service Apache Tomcat class tomcat { service { "tomcat6": ensure => running, require => Package['tomcat6'], subscribe => File["tomcat-users.xml"] } }
    • Init.pp :: Tomcat-users.xml class tomcat { file { "tomcat-users.xml": owner => 'root', path => '/etc/tomcat6/tomcat-users.xml', require => Package['tomcat6'], notify => Service['tomcat6'], content => template( '/path/tomcat/templates/tomcat- users.xml.erb') } }
    • Tomcat-users.xml.erb <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <user name="tomcat-admin" password="12345" roles="manager,admin"/> </tomcat-users>
    • More Demo o https://github.com/up1/geeky_devops o demo-multi-puppet box.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.manifest_file = "#{prefix}.pp" puppet.module_path = "puppet/modules" end
    • Question ?
    • GEEK ACADEMY 2013
    • THANK YOU FOR YOUR TIME GEEK ACADEMY 2013