On 05/11/10 21:48, Gabriel - IP Guys wrote:
> I've finally managed to get xen installed on a remote system via puppet
>
http://puppetnewbie.blogspot.com/2010/05/installing-xen-instance.html
>
> I was about to create my test machines manually, when it occurred to me,
> that I should be doing this via puppet. Hence my question in the
> subject. I was given some advice on the irc channel, but it didn't
> really sink in very much.
>
> If anyone has any ideas, please feel free to send me a note, I'll be
> working on this privately, and post my findings and ideas, back to the
> list. The way I have installed xen is noted in my blog if you would like
> to reference it.
First of all, I have a definition for creating Xen config files.
It is part of my 'nsc-puppet-utils' module, which you can clone
from <
http://www.nsc.liu.se/~bellman/nsc-puppet-utils.git>. You
use it like this:
xen_domu {
myguest:
cpus => 2, memory => 4096,
interfaces => [ "00:16:3E:10:20:30", "00:16:3E:10:20:30" ],
disk => [ "/dev/vghost/vm-myguest.system",
"/dev/vghost/vm-myguest.homes" ],
ensure => running, autoboot => true;
}
There are more parameters available, but the above are perhaps
the most important. It is fairly generic, and tries to impose as
little "policy" as possible.
I then have another definition, which sets parameters the way I
want them to be. For each virtual guest, I actually create two
Xen config files; one for booting the guest the normal way, and
one for booting the CentOS installer with a kickstart file. To
install OS onto the disk image I do:
# xm create -c myguest-install
and let it run. To boot the machine after OS has been installed,
I do:
# xm create myguest
I use LVM logical volumes for disk images, using a consistent
naming for them, and my definition makes it easy to use that
convention. I use that definition like this:
nsc_vm_guest {
"mail":
memory => 3072, cpus => 3,
disk => [ "+postfix", "+spoolmail", "+home", "+mailman" ],
interfaces => [ "00:16:3E:10:20:30" ];
}
The "+foo" disk names is shorthand for /dev/vgbar/vm-mail.foo,
where "bar" is the name of the dom0 machine hosting the guest, so
I have less to type when defining my guests. nsc_vm_guest will
also automatically add a disk image for the system file systems
(/, /var and swap).
I don't create the logical volumes automatically, nor do I
partition or create filesystems on them automatically, to lessen
the risk of destroying important data. Except for /, /var and
swap, which my kickstart config creates; I make sure to keep
persistent data on separate filesystem from the OS filesystems,
so I can re-install machines with very little hesitation.
I'm attaching the nsc_vm_guest definition I use, and the
kickstart template I use. There is some documentation as
comments in there. If you use them, you will probably want
to customize them to your liking. Git clone the URL above
to get the nsc-puppet-utils module; hopefully it is generic
enough to not need any customization (but if you find that
you do, please tell me how it can be made better).
/Bellman