Hi, I am trying to set up puppet for creating configuration files for automatic installation. I have a node which runs both puppet master and dhcp server. On this node I wanna create configuration file for dhcpd which will contain static ip address definition for each host. Like this :
... host node1 { hardware ethernet 08:00:27:ed:8f:ea; fixed-address 192.168.2.1; } host node2 { hardware ethernet 08:00:27:df:b4:0c; fixed-address 192.168.2.2; } host node3 { hardware ethernet 78:e7:d1:24:5c:10; fixed-address 192.168.2.3; } ... My configuration: /etc/puppet/manifests/site.pp: import "nodes/puppet.pp" /etc/puppet/manifests/nodes/puppet.pp: import "/etc/puppet/manifests/roles/puppetserver.pp" node 'puppet' inherits puppetserver { } #node puppet /etc/puppet/manifests/roles/puppetserver.pp: import "/etc/puppet/manifests/roles/basenode.pp" node 'puppetserver' inherits basenode { preseed { "node1": mac1 => "44-1e-a1-39-05-a0", mac2 => "44:1e:a1:39:05:a0", ip => "192.168.2.1", netmask => "255.255.0.0", "node2": mac1 => "78-e7-d1-24-5f-d0", mac2 => "78:e7:d1:24:5f:d0", ip => "192.168.2.2", netmask => "255.255.0.0", "node3": mac1 => "78-e7-d1-24-5c-10", mac2 => "78:e7:d1:24:5c:10", ip => "192.168.2.3", netmask => "255.255.0.0", } #preseed include dhcpd } # node This is puppet module for preseed and dhcpd. /etc/puppet/modules/preseed/manifests/init.pp: class dhcpd { package { "isc-dhcp-server": ensure => installed, } #package service { "isc-dhcp-server": ensure => $ensure, enable => true, require => Package["isc-dhcp-server"], } #service file { "/etc/default/isc-dhcp-server": ensure => present, path => "/etc/default/isc-dhcp-server", mode => 644, content => template("preseed/isc-dhcp-server.erb"), require => Package["isc-dhcp-server"], notify => Service["isc-dhcp-server"], } #file } #class define preseed ($mac1 = dflt, $mac2 = undef, $ip, $netmask) { include dhcpd file { "/var/www/preseed_$name.cfg": ensure => present, mode => 644, content => template("preseed/preseed_web.cfg.erb"), } #file file { "/var/lib/tftpboot/pxelinux.cfg/01-$mac1": ensure => present, mode => 644, content => template("preseed/pxe-config.erb"), require => File["/var/www/preseed_$name.cfg"], } #file file { "/etc/dhcp/dhcpd.conf-$name": ensure => present, path => "/etc/dhcp/dhcpd.conf", mode => 644, content => template("preseed/dhcpd.conf.erb"), require => Package["isc-dhcp-server"], notify => Service["isc-dhcp-server"], } #file } #define dhcpd.conf.erb: ... <% name.each do |val| -%> host <%= val %> { hardware ethernet <%= mac2 %>; fixed-address <%= ip %>; } <% end -%> When I try to apply this configuration, I receive this message: root@puppet:/# puppet agent --test --server=puppet.domain.com info: Caching catalog for puppet.domain.com err: Could not run Puppet configuration client: Cannot alias File[/etc/ dhcp/dhcpd.conf-node1] to ["/etc/dhcp/dhcpd.conf"]; resource ["File", ["/etc/dhcp/dhcpd.conf"]] already exists What is the best way to create a configuration that applies only to one node, but have to contain different parameters for each node. Thanks. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.