puppetcamp sea 1 - version control with puppet

23
Version Control with Puppet Choon Ming Goh CDN Division [email protected]

Upload: olindata

Post on 19-Jun-2015

291 views

Category:

Technology


6 download

DESCRIPTION

Choon Ming Goh, System Administrator at OnApp Malaysia, gave a presentation on how OnApp implements version control. Since they have quite a few repositories, this is all puppetised and that is quite a nice way of doing version control.

TRANSCRIPT

Page 1: PuppetCamp SEA 1 - Version Control with Puppet

Version Control with Puppet

Choon Ming Goh CDN Division

[email protected]

Page 2: PuppetCamp SEA 1 - Version Control with Puppet

About

System Administrator Backend Developer Puppet user Cloud industry Builds CDN software

Page 3: PuppetCamp SEA 1 - Version Control with Puppet

Why version control?

Page 4: PuppetCamp SEA 1 - Version Control with Puppet

Versioning

Page 5: PuppetCamp SEA 1 - Version Control with Puppet

Coordination

Page 6: PuppetCamp SEA 1 - Version Control with Puppet

Centralised repository

Page 7: PuppetCamp SEA 1 - Version Control with Puppet

Accountability

Page 8: PuppetCamp SEA 1 - Version Control with Puppet

Experimentation

Page 9: PuppetCamp SEA 1 - Version Control with Puppet

What do I use?

Page 10: PuppetCamp SEA 1 - Version Control with Puppet

Git and Subversion

Page 11: PuppetCamp SEA 1 - Version Control with Puppet

How do I do that?

Page 12: PuppetCamp SEA 1 - Version Control with Puppet

Defined Types

Page 13: PuppetCamp SEA 1 - Version Control with Puppet

define subversion::create($user = false, $group = false) { include subversion::aflexi $user_real = $user ? { false => 0, default => $user } $group_real = $group ? { false => 0, default => $group } Exec { path => "/usr/bin:/bin:/opt/local/bin:/usr/local/bin", } exec { "svnadmin-create-$name": command => "/usr/bin/svnadmin create $name", creates => "$name/db", user => $user_real, group => $group_real, environment => "HOME=''", } }

Page 14: PuppetCamp SEA 1 - Version Control with Puppet

define git::workdir($repository, $local_container, $local_name = false, $post_checkout_script = undef, $post_update_script = undef, $runas_user = "root", $runas_group = "root", $branch = "master") { $owner_real = $owner ? { false => 0, default => $owner } $group_real = $group ? { false => 0, default => $group } $local_name_real = $local_name ? { false => $name, default => $local_name } exec { "git-clone-$name": command => "git clone --branch '$branch' '$repository' '$local_name_real'", cwd => $local_container, require => [ File["$local_container"], Package["git-core"]], creates => "$local_container/$local_name_real/.git", } exec { "git-pull-$name": command => "git pull", cwd => "$local_container/$local_name_real", require => Exec["git-clone-$name"], } }

Page 15: PuppetCamp SEA 1 - Version Control with Puppet

What's next?

Page 16: PuppetCamp SEA 1 - Version Control with Puppet

subversion::create { "/var/lib/svn/$svnrepo": user => "www-data", group => "www-data", }

Page 17: PuppetCamp SEA 1 - Version Control with Puppet

git::workdir { "mygitrepo": repository => $portal_src, local_container => "/etc/puppet/", local_name => "mygitrepo", branch => $portal_branch, }

Page 18: PuppetCamp SEA 1 - Version Control with Puppet

Why do I want to puppetize it?

Page 19: PuppetCamp SEA 1 - Version Control with Puppet

Quick setup for another puppetmaster

Page 20: PuppetCamp SEA 1 - Version Control with Puppet

Almost not necessary to change manifests manually ever!

Page 21: PuppetCamp SEA 1 - Version Control with Puppet

Fix what you break policy

Page 22: PuppetCamp SEA 1 - Version Control with Puppet

Questions?

Page 23: PuppetCamp SEA 1 - Version Control with Puppet

Contact

[email protected] Twitter - @choonming IRC – Freenode #puppet, #myoss, #debian choonming Skype – gchoonming (please identify yourself) Gtalk – choonming2002 (please identify yourself)