Ugh, Exec tasks.   Not good, and quite limited.

If you're going to do it, you at *minimum* should write a provider so that you can express all the attributes you would
want to express, and then, at that level, you have to use the XMLRPC API.

Even then though, I think Puppet is completely the wrong tool for the job -- you need Cobbler running in your infrastructure
first to bring up that boot server.

If you have more than one node, you use Cobbler replicate, not Puppet, to keep configurations managed centrally.

Basically it's like requesting that you manipulate all your systems management apps with chopsticks.  It just doesn't make
sense.   You are exposing only a few knobs and losing a lot of information, and require configuration management to come
up before provisioning. 

Bad.


On Tuesday, January 31, 2012 at 9:33 AM, Siddharth Deshpande wrote:

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
cobbler@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler