Libvirt DHCP SmartProxy control

Can Foreman exert control over the DHCP details on a KVM network config to create new entries when creating new machines?
Thinking about installing laptop Foreman deploying to guest KVM instances. Wondering if I can do it without running native DHCP, oVirt, or other overheads. Just Foreman + KVM to demo local guest installation. (random thought after a few Sunday beers)
Cheers

D

Yep, it can as of Foreman 1.4.

There are some steps documented here:
http://theforeman.org/manuals/1.4/index.html#4.3.9Libvirt

The smart proxy can call 'virsh' to add/remove DHCP leases and DNS
records on the fly from the libvirt network config (which automatically
updates dnsmasq), and it can also run TFTP.

We used this setup for our stand at FOSDEM - a laptop running Fedora 19
and Foreman 1.4, with itself configured as a libvirt compute resource,
this smart proxy configuration and we could then provision VMs over PXE
with no additional services.

My only suggestion in addition to what's in the manual is if you're
using NetworkManager, to configure it to use dnsmasq and then delegate
queries for your internal/local domain through to the libvirt dnsmasq
instance. See the bottom of
http://m0dlx.com/blog/Automatic_DNS_updates_from_libvirt_guests.html

··· On 16/03/14 18:23, Duncan Innes wrote: > Can Foreman exert control over the DHCP details on a KVM network config to create new entries when creating new machines? > Thinking about installing laptop Foreman deploying to guest KVM instances. Wondering if I can do it without running native DHCP, oVirt, or other overheads. Just Foreman + KVM to demo local guest installation. (random thought after a few Sunday beers)


Dominic Cleal
Red Hat Engineering

1 Like

Hello,

yes, Foreman 1.4+ can handle DHCP and DNS (and TFTP of course) of
dnsmasq via virsh command. You need to configure sudo and libvirt a bit
for that. All here:

http://theforeman.org/manuals/1.4/index.html#4.3.9Libvirt

> Can Foreman exert control over the DHCP details on a KVM network
> config to create new entries when creating new machines? Thinking
> about installing laptop Foreman deploying to guest KVM instances.
> Wondering if I can do it without running native DHCP, oVirt, or other
> overheads. Just Foreman + KVM to demo local guest installation.
> (random thought after a few Sunday beers)

It was intentionally built for demos and talks, but folks use that for
development as well :slight_smile:

We would like to improve the documentation, please make a pull request
if you find issues or want to extend it.

Have fun.

··· -- Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

> Hello,
>
> yes, Foreman 1.4+ can handle DHCP and DNS (and TFTP of course) of
> dnsmasq via virsh command. You need to configure sudo and libvirt a bit
> for that. All here:
>
> Foreman :: Manual
>
> > Can Foreman exert control over the DHCP details on a KVM network
> > config to create new entries when creating new machines? Thinking
> > about installing laptop Foreman deploying to guest KVM instances.
> > Wondering if I can do it without running native DHCP, oVirt, or other
> > overheads. Just Foreman + KVM to demo local guest installation.
> > (random thought after a few Sunday beers)
>
> It was intentionally built for demos and talks, but folks use that for
> development as well :slight_smile:
>
> We would like to improve the documentation, please make a pull request
> if you find issues or want to extend it.

And it works great for development! Looking forward to trying out
the image-based libvirt provisioning with it!

– Ivan

··· ----- Original Message -----

Have fun.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Thanks guys.

Will give this a go on my laptop shortly. I did browse the manual
yesterday, but phone browsers aren't the best for research.

Cheers

Duncan

··· On Monday, 17 March 2014 09:24:00 UTC, Dominic Cleal wrote: > > On 17/03/14 09:09, Ivan Necas wrote: > > > > > > ----- Original Message ----- > >> Hello, > >> > >> yes, Foreman 1.4+ can handle DHCP and DNS (and TFTP of course) of > >> dnsmasq via virsh command. You need to configure sudo and libvirt a bit > >> for that. All here: > >> > >> http://theforeman.org/manuals/1.4/index.html#4.3.9Libvirt > >> > >>> Can Foreman exert control over the DHCP details on a KVM network > >>> config to create new entries when creating new machines? Thinking > >>> about installing laptop Foreman deploying to guest KVM instances. > >>> Wondering if I can do it without running native DHCP, oVirt, or other > >>> overheads. Just Foreman + KVM to demo local guest installation. > >>> (random thought after a few Sunday beers) > >> > >> It was intentionally built for demos and talks, but folks use that for > >> development as well :-) > >> > >> We would like to improve the documentation, please make a pull request > >> if you find issues or want to extend it. > > > > And it works great for development! Looking forward to trying out > > the image-based libvirt provisioning with it! > > This has been merged into nightlies/Foreman 1.5 now, so if you want to > try it out, you now can. > > I need to do a bit more work to get a script to generate images > automatically (e.g. based on virt-builder or > https://github.com/domcleal/vagrantify), but here's a CentOS 6.4 image > I've been testing with: > http://m0dlx.com/files/foreman/boxes/foreman_template.img > > Under Infrastructure, Compute resources, select your libvirt resource, > then click "Add image". The username/password in the above image are > both "vagrant" and the image path is just the full filesystem path to it > (add it to a libvirt storage pool somewhere.) > > You'll need to set up a "finish" provisioning template which is executed > over SSH on the host. Unfortunately we're missing a kickstart version > in our templates repo, but you could look at the %post from a kickstart > provision template. > > Lastly, when creating a host and selecting your libvirt CR, under the OS > tab there's an "Image Based" radio box which changes the provisioning > mode. > > -- > Dominic Cleal > Red Hat Engineering >

This has been merged into nightlies/Foreman 1.5 now, so if you want to
try it out, you now can.

I need to do a bit more work to get a script to generate images
automatically (e.g. based on virt-builder or
https://github.com/domcleal/vagrantify), but here's a CentOS 6.4 image
I've been testing with:
http://m0dlx.com/files/foreman/boxes/foreman_template.img

Under Infrastructure, Compute resources, select your libvirt resource,
then click "Add image". The username/password in the above image are
both "vagrant" and the image path is just the full filesystem path to it
(add it to a libvirt storage pool somewhere.)

You'll need to set up a "finish" provisioning template which is executed
over SSH on the host. Unfortunately we're missing a kickstart version
in our templates repo, but you could look at the %post from a kickstart
provision template.

Lastly, when creating a host and selecting your libvirt CR, under the OS
tab there's an "Image Based" radio box which changes the provisioning mode.

··· On 17/03/14 09:09, Ivan Necas wrote: > > > ----- Original Message ----- >> Hello, >> >> yes, Foreman 1.4+ can handle DHCP and DNS (and TFTP of course) of >> dnsmasq via virsh command. You need to configure sudo and libvirt a bit >> for that. All here: >> >> http://theforeman.org/manuals/1.4/index.html#4.3.9Libvirt >> >>> Can Foreman exert control over the DHCP details on a KVM network >>> config to create new entries when creating new machines? Thinking >>> about installing laptop Foreman deploying to guest KVM instances. >>> Wondering if I can do it without running native DHCP, oVirt, or other >>> overheads. Just Foreman + KVM to demo local guest installation. >>> (random thought after a few Sunday beers) >> >> It was intentionally built for demos and talks, but folks use that for >> development as well :-) >> >> We would like to improve the documentation, please make a pull request >> if you find issues or want to extend it. > > And it works great for development! Looking forward to trying out > the image-based libvirt provisioning with it!


Dominic Cleal
Red Hat Engineering

I'm actually trying to integrate this into my foreman_snapshot plugin
at the moment. So the required code is up as a PR to Fog for cloning
volumes correctly, and I'm now working on the Foreman side - stay
tuned, it might save some time if you can just click a button and have
it PXE boot once and then grab the volume as a base image :slight_smile:

Greg

··· On 17 March 2014 09:24, Dominic Cleal wrote: > I need to do a bit more work to get a script to generate images > automatically (e.g. based on virt-builder or > https://github.com/domcleal/vagrantify), but here's a CentOS 6.4 image > I've been testing with: > http://m0dlx.com/files/foreman/boxes/foreman_template.img