I''m trying to manage network files on two nodes, "vico" and "backup." The component "vico_network" below works fine. define vico_network ($owner = ''root'', $group = ''wheel'', $mode = ''644'', $cro_int = ''ne3'', $carp0_skew = '''', $carp1_skew = '''', $int_ip "192.168.10.201", $host_name = ''vico.example.org vico'') { file { "/etc/$name": owner => $owner, group => $group, mode => $mode, content => template("${name}.erb"), } } vico_network { ["hostname.carp0", "hostname.carp1", "hostname.pfsync0", "hostname.xl1", "hosts"]: } Then after adding a similar component called "backup_network" for the other node, I get the following error: backup:/root# puppetd -v -o --noop err: Could not retrieve configuration: Duplicate definition: file[/etc/hostname.carp1] is already defined in file /etc/puppet/manifests/classes/vico_network.pp at line 20; cannot redefine in file /etc/puppet/manifests/classes/backup_network.pp at line 21 So I tried to change the scope by adding a class: class vico_network_files { define vico_network ($owner = ''root'', $group = ''wheel'', $mode ''644'', $cro_int = ''ne3'', $carp0_skew = '''', $carp1_skew = '''', $int_ip "192.168.10.201", $host_name = ''vico.example.org vico'') { file { "/etc/$name": owner => $owner, group => $group, mode => $mode, content => template("${name}.erb"), } } vico_network { ["hostname.carp0", "hostname.carp1", "hostname.pfsync0", "hostname.xl1", "hosts"]: } } Then I get the following error: vico:/root# puppetd -v -o --noop err: Could not retrieve configuration: Could not find definition vico_network warning: Could not get config; using cached copy notice: Starting configuration run notice: Finished configuration run in 3.57 seconds What''s the best way to get this to work? Thanks, Kent -- "It may be true that the law cannot make a man love me, but it can stop him from lynching me, and I think that''s pretty important." - Martin Luther King Jr.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 12 February 2007 00:58, Kenton Brede wrote:> I''m trying to manage network files on two nodes, "vico" and "backup." > The component "vico_network" below works fine. > > define vico_network ($owner = ''root'', $group = ''wheel'', $mode = ''644'', > $cro_int = ''ne3'', > $carp0_skew = '''', $carp1_skew = '''', $int_ip > "192.168.10.201", > $host_name = ''vico.example.org vico'') { > file { "/etc/$name": > owner => $owner, group => $group, mode => $mode, > content => template("${name}.erb"), > } > } > vico_network { ["hostname.carp0", "hostname.carp1", > "hostname.pfsync0", "hostname.xl1", "hosts"]: } > > Then after adding a similar component called "backup_network" for the > other node, I get the following error: > > backup:/root# puppetd -v -o --noop > err: Could not retrieve configuration: Duplicate definition: > file[/etc/hostname.carp1] is already defined in file > /etc/puppet/manifests/classes/vico_network.pp at line 20; cannot > redefine in file /etc/puppet/manifests/classes/backup_network.pp at > line 21[snip]> What''s the best way to get this to work?I think, you are missing the node{} declarations like that: node vico { vico_network{...} } node backup { backup_network{...} } Regards, David - -- - - hallo... wie gehts heute? - - *hust* gut *rotz* *keuch* - - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD4DBQFFz8bD/Pp1N6Uzh0URAp/UAJY7+WtNW/k1GODxhax6ZH78mxVuAKCAVvzR neWVhIZ19IjBJjRkDx/D3w==4jeD -----END PGP SIGNATURE-----
On 2/11/07, David Schmitt <david@schmitt.edv-bus.at> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Monday 12 February 2007 00:58, Kenton Brede wrote: > > I''m trying to manage network files on two nodes, "vico" and "backup." > > The component "vico_network" below works fine. > > > > define vico_network ($owner = ''root'', $group = ''wheel'', $mode = ''644'', > > $cro_int = ''ne3'', > > $carp0_skew = '''', $carp1_skew = '''', $int_ip > > "192.168.10.201", > > $host_name = ''vico.example.org vico'') { > > file { "/etc/$name": > > owner => $owner, group => $group, mode => $mode, > > content => template("${name}.erb"), > > } > > } > > vico_network { ["hostname.carp0", "hostname.carp1", > > "hostname.pfsync0", "hostname.xl1", "hosts"]: } > > > > Then after adding a similar component called "backup_network" for the > > other node, I get the following error: > > > > backup:/root# puppetd -v -o --noop > > err: Could not retrieve configuration: Duplicate definition: > > file[/etc/hostname.carp1] is already defined in file > > /etc/puppet/manifests/classes/vico_network.pp at line 20; cannot > > redefine in file /etc/puppet/manifests/classes/backup_network.pp at > > line 21 > [snip] > > What''s the best way to get this to work? > > I think, you are missing the node{} declarations like that: > > node vico { vico_network{...} } > node backup { backup_network{...} }Thanks for the reply David. I''m calling my classes like this in site.pp, with an similar one for "backup" when I get the errors. node vico { $cro_int = ''ne3'' include pf_conf include puppetd_conf include obsd_etc_static include vico_network_files } If I try adding something like the following I get a "Node vico is already defined" error which makes sense since I do have node "vico" in site.pp: node vico { vico_network { ["hostname.carp0", "hostname.carp1", "hostname.pfsync0", "hostname.xl1", "hosts"]: } } Kent -- "It may be true that the law cannot make a man love me, but it can stop him from lynching me, and I think that''s pretty important." - Martin Luther King Jr.
On Feb 11, 2007, at 5:58 PM, Kenton Brede wrote:> I''m trying to manage network files on two nodes, "vico" and "backup." > The component "vico_network" below works fine. > [...] > vico_network { ["hostname.carp0", "hostname.carp1", > "hostname.pfsync0", "hostname.xl1", "hosts"]: } > > Then after adding a similar component called "backup_network" for the > other node, I get the following error: > > backup:/root# puppetd -v -o --noop > err: Could not retrieve configuration: Duplicate definition: > file[/etc/hostname.carp1] is already defined in file > /etc/puppet/manifests/classes/vico_network.pp at line 20; cannot > redefine in file /etc/puppet/manifests/classes/backup_network.pp at > line 21Note that you can use puppetd --test to get -v -o behaviour plus to skip using the cached configuration when there''s a failure. There''s something missing here; the code I see should not result in the error you''re seeing.> So I tried to change the scope by adding a class: > > class vico_network_files { > define vico_network ($owner = ''root'', $group = ''wheel'', $mode > ''644'', $cro_int = ''ne3'', > $carp0_skew = '''', $carp1_skew = '''', $int_ip > "192.168.10.201", > $host_name = ''vico.example.org vico'') { > file { "/etc/$name": > owner => $owner, group => $group, mode => $mode, > content => template("${name}.erb"), > } > } > vico_network { ["hostname.carp0", "hostname.carp1", > "hostname.pfsync0", "hostname.xl1", "hosts"]: } > } > > Then I get the following error: > vico:/root# puppetd -v -o --noop > err: Could not retrieve configuration: Could not find definition > vico_network > warning: Could not get config; using cached copy > notice: Starting configuration run > notice: Finished configuration run in 3.57 secondsYou must be using an older version -- 0.20.1 or something? This version had problems with definitions inside classes. Either way, though, you shouldn''t need to do that. I recommend you just create a single definition called ''network_file'' or something, and then just pass the information in as necessary for each host. I''m guessing there''s something I''m missing about how you''re trying to configure both the primary and the backup; can you paste the code for the two nodes? -- The time to repair the roof is when the sun is shining. -- John F. Kennedy --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On 2/11/07, Luke Kanies <luke@madstop.com> wrote:> On Feb 11, 2007, at 5:58 PM, Kenton Brede wrote: > > > I''m trying to manage network files on two nodes, "vico" and "backup." > > The component "vico_network" below works fine. > > [...] > > vico_network { ["hostname.carp0", "hostname.carp1", > > "hostname.pfsync0", "hostname.xl1", "hosts"]: } > > > > Then after adding a similar component called "backup_network" for the > > other node, I get the following error: > > > > backup:/root# puppetd -v -o --noop > > err: Could not retrieve configuration: Duplicate definition: > > file[/etc/hostname.carp1] is already defined in file > > /etc/puppet/manifests/classes/vico_network.pp at line 20; cannot > > redefine in file /etc/puppet/manifests/classes/backup_network.pp at > > line 21 > > Note that you can use puppetd --test to get -v -o behaviour plus to > skip using the cached configuration when there''s a failure.Thank for the tip :)> > There''s something missing here; the code I see should not result in > the error you''re seeing. > > > So I tried to change the scope by adding a class: > > > > class vico_network_files { > > define vico_network ($owner = ''root'', $group = ''wheel'', $mode > > ''644'', $cro_int = ''ne3'', > > $carp0_skew = '''', $carp1_skew = '''', $int_ip > > "192.168.10.201", > > $host_name = ''vico.example.org vico'') { > > file { "/etc/$name": > > owner => $owner, group => $group, mode => $mode, > > content => template("${name}.erb"), > > } > > } > > vico_network { ["hostname.carp0", "hostname.carp1", > > "hostname.pfsync0", "hostname.xl1", "hosts"]: } > > } > > > > Then I get the following error: > > vico:/root# puppetd -v -o --noop > > err: Could not retrieve configuration: Could not find definition > > vico_network > > warning: Could not get config; using cached copy > > notice: Starting configuration run > > notice: Finished configuration run in 3.57 seconds > > You must be using an older version -- 0.20.1 or something? This > version had problems with definitions inside classes.I''m using 0.20.1. I''ll upgrade to 0.22.1.> Either way, though, you shouldn''t need to do that. > > I recommend you just create a single definition called ''network_file'' > or something, and then just pass the information in as necessary for > each host. > > I''m guessing there''s something I''m missing about how you''re trying to > configure both the primary and the backup; can you paste the code for > the two nodes?Here are the files, http://pastie.caboo.se/39647 I''ll upgrade in a day or so and see if the code will work. Thanks, Kent -- "It may be true that the law cannot make a man love me, but it can stop him from lynching me, and I think that''s pretty important." - Martin Luther King Jr.
On Feb 11, 2007, at 9:46 PM, Kenton Brede wrote:> > Here are the files, http://pastie.caboo.se/39647 > I''ll upgrade in a day or so and see if the code will work.I''d use something like the following: http://pastie.caboo.se/39652 This uses the same definition for creating all of the files, rather than creating a new definition for each host, thus reducing code duplication. Note that you''ll have to modify your template to directly use $fqdn and $hostname. If this code doesn''t work, let me know. -- The leader of Jamestown was "John Smith" (not his real name), under whose direction the colony engaged in a number of activities, primarily related to starving. -- Dave Barry, "Dave Barry Slept Here" --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On 2/11/07, Luke Kanies <luke@madstop.com> wrote:> On Feb 11, 2007, at 9:46 PM, Kenton Brede wrote: > > > > Here are the files, http://pastie.caboo.se/39647 > > I''ll upgrade in a day or so and see if the code will work. > > I''d use something like the following: > > http://pastie.caboo.se/39652 > > This uses the same definition for creating all of the files, rather > than creating a new definition for each host, thus reducing code > duplication. > > Note that you''ll have to modify your template to directly use $fqdn > and $hostname. > > If this code doesn''t work, let me know.Wow, thanks. I started upgrading to 0.22.1 last night but didn''t finish. Once I get that in place I''ll try the code. Kent -- "It may be true that the law cannot make a man love me, but it can stop him from lynching me, and I think that''s pretty important." - Martin Luther King Jr.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Kenton! You can put that all together into one node definition: node vico { $cro_int = ''ne3'' include pf_conf include puppetd_conf include obsd_etc_static include vico_network_files vico_network { ["hostname.carp0", "hostname.carp1", "hostname.pfsync0", "hostname.xl1", "hosts"]: } } Regards, David - -- - - hallo... wie gehts heute? - - *hust* gut *rotz* *keuch* - - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFF0Hbj/Pp1N6Uzh0URAoewAJ9ad88VKcUBseCAVm4BYV6deh/G+wCdHMpN BrWU8LF7dvYVxuUZY/P8gMM=Ew6W -----END PGP SIGNATURE-----