CodeFest 2013. Mosesohn M. — Automating environments with Cobbler

687 views
601 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
687
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
24
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

CodeFest 2013. Mosesohn M. — Automating environments with Cobbler

  1. 1. Cobbler forDevelopersMatthew Mosesohn Mirantis IT
  2. 2. Developers? Uniformity?
  3. 3. Why Cobbler?Simple system to automate installation andpreparation of systems.Reduces the amount of time needed to beginan installation.Provides a flexible, intuitive means to managea large number of systems to meet your needs.
  4. 4. Why Cobbler?● Simple web UI and command line● Robust template interface via Cheetah● Built to save time● Open source● Mature
  5. 5. Cobbler historyDeveloped by DevOps engineer MichaelDeHaan (former Red Hat employee)Primary goal to simplify installationSoftware environments require frequentreinstallations
  6. 6. Manual network kickstart method● Set up DHCP server to point to TFTP server● Configure TFTP with pxelinux.0 and installation tree● Either handwrite MAC addresses for each host or present a menu and manually choose● No scaleability● No templating● No reporting
  7. 7. When do you need Cobbler?Scenarios:● Complex software with many components● Testing clustering software● Testing software suites with no reset option available● Continuous integration (CI) testing● Isolated network environment● Rapidly changing hardware
  8. 8. When Cobbler is not appropriateScenarios:● Simple application development● Legacy system development● Where automation is not possible● Windows
  9. 9. Continuous IntegrationOverview:● High pace development style● Automated deployment● Integrate and test software● Test every commit● Similar to production environment
  10. 10. Continuous IntegrationAdvantages:● Saves time and money● Enables sophisticated QA● Early warning of bugs● Communication● Develops metrics for analysis
  11. 11. Continuous IntegrationDisadvantages:● Setup time investment● Full automation development
  12. 12. CI example: JenkinsJenkins is a fork from HudsonJava basedSupports many SCM formats, including:● git● subversion● mercurial● cvsAutomate testing based on SCM changes orregular schedule
  13. 13. Typical Uses● DNS/DHCP management of a company infrastructure● Automation of installation of servers via PXE● Power cycling of systems via ipmitool● Local package repository mirror● Simplified, standard installation process
  14. 14. What you should know already● How to build virtual machines● How to configure a DHCP server ○ hostnames ○ MAC addresses ○ gateway● Where to find installation media for your system (DVD and/or package repositories)
  15. 15. ConsiderationsScale:● How many sites● Concurrent installations● Number of systemsComplexity:● Linux distros● System builds● Localization● Post-installation scripts
  16. 16. Simple case: single node with virt Internet:● Create a private OS files package virtual network repositories● Two VMs● VM 1 is CentOS VM 1 Linux host● VM 2 is Ubuntu Cobbler server VM 2 System OS files configurati packages on
  17. 17. Common use case: Development lab Internet: OS files package repositories Development Lab System1 System2 Cobbler server System3 System4 System5 System6 OS files System packages configuration
  18. 18. Unattended install script
  19. 19. Create kickstart file● Set up install method● Configure disks● Configure language/keyboard/time● Configure default package set● Specify scripts in %post for automation
  20. 20. Example kickstart for installationinstallrebootlang en_USnetwork --bootproto=dhcpkeyboard usclearpart --allpart / --size 500 --growpart swap --recommended#set timezonetimezone --utc US/Eastern
  21. 21. Example kickstart for installation#set root passwordrootpw changeme#rootpw --iscrypted $1$Rig3dbXb$OWcv00J/V2WsBGcgx0bmp1%packages@baseopenssh-serveropenssh-client%post#Your script here
  22. 22. Debian/Ubuntu preseed file#Langd-i debian-installer/locale string en_GB.UTF-8d-i console-setup/ask_detect boolean falsed-i keyboard-configuration/layoutcode string us#Netd-i netcfg/enable boolean trued-i netcfg/get_hostname string system01d-i netcfg/get_domain string example.com
  23. 23. Debian/Ubuntu preseed file### Mirror settingsd-i mirror/country string russiad-i mirror/http/hostname string archive.ubuntu.comd-i mirror/http/directory string /ubuntud-i mirror/suite string precised-i clock-setup/utc boolean trued-i time/zone string US/Eastern
  24. 24. Debian/Ubuntu preseed file## Account setupd-i passwd/root-password-crypted password [MD5 hash]d-i passwd/user-fullname string Ubuntu Userd-i passwd/username string ubuntud-i passwd/user-password-crypted password [MD5 hash]### Apt setupd-i apt-setup/restricted boolean trued-i apt-setup/universe boolean trued-i apt-setup/backports boolean truetasksel tasksel/first multiselect lamp-server, print-server
  25. 25. Debian/Ubuntu (contd)d-i preseed/early_command string your_pre_installation_scriptd-i preseed/late_command string your_post_installation_script
  26. 26. Preinstallation script● Useful for a disclaimer, warning, or safety message.● Disk configuration manual steps
  27. 27. Postinstallation script● Custom downloaded files/settings/scripts● Enable configuration management● Set up SSH keys● Custom authentication if not possible through preseed/kickstart
  28. 28. Cobbler kickstart extra features● You can store snippets and call them in multiple kickstarts● You can use Cheetah template code directly in a kickstart (just prepend with #). Syntax similar to PythonExamples:%post$SNIPPET(ntp_register)%packages#set $hostname = $getVar($hostname, None)#if test in $hostname or devel in $hostname@development#end if
  29. 29. Working with variablescobbler system dumpvars --name=systemBuilt-in variables:● $mac_address● $ip_address● $hostname● $distro● $profile● $server
  30. 30. Flexibility with variables● Set custom variables in ksmeta section.● Profile variables override distro variables.● System variables override profile variables.● Use getVar(var-name,default-value) in cases where an empty string would break your installation ○ RH: rootpw $getVar(rootpw,changeme) ○ Deb: d-i passwd/root-password-crypted password $getVar (rootmd5,$1$Rig3dbXb$OWcv00J/V2WsBGcgx0bmp1)
  31. 31. Adding systems to Cobbler
  32. 32. Add your distro● Download base OS media● mount -oloop /mnt/iso /path/to/os.iso● cobbler import --path /mnt/iso -- name=distro_name
  33. 33. Adding profiles to Cobbler● Log into Cobbler Web● Add new profile with your distro and kickstart
  34. 34. Remote install options● Manual entry of systems ○ Requires MAC address● PXE menu ○ Requires manual interaction on boot● koan/virt-install ○ Create a virtual machine or reinstall existing system and specify Cobbler server and profile to use
  35. 35. Koan examplesReinstall a host:● koan --server=cobbler.example.org -- replace-self --profile=nameCreate a new virtual machine:● koan --server=cobbler.example.org --virt -- system=name
  36. 36. Further automation Puppet Squid proxy Jenkins Continuous integration
  37. 37. Known limitationsUbuntu installation works, but there are someissues with virt-install for Ubuntu guestsScaling and redundancy
  38. 38. Summary● Cobbler allows you to automate installations● Cobbler fits into CI testing● Cobbler saves time● Cobbler is extendable via Cheetah template engine
  39. 39. Thank you!Questions?
  40. 40. Additional readinghttps://www.redhat.com/about/news/archive/2008/4/provisioning-our-new-middleware-architecturehttps://github.com/cobbler

×