On Tuesday 31 January 2012 05:04 PM, Nick wrote:
Ideally, I'd be able to re-deploy a new Cobbler server in exactly the same way
as another node.
Puppet modules which allow automating setting up repos, profiles, systems etc.
don't seem to exist on the public internet.
I've been working on this exact thing (minus the systems because i don't
need them replicated everywhere) in the recent past. It's a bit uncooked
atm so probably not worth sharing as is. Though i can share the general
approach i've been using. For examples, for repos:
define cobbler::repo($mirror, $local = "N") {
$test_command = "/usr/bin/cobbler repo report --name=${name} >
/dev/null"
$params = "--name=${name} --arch=x86_64 --breed=yum
--mirror=$mirror --mirror-locally=$local"
Exec {
require => Cobbler::Distro[$cobbler_distros_list],
}
exec { "/usr/bin/cobbler repo add $params":
unless => $test_command,
}
exec { "/usr/bin/cobbler repo edit $params":
onlyif => $test_command,
}
}
...
And, an actual instance:
cobbler::repo { "EPEL-x86_64":
mirror =>
"http://download.fedora.redhat.com/pub/epel/$lsbmajdistrelease/$architecture"
}
----
Similarly, for profiles:
define cobbler::profile($distro = "centos5.6-x86_64", $kickstart, $repos
= "",$kopts = "") {
$ksdir = "/var/lib/cobbler/kickstarts"
$test_command = "/usr/bin/cobbler profile report --name=${name}
> /dev/null"
$params = " --name=${name} --distro=$distro --repos=\"$repos\"
--kickstart=$ksdir/$kickstart --kopts=\"$kopts\""
Exec {
require => Cobbler::Repo[$cobbler_repos_list],
}
exec { "/usr/bin/cobbler profile add $params":
unless => $test_command,
}
exec { "/usr/bin/cobbler profile edit $params":
onlyif => $test_command,
}
}
...
example usage:
cobbler::profile { "Dell-OMSA-livecd" :
distro => "Dell-OMSA-livecd",
kickstart => "default.ks",
}
cobbler::profile { "linux-rescue" :
kickstart => "default.ks",
kopts => "text rescue",
}
----
It's not really well tested, but in what little testing i did it seemed
to work without noticeable trouble, but YMMV. I'll try to publish the
whole module once it's properly done; in the meanwhile you can probably
use this as a starting point. And do let me know if something doesn't
work for you. And ideas for making it better are welcome, of course.
--
cheers,
siddharth.
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler