I am trying to use Puppet to handle our Linux Vserver based virtual servers, including the actual installation of the virtual servers. (If you don''t know how Linux Vserver works, think of a BSD style jail) The elegant way to configure this, would be to export the configuration details from the virtual machine configuration, and then collect it on the physical machine, which then installs/reconfigures the virtual server. This results in some configuration similar to the following pseudo configuration: #### include my_vserver node "virtual01.domain.tld" { $ip = ''192.168.0.37'' @@my_vserver { $host: ensure => running, ip => $ip, physical_host => "physical01.domain.tld", } # Additional configuration } node "physical01.domain.tld" { My_vserver <<| physical_host == $hostname |>> # Additional configuration } #### I already have a preliminary module, which handles the actual installation and configuration of the virtual servers. The problem is that it requires the egg before the chicken, by needing to have the resource exported by the Puppet instance inside the virtual server, before the virtual server can be installed. Does anyone have a good idea on how to solve this problem? -- David Darville -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Imho you should separate the resources (class/defines) used by the physical machine from those of the virtual machine. Example: You should have a define for the physical machines, that creates the virtual machine(s). They would probably look like your define my_vserver, without the property physical host (as the physical host is determined by where the resource is applied). Anything that is going to be set up on the virtual machine should get defined in the virtual machines. Now if there is some application, which gets installed on the virtual machine, that requires special parameters on the physical host, you should export this resource(s) with a known clear tag like exporttophysicalfrom_www_example.com. (sugest: maybe create a puppet function/define to make it harder for typos to slip in here). Now, in the define you used on the physical server, you import all exported resources which are tagged with this string (note that define should have a virtual hostname parameter) :-) Just my 2 cents, Silviu On 28.06.2010 17:12, David Darville wrote:> I am trying to use Puppet to handle our Linux Vserver based virtual servers, > including the actual installation of the virtual servers. (If you don''t know > how Linux Vserver works, think of a BSD style jail) > > The elegant way to configure this, would be to export the configuration > details from the virtual machine configuration, and then collect it on the > physical machine, which then installs/reconfigures the virtual server. > > This results in some configuration similar to the following pseudo > configuration: > > #### > > include my_vserver > > node "virtual01.domain.tld" { > > $ip = ''192.168.0.37'' > > @@my_vserver { $host: > ensure => running, > ip => $ip, > physical_host => "physical01.domain.tld", > } > > # Additional configuration > } > > node "physical01.domain.tld" { > My_vserver<<| physical_host == $hostname |>> > > # Additional configuration > } > > #### > > I already have a preliminary module, which handles the actual installation > and configuration of the virtual servers. The problem is that it requires > the egg before the chicken, by needing to have the resource exported by the > Puppet instance inside the virtual server, before the virtual server can be > installed. > > Does anyone have a good idea on how to solve this problem? > > > -- > > David Darville > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Yes, it is possible to work around the problem by not needing exported resources to install the virtual servers. And then later export the configuration resources. But we want to use external nodes, and I don''t see any way of specifying the physical machine configuration with an arbitrary number of virtual machines as an external node. But I have been thinking about running puppetd like this: puppetd --fqdn virtual01.domain.tld --server puppetmaster --no-daemonize \ --tag magic-export-only To do the actual exporting, before the virtual machine is installed, but it seems like an ugly hack to me, and I hoped someone had a better idea. -- David On Mon, Jun 28, 2010 at 09:22:11PM +0300, Silviu Paragina wrote:> Imho you should separate the resources (class/defines) used by the > physical machine from those of the virtual machine. > > Example: > You should have a define for the physical machines, that creates the > virtual machine(s). They would probably look like your define > my_vserver, without the property physical host (as the physical host is > determined by where the resource is applied). > > Anything that is going to be set up on the virtual machine should get > defined in the virtual machines. Now if there is some application, which > gets installed on the virtual machine, that requires special parameters > on the physical host, you should export this resource(s) with a known > clear tag like exporttophysicalfrom_www_example.com. (sugest: maybe > create a puppet function/define to make it harder for typos to slip in > here). Now, in the define you used on the physical server, you import > all exported resources which are tagged with this string (note that > define should have a virtual hostname parameter) > > :-) > > Just my 2 cents, > Silviu > > On 28.06.2010 17:12, David Darville wrote: > >I am trying to use Puppet to handle our Linux Vserver based virtual > >servers, > >including the actual installation of the virtual servers. (If you don''t > >know > >how Linux Vserver works, think of a BSD style jail) > > > >The elegant way to configure this, would be to export the configuration > >details from the virtual machine configuration, and then collect it on the > >physical machine, which then installs/reconfigures the virtual server. > > > >This results in some configuration similar to the following pseudo > >configuration: > > > >#### > > > >include my_vserver > > > >node "virtual01.domain.tld" { > > > > $ip = ''192.168.0.37'' > > > > @@my_vserver { $host: > > ensure => running, > > ip => $ip, > > physical_host => "physical01.domain.tld", > > } > > > > # Additional configuration > >} > > > >node "physical01.domain.tld" { > > My_vserver<<| physical_host == $hostname |>> > > > > # Additional configuration > >} > > > >#### > > > >I already have a preliminary module, which handles the actual installation > >and configuration of the virtual servers. The problem is that it requires > >the egg before the chicken, by needing to have the resource exported by the > >Puppet instance inside the virtual server, before the virtual server can be > >installed. > > > >Does anyone have a good idea on how to solve this problem? > > > > > >-- > > > >David Darville > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 6/29/2010 3:12 PM, David Darville wrote:> Yes, it is possible to work around the problem by not needing exported > resources to install the virtual servers. And then later export the > configuration resources. > > But we want to use external nodes, and I don''t see any way of specifying the > physical machine configuration with an arbitrary number of virtual machines > as an external node. > > But I have been thinking about running puppetd like this: > > puppetd --fqdn virtual01.domain.tld --server puppetmaster --no-daemonize \ > --tag magic-export-only > > To do the actual exporting, before the virtual machine is installed, but it > seems like an ugly hack to me, and I hoped someone had a better idea.One possibility, albeit a hack is this: define virtual_host($physical = ''phy1'', ... ) { case $hostname { $name: { # configure virtual here } $physical: { # configure physical here } default: { } } } virtual_host { "virt1": physical => "phy2", ... ; } and use this define in the main scope, outside of all nodes. This will be evaluated for all your nodes, and evaluate to nothing on nodes other than the virtual or physical node. Take care, David -- dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at Klosterneuburg UID: ATU64260999 FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.