Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Developers, Sysadmins, and everyone else: Why ...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Developers, Sysadmins, and everyone else: Why you should be using Serverspec

Sarah Kowalik and Jesse Reynolds
Jan 13 2015, LCA 2015, Auckland
A talk as part of the Miniconf: Developer, Testing, Release and Continuous Integration Automation http://linux.conf.au/schedule/30206/view_talk?day=tuesday

Avatar for Jesse Reynolds

Jesse Reynolds

January 13, 2015
Tweet

More Decks by Jesse Reynolds

Other Decks in Technology

Transcript

  1. #lca2015 Developers, Sysadmins, and everyone else: Why you should be

    using Serverspec Sarah Kowalik & Jesse Reynolds R&D @ Bulletproof
  2. #lca2015 File "/var/log/flapjack/flapjack.log" should be file should be mode 644

    should be owned by "flapjack" (FAILED - 1) 1) File "/var/log/flapjack/flapjack.log" should be owned by "flapjack" On host `127.0.0.1' Failure/Error: it { should be_owned_by 'flapjack' } expected `File "/var/log/flapjack/ flapjack.log".owned_by?("flapjack")` to return true, got false sudo -p 'Password: ' /bin/sh -c stat\ -c\ \%U\ / var/log/flapjack/flapjack.log\ \|\ grep\ --\ \\ \^flapjack\\\$
  3. #lca2015 Command Execution describe command(‘flapjack receiver httpbroker —help’) do its(:exit_status)

    { should eq 0 } its(:stdout) { should match /port/ } its(:stderr) { should match /interval/ } end
  4. #lca2015 Users & Groups describe user('flapjack') do it { should

    exist } it { should belong_to_group 'flapjack' } it { should have_home_directory ‘/opt/flapjack’ } it { should have_login_shell '/bin/bash' } end
  5. #lca2015 Mounted directories describe file('/') do it { should be_mounted.with(

    :type => 'ext4' )} it { should be_mounted.with( :options => { :rw => true } )} end
  6. #lca2015 Host Reachability describe host('target.example.jp') do it { should be_reachable

    } it { should be_reachable.with( :port => 22, :proto => 'tcp' )} end
  7. #lca2015 IIS Application Pool describe iis_app_pool('Default App Pool') do it

    { should exist } it { should have_dotnet_version('2.0') } end
  8. #lca2015 IIS Website describe iis_website('Default Website') do it { should

    be_enabled } it { should be_running } it { should be_in_app_pool('Default App Pool') } it { should have_physical_path('C:\\inetpub\\www') } end
  9. #lca2015 Windows Registry Key describe windows_registry_key('HKEY_USERS \S-1-5-21\Test MyKey') do it

    { should have_property_value('qword value', :type_qword, 'adff32') } it { should have_property_value('binary value', :type_binary, 'dfa0f066') } end
  10. #lca2015 Serverspec deals with both RHEL and Debian families os[:family]

    # RedHat, Ubuntu, Debian and so on os[:release] # OS release version os[:arch] # i386 or x86_64 describe service('flapjack'), :if => os[:family] == 'ubuntu' do it { should be_enabled } end