Your SlideShare is downloading. ×

Vagrant & CFEngine - LOPSA East 2013


Published on

LOPSA East 2013: New Brunswick, NJ

Getting started with Vagrant and CFEngine.
Walk away with a cross platform (Windows, Mac, Linux) demo environment consisting of one CFEngine hub and 2 nodes using a dynamic Vagrant configuration and some example CFEngine 3 policy to get you started.

If you attended or watched the video of this presentation (link to be added) please consider filling out the trainer survey.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. www.cfengine.comVagrant & CFEngine
  • 2. 5/2/13Hi, my name is Nick.● Sysadmin > 10 Yers● Work @CFEngine● Live in Lawrence, KS● @cmdln_●
  • 3. 5/2/13Who are you?● Whats your name?● Are you a sysadmin?● Why did you choosethis session?
  • 4. 5/2/13What is Vagrant?Tool to make working withdevelopment environmentseasy.Create, configure, destroylightweight, reproducible,and portable environments.● Created by Mitchell Hashimoto● @mitchelh●
  • 5. 5/2/13Provides common environmentDesignersDevelopersOperationsQA
  • 6. 5/2/13Easy to usevagrant upvagrant destroy!-2
  • 7. 5/2/13Portable● VirtualBox● AWS● VMware● More●
  • 8. 5/2/13How can it help?● Developeron-boarding● Quickly setup/teardown testenvironments inrepeatable fashion● CI● Bug Validation● Ad-hoc Demos
  • 9. 5/2/13Install Virtualbox
  • 10. 5/2/13Install Vagranthttp://downloads.vagrantup.comresources/installers/vagrant
  • 11. 5/2/13Vagrantfile● Describe the type of machine(s) required for a project● Syntax of Vagrantfile is Ruby, but knowledge of the Ruby language is notnecessary. Its mostly simple variable assignment.Vagrant.configure("2") do |config|# All Vagrant configuration is done here. The most common configuration# options are documented and commented below. For a complete reference,# please see the online documentation at Every Vagrant virtual environment requires a box to build off = "centos-5.x-i386_nickanderson_201304271927"end
  • 12. 5/2/13Boxes● Predefined operating system install● Provider specific●● Veewee (build your own) thanks@patrickdebois– Kickstart/preseed, postinstall scripts
  • 13. 5/2/13Automagic● Ssh automatic port forwards● Shared project folder /vagrant
  • 14. 5/2/13vagrant-vbguest● Vagrant plug-in which automatically installs thehosts VirtualBox Guest Additions on the guestsystem.● vagrant plug-in install vagrant-vbguest● If youre lucky, vagrant-vbguest does not requireany configurations. However, here is an exampleconfig.vbguest.auto_update = true/false●
  • 15. 5/2/13Getting started● vagrant box list● vagrant box add● vagrant init● vagrant status● vagrant up● vagrant ssh● vagrant destroy● vagrant up● vagrant status● vagrant ssh– vagrant ssh node● vagrant destroy
  • 16. 5/2/13This is fantastic!
  • 17. 5/2/13Build base boxes for all the things!
  • 18. Black Hole
  • 19. 5/2/13Automating Vagrant Provisioning● Ansible● CFEngine● Chef● Puppet● Salt Stack● Shell Scripts● MixnMatch!
  • 20. 5/2/13CFEngine● IT infrastructure automation, compliance, andknowledge management framework● Opensource and Commercial Software● Originally written by Mark Burgess● @markburgess_osl●
  • 21. 5/2/13CFEngine History● First released in 1993● CFEngine 2 released in 1998, self healingcomputer immunology. Added machinelearning and anomaly detection.● 2003 Promise Theory work began● 2008 CFEngine 3 released. Integratesknowledge management and discoverymechanisms.
  • 22. 5/2/13CFEngine Properties● Declarative syntax (Promises)
  • 23. 5/2/13Promise Theory● A model of voluntary cooperation betweenindividual, autonomous actors or agentswho publish their intentions to one anotherin the form of promises.● A file can make promises about its owncontents, permissions, existence etc …● A process can make a promise that it will berunning, number of matching processes,owner etc ...
  • 24. 5/2/13CFEngine Properties● Declarative syntax (Promises)● Pull model● Convergence
  • 25. 5/2/13CFEngine Components● cf-agent – instigator of change● cf-execd – cf-agent launcher daemon andoutput processor● cf-serverd – File server, also listens for remoterequests to execute cf-agent● cf-monitord – statistical information collector
  • 26. 5/2/13So why is this a good thing?● Make changes in minutes with precision● Easier to share specific configuration details● Brings configuration knowledge to theforefront
  • 27. 5/2/13Bootstrap a test environment
  • 28. 5/2/13Editor War!● I prefer vim, and its fun to mess withthe emacs people● services/
  • 29. 5/2/13Definitions● Policy - A policy is a set of intentions about the system, coded as a list of promises. A policy isnot a standard, but the result of specific organizational management decisions.● Promise - The CFEngine software manages every intended system outcome as `promises tobe kept. A CFEngine Promise corresponds roughly to a rule in other software products, butimportantly promises are always things that can be kept and repaired continuously, on a realtime basis, not just once at install-time.● Bundle – A collection of promises that has a name● Body - A promise body is the description of exactly what is promised (as opposed to what/whois making the promise). The term `body is used in the CFEngine syntax to mean a smalltemplate that can be used to contribute as part of a larger promise body.● Promiser – The object that makes a promise. (file, package, process, command, ect …)● Promisee (stakeholder) – Who cares about a specific promise.● Class (context) – True/False propositions. All decisions are made with classes. Hard(discovered/builtin) and soft (user-defined).
  • 30. 5/2/13Wage War● Remove Disallowed Packages– vagrant ssh hub– watch rpm -q emacs-nox– Uncomment disallowed_packages to activate policy.Watch it get fixed.● Install Required Packages– watch rpm -q vim-enhanced– Uncomment required_packages to activate policy
  • 31. 5/2/13More Nodes!● Increase nodes to 2 in Vagrantfile● vagrant up● vagrant ssh node00{1,2}
  • 32. 5/2/13Webserver● services/● Activated from bundle agent main● Lets ensure its present and on– node001 http://localhost:9003– node002 http://localhost:9004
  • 33. 5/2/13Questions/Discussion?
  • 34. 5/2/13Thank You!
  • 35. Please fill out the Trainer EvaluationPlease fill out the Trainer EvaluationRate LOPSA-East ‘13Rate LOPSA-East ‘13 You for Attending LOPSA-East ‘13Thank You for Attending LOPSA-East ‘13