Hi, I am using Puppet 2.6.1 on Ubuntu LTS and i am getting this strange error messages. Duplicate definition: File[conf] is already defined in file /etc/ puppet/modules/apache2/manifests/vhost.pp at line 10; cannot redefine at /etc/puppet/modules/apache2/manifests/vhost.pp:10 on node eurwebtest02 Do you have any idea what could be the problem? Here is the trace,debug of the run debug: importing ''/etc/puppet/modules/apache2/manifests/init.pp'' in environment production debug: importing ''/etc/puppet/modules/apache2/manifests/vhost.pp'' in environment production debug: importing ''/etc/puppet/modules/apache2/manifests/mods.pp'' in environment production debug: Automatically imported apache2::mods from apache2/mods into production debug: importing ''/etc/puppet/modules/apache2/manifests/pringo.pp'' in environment production debug: Automatically imported apache2::pringo from apache2/pringo into production debug: Scope(Vhost[local]): Retrieving template /etc/puppet/modules/ apache2/templates/vhost.erb debug: template[/etc/puppet/modules/apache2/templates/vhost.erb]: Bound template variables for /etc/puppet/modules/apache2/templates/ vhost.erb in 0.00 seconds debug: template[/etc/puppet/modules/apache2/templates/vhost.erb]: Interpolated template /etc/puppet/modules/apache2/templates/vhost.erb in 0.00 seconds debug: Scope(Vhost[test]): Retrieving template /etc/puppet/modules/ apache2/templates/vhost.erb debug: template[/etc/puppet/modules/apache2/templates/vhost.erb]: Bound template variables for /etc/puppet/modules/apache2/templates/ vhost.erb in 0.00 seconds debug: template[/etc/puppet/modules/apache2/templates/vhost.erb]: Interpolated template /etc/puppet/modules/apache2/templates/vhost.erb in 0.00 seconds /usr/lib/ruby/1.8/puppet/resource/catalog.rb:519:in `fail_on_duplicate_type_and_title'' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:74:in `add_resource'' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:72:in `each'' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:72:in `add_resource'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:57:in `add_resource'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:56:in `evaluate'' /usr/lib/ruby/1.8/puppet/util/errors.rb:35:in `exceptwrap'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:39:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:38:in `collect'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:38:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast.rb:72:in `safeevaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/astarray.rb:35:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/astarray.rb:34:in `collect'' /usr/lib/ruby/1.8/puppet/parser/ast/astarray.rb:34:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast.rb:72:in `safeevaluate'' /usr/lib/ruby/1.8/puppet/resource/type.rb:76:in `evaluate_code'' /usr/lib/ruby/1.8/puppet/parser/resource.rb:70:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:255:in `evaluate_definitions'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:255:in `each'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:255:in `evaluate_definitions'' /usr/lib/ruby/1.8/puppet/util/errors.rb:35:in `exceptwrap'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:254:in `evaluate_definitions'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:270:in `evaluate_generators'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:265:in `loop'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:265:in `evaluate_generators'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:107:in `compile'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:18:in `compile'' /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' /usr/lib/ruby/1.8/puppet/util.rb:180:in `benchmark'' /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'' /usr/lib/ruby/1.8/puppet/indirector/indirection.rb:193:in `find'' /usr/lib/ruby/1.8/puppet/indirector.rb:50:in `find'' /usr/lib/ruby/1.8/puppet/application/apply.rb:115:in `main'' /usr/lib/ruby/1.8/puppet/application/apply.rb:35:in `run_command'' /usr/lib/ruby/1.8/puppet/application.rb:300:in `run'' /usr/lib/ruby/1.8/puppet/application.rb:397:in `exit_on_fail'' /usr/lib/ruby/1.8/puppet/application.rb:300:in `run'' /usr/lib/ruby/1.8/puppet/util/command_line.rb:55:in `execute'' /usr/bin/puppet:4 /usr/lib/ruby/1.8/puppet/parser/compiler.rb:21:in `compile'' /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' /usr/lib/ruby/1.8/puppet/util.rb:180:in `benchmark'' /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' /usr/lib/ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'' /usr/lib/ruby/1.8/puppet/indirector/indirection.rb:193:in `find'' /usr/lib/ruby/1.8/puppet/indirector.rb:50:in `find'' /usr/lib/ruby/1.8/puppet/application/apply.rb:115:in `main'' /usr/lib/ruby/1.8/puppet/application/apply.rb:35:in `run_command'' /usr/lib/ruby/1.8/puppet/application.rb:300:in `run'' /usr/lib/ruby/1.8/puppet/application.rb:397:in `exit_on_fail'' /usr/lib/ruby/1.8/puppet/application.rb:300:in `run'' /usr/lib/ruby/1.8/puppet/util/command_line.rb:55:in `execute'' /usr/bin/puppet:4 Duplicate definition: File[conf] is already defined in file /etc/ puppet/modules/apache2/manifests/vhost.pp at line 10; cannot redefine at /etc/puppet/modules/apache2/manifests/vhost.pp:10 on node eurwebtest02 Thanks Peter -- 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 Nov 17, 2011, at 10:02 AM, Peter Horvath wrote:> Duplicate definition: File[conf] is already defined in file /etc/ > puppet/modules/apache2/manifests/vhost.pp at line 10; cannot redefine > at /etc/puppet/modules/apache2/manifests/vhost.pp:10 on node > eurwebtest02 > > Do you have any idea what could be the problem?It is absolutely what it already says very clearly: File[conf] is already defined. It''s just that puppet doesn''t name the original reference, but the same reference twice :( So you have to go find the other instance yourself. Go to your module root and type: find . -type f -exec grep -Hni "conf:" {} \; -- Jo Rhett Net Consonance : consonant endings by net philanthropy, open source and other randomness -- 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.
i know all of this and i did grep before i wrote this email :) There is no other file[conf] On 17 November 2011 18:58, Jo Rhett <jrhett@netconsonance.com> wrote:> On Nov 17, 2011, at 10:02 AM, Peter Horvath wrote: > > Duplicate definition: File[conf] is already defined in file /etc/ > puppet/modules/apache2/manifests/vhost.pp at line 10; cannot redefine > at /etc/puppet/modules/apache2/manifests/vhost.pp:10 on node > eurwebtest02 > > Do you have any idea what could be the problem? > > > It is absolutely what it already says very clearly: File[conf] is already > defined. It''s just that puppet doesn''t name the original reference, but > the same reference twice :( So you have to go find the other instance > yourself. Go to your module root and type: > > find . -type f -exec grep -Hni "conf:" {} \; > > > -- > Jo Rhett > Net Consonance : consonant endings by net philanthropy, open source and > other randomness > > -- > 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 Nov 17, 1:50 pm, Peter Horvath <peter.horvat...@gmail.com> wrote:> i know all of this and i did grep before i wrote this email :) > There is no other file[conf]In that case, the one declaration must be processed twice. It must appear inside a defined type that you instantiate more than once. If both definition instances are supposed to declare the same file, then move the declaration outside the definition, make it virtual, and have the definition ''realize'' it instead of declaring it. If the definitions are each supposed to delare a different file then you have a bug in your manifest. With respect to the latter possibility, I observe that the resource title is not an absolute path. That could be a sign that a variable in the Files'' titles was unexpectedly undefined, but even if not, it''s unlikely to be what you want. John -- 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.
As i figured out the source of my problem was that i used the defined resource type twice in a manifest. I didn''t know that a defined resource type cannot be used twice in the same manifest as you can use multiple times a built in one. hmmm On 17 November 2011 22:14, jcbollinger <John.Bollinger@stjude.org> wrote:> > > On Nov 17, 1:50 pm, Peter Horvath <peter.horvat...@gmail.com> wrote: > > i know all of this and i did grep before i wrote this email :) > > There is no other file[conf] > > > In that case, the one declaration must be processed twice. It must > appear inside a defined type that you instantiate more than once. > > If both definition instances are supposed to declare the same file, > then move the declaration outside the definition, make it virtual, and > have the definition ''realize'' it instead of declaring it. If the > definitions are each supposed to delare a different file then you have > a bug in your manifest. With respect to the latter possibility, I > observe that the resource title is not an absolute path. That could > be a sign that a variable in the Files'' titles was unexpectedly > undefined, but even if not, it''s unlikely to be what you want. > > > John > > -- > 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.
Seems i dont understand how get over this. I have this defined resource type vhost.pp define vhost ($docroot = "/var/www", $servername = "${hostname}.${domain}", $serveralias = "www.${hostname}.${domain}", $inorout = "1") { file{ ''conf'': path => "/etc/apache2/sites-available/${servername}", ensure => present, content => template(''/etc/puppet/modules/apache2/templates/vhost.erb''), } file{ ''link'': path => "/etc/apache2/sites-enabled/${servername}", ensure => link, target => "/etc/apache2/sites-available/${servername}", require => File[''conf''], } file{ "${docroot}": ensure => directory, } file{ "${docroot}/${servername}": ensure => directory, require => File["${docroot}"], } file{ "${docroot}/${servername}/html/": ensure => directory, require => File["${docroot}/${servername}"], } file{ ''defrem'': path => ''/etc/apache2/sites-enabled/000-default'', ensure => absent, } file{ ''index'': path => "${docroot}/${servername}/html/index.html", ensure => present, content => "Welcome to hell of ${servername}!!!!", } service{ ''apache2'': ensure => running, restart => ''service apache2 reload'', require => [ File[''conf''], File[''link''], File["${docroot}/${servername}/html/"] ], subscribe => [ File[''conf''], File[''defrem''] ], } } and this is my node config node eurwebtest02 { include apache2 include apache2::mods include apache2::pringo import "apache2/vhost.pp" vhost { ''local'': } vhost { ''test'': servername => "test.${domain}", serveralias => "www.test.${domain}", inorout => ''0'', } } I tried to virtualize vhost in vhost.pp with @ and realize them in the node config, but seems i cant get a working solution to use vhost resource type more than 1. Can you point me to the right direction? How can i create 100 vhost with that defined class or something like this On 18 November 2011 11:19, Peter Horvath <peter.horvath77@gmail.com> wrote:> As i figured out the source of my problem was that i used the defined > resource type twice in a manifest. > I didn''t know that a defined resource type cannot be used twice in the > same manifest as you can use multiple times a built in one. > > hmmm > > > On 17 November 2011 22:14, jcbollinger <John.Bollinger@stjude.org> wrote: > >> >> >> On Nov 17, 1:50 pm, Peter Horvath <peter.horvat...@gmail.com> wrote: >> > i know all of this and i did grep before i wrote this email :) >> > There is no other file[conf] >> >> >> In that case, the one declaration must be processed twice. It must >> appear inside a defined type that you instantiate more than once. >> >> If both definition instances are supposed to declare the same file, >> then move the declaration outside the definition, make it virtual, and >> have the definition ''realize'' it instead of declaring it. If the >> definitions are each supposed to delare a different file then you have >> a bug in your manifest. With respect to the latter possibility, I >> observe that the resource title is not an absolute path. That could >> be a sign that a variable in the Files'' titles was unexpectedly >> undefined, but even if not, it''s unlikely to be what you want. >> >> >> John >> >> -- >> 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 18-11-11 15:58, Peter Horvath wrote:> Seems i dont understand how get over this. > I have this defined resource type > > vhost.pp > > define vhost ($docroot = "/var/www", $servername > "${hostname}.${domain}", $serveralias = "www.${hostname}.${domain}", > $inorout = "1") { > file{ ''conf'':So, if you use this define twice, you would end up with two File resources named ''conf''...> path => > "/etc/apache2/sites-available/${servername}", > ensure => present, > content => > template(''/etc/puppet/modules/apache2/templates/vhost.erb''), > } > > file{ ''link'':So, if you use this define twice, you would end up with two File resources named ''link''... Etcetera. You have to make sure that your resource names are globally unique. Why not just do: file { "/etc/apache2/sites-enabled/${servername}": ... } That would solve most of your problems, but keep on reading...> path => "/etc/apache2/sites-enabled/${servername}", > ensure => link, > target => > "/etc/apache2/sites-available/${servername}", > require => File[''conf''], > } > > file{ "${docroot}": > ensure => directory, > }If you do this, you have to make sure your $docroot is different for each vhost.> > file{ "${docroot}/${servername}": > ensure => directory, > require => File["${docroot}"], > } > > file{ "${docroot}/${servername}/html/": > ensure => directory, > require => File["${docroot}/${servername}"], > } > > file{ ''defrem'': > path => ''/etc/apache2/sites-enabled/000-default'', > ensure => absent, > }This resource doesn''t contain any variable components at all, so this will always result in a duplicate definition. To fix this, you have to do what John Bollinger explained: move this resource outside the defined type. You can either make it virtual and realize() it here, or you can move it to a dedicated class and include the class here. Both methods will work, but I think that current best practices prefer the virual resource over the class inclusion.> > file{ ''index'': > path => "${docroot}/${servername}/html/index.html", > ensure => present, > content => "Welcome to hell of ${servername}!!!!", > } > > service{ ''apache2'': > ensure => running, > restart => ''service apache2 reload'', > require => [ File[''conf''], File[''link''], > File["${docroot}/${servername}/html/"] ], > subscribe => [ File[''conf''], File[''defrem''] ], > } > } > > and this is my node config > > node eurwebtest02 { > include apache2 > include apache2::mods > include apache2::pringo > import "apache2/vhost.pp" > > vhost { ''local'': > } > > vhost { ''test'': > servername => "test.${domain}", > serveralias => "www.test.${domain}", > inorout => ''0'', > } > } > > > I tried to virtualize vhost in vhost.pp with @ > and realize them in the node config, but seems i cant get a working > solution to use vhost resource type more than 1. > > Can you point me to the right direction? How can i create 100 vhost with > that defined class or something like thisBest regards, Martijn Grendelman> > On 18 November 2011 11:19, Peter Horvath <peter.horvath77@gmail.com > <mailto:peter.horvath77@gmail.com>> wrote: > > As i figured out the source of my problem was that i used the defined > resource type twice in a manifest. > I didn''t know that a defined resource type cannot be used twice in the > same manifest as you can use multiple times a built in one. > > hmmm > > > On 17 November 2011 22:14, jcbollinger <John.Bollinger@stjude.org > <mailto:John.Bollinger@stjude.org>> wrote: > > > > On Nov 17, 1:50 pm, Peter Horvath <peter.horvat...@gmail.com > <mailto:peter.horvat...@gmail.com>> wrote: > > i know all of this and i did grep before i wrote this email :) > > There is no other file[conf] > > > In that case, the one declaration must be processed twice. It must > appear inside a defined type that you instantiate more than once. > > If both definition instances are supposed to declare the same file, > then move the declaration outside the definition, make it virtual, and > have the definition ''realize'' it instead of declaring it. If the > definitions are each supposed to delare a different file then you have > a bug in your manifest. With respect to the latter possibility, I > observe that the resource title is not an absolute path. That could > be a sign that a variable in the Files'' titles was unexpectedly > undefined, but even if not, it''s unlikely to be what you want. > > > John > > -- > 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 > <mailto:puppet-users@googlegroups.com>. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com > <mailto:puppet-users%2Bunsubscribe@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.-- 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.
As you recommended i change all my file resources define vhost ($servername = "${hostname}.${domain}", $serveralias "www.${hostname}.${domain}", $inorout = "1") { file{ "/etc/apache2/sites-available/${servername}": ensure => present, content => template(''/etc/puppet/modules/apache2/templates/vhost.erb''), } file{ "/etc/apache2/sites-enabled/${servername}": ensure => link, target => "/etc/apache2/sites-available/${servername}", require => File["/etc/apache2/sites-available/${servername}"], } file{ "/var/www/${servername}": ensure => directory, } file{ "/var/www/${servername}/html/": ensure => directory, require => File["/var/www/${servername}"], } file{ "/var/www/${servername}/html/index.html": ensure => present, content => "Welcome to hell of ${servername}!!!!", } service{ "${servername}": name => ''apaceh2'', ensure => running, restart => ''service apache2 reload'', require => [ File["/etc/apache2/sites-enabled/${servername}"], File["/var/www/${servername}/html/"] ], subscribe => [ File["/etc/apache2/sites-enabled/${servername}"] ], } } as you stated apache restart will fail my defined resource type usage how can i reload apache with every new vhost? Virtualization works pretty much the same as using unique variable defined names. Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias Service[test.eurweb] to ["apache2"]; resource ["Service", ["apache2"]] already exists at /etc/puppet/modules/apache2/manifests/vhost.pp:33 on node eurwebtest02.eurweb Am i wrong? On 18 November 2011 15:15, Martijn Grendelman <martijn@iphion.nl> wrote:> On 18-11-11 15:58, Peter Horvath wrote: > > Seems i dont understand how get over this. > > I have this defined resource type > > > > vhost.pp > > > > define vhost ($docroot = "/var/www", $servername > > "${hostname}.${domain}", $serveralias = "www.${hostname}.${domain}", > > $inorout = "1") { > > file{ ''conf'': > > So, if you use this define twice, you would end up with two File resources > named ''conf''... > > > path => > > "/etc/apache2/sites-available/${servername}", > > ensure => present, > > content => > > template(''/etc/puppet/modules/apache2/templates/vhost.erb''), > > } > > > > file{ ''link'': > > So, if you use this define twice, you would end up with two File resources > named ''link''... > > Etcetera. You have to make sure that your resource names are globally > unique. Why not just do: > > file { "/etc/apache2/sites-enabled/${servername}": ... } > > That would solve most of your problems, but keep on reading... > > > > path => > "/etc/apache2/sites-enabled/${servername}", > > ensure => link, > > target => > > "/etc/apache2/sites-available/${servername}", > > require => File[''conf''], > > } > > > > file{ "${docroot}": > > ensure => directory, > > } > > If you do this, you have to make sure your $docroot is different for each > vhost. > > > > > file{ "${docroot}/${servername}": > > ensure => directory, > > require => File["${docroot}"], > > } > > > > file{ "${docroot}/${servername}/html/": > > ensure => directory, > > require => File["${docroot}/${servername}"], > > } > > > > file{ ''defrem'': > > path => > ''/etc/apache2/sites-enabled/000-default'', > > ensure => absent, > > } > > This resource doesn''t contain any variable components at all, so this will > always result in a duplicate definition. > > To fix this, you have to do what John Bollinger explained: move this > resource outside the defined type. You can either make it virtual and > realize() it here, or you can move it to a dedicated class and include the > class here. Both methods will work, but I think that current best > practices prefer the virual resource over the class inclusion. > > > > > file{ ''index'': > > path => > "${docroot}/${servername}/html/index.html", > > ensure => present, > > content => "Welcome to hell of > ${servername}!!!!", > > } > > > > service{ ''apache2'': > > ensure => running, > > restart => ''service apache2 reload'', > > require => [ File[''conf''], File[''link''], > > File["${docroot}/${servername}/html/"] ], > > subscribe => [ File[''conf''], File[''defrem''] ], > > } > > } > > > > and this is my node config > > > > node eurwebtest02 { > > include apache2 > > include apache2::mods > > include apache2::pringo > > import "apache2/vhost.pp" > > > > vhost { ''local'': > > } > > > > vhost { ''test'': > > servername => "test.${domain}", > > serveralias => "www.test.${domain}", > > inorout => ''0'', > > } > > } > > > > > > I tried to virtualize vhost in vhost.pp with @ > > and realize them in the node config, but seems i cant get a working > > solution to use vhost resource type more than 1. > > > > Can you point me to the right direction? How can i create 100 vhost with > > that defined class or something like this > > > Best regards, > Martijn Grendelman > > > > > > > > > > On 18 November 2011 11:19, Peter Horvath <peter.horvath77@gmail.com > > <mailto:peter.horvath77@gmail.com>> wrote: > > > > As i figured out the source of my problem was that i used the defined > > resource type twice in a manifest. > > I didn''t know that a defined resource type cannot be used twice in > the > > same manifest as you can use multiple times a built in one. > > > > hmmm > > > > > > On 17 November 2011 22:14, jcbollinger <John.Bollinger@stjude.org > > <mailto:John.Bollinger@stjude.org>> wrote: > > > > > > > > On Nov 17, 1:50 pm, Peter Horvath <peter.horvat...@gmail.com > > <mailto:peter.horvat...@gmail.com>> wrote: > > > i know all of this and i did grep before i wrote this email :) > > > There is no other file[conf] > > > > > > In that case, the one declaration must be processed twice. It > must > > appear inside a defined type that you instantiate more than once. > > > > If both definition instances are supposed to declare the same > file, > > then move the declaration outside the definition, make it > virtual, and > > have the definition ''realize'' it instead of declaring it. If the > > definitions are each supposed to delare a different file then > you have > > a bug in your manifest. With respect to the latter possibility, > I > > observe that the resource title is not an absolute path. That > could > > be a sign that a variable in the Files'' titles was unexpectedly > > undefined, but even if not, it''s unlikely to be what you want. > > > > > > John > > > > -- > > 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 > > <mailto:puppet-users@googlegroups.com>. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com > > <mailto:puppet-users%2Bunsubscribe@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. > > -- > 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 Fri, Nov 18, 2011 at 12:40 PM, Peter Horvath <peter.horvath77@gmail.com> wrote:> As you recommended i change all my file resources > define vhost ($servername = "${hostname}.${domain}", $serveralias > "www.${hostname}.${domain}", $inorout = "1") { > file{ "/etc/apache2/sites-available/${servername}": > ensure => present, > content => > template(''/etc/puppet/modules/apache2/templates/vhost.erb''), > } > file{ "/etc/apache2/sites-enabled/${servername}": > ensure => link, > target => > "/etc/apache2/sites-available/${servername}", > require => > File["/etc/apache2/sites-available/${servername}"], > } > file{ "/var/www/${servername}": > ensure => directory, > } > file{ "/var/www/${servername}/html/": > ensure => directory, > require => File["/var/www/${servername}"], > } > file{ "/var/www/${servername}/html/index.html": > ensure => present, > content => "Welcome to hell of ${servername}!!!!", > } > service{ "${servername}": > name => ''apaceh2'', > ensure => running, > restart => ''service apache2 reload'', > require => [ > File["/etc/apache2/sites-enabled/${servername}"], > File["/var/www/${servername}/html/"] ], > subscribe => [ > File["/etc/apache2/sites-enabled/${servername}"] ], > } > } > as you stated apache restart will fail my defined resource type usage how > can i reload apache with every new vhost? Virtualization works pretty much > the same as using unique variable defined names. > Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias > Service[test.eurweb] to ["apache2"]; resource ["Service", ["apache2"]] > already exists at /etc/puppet/modules/apache2/manifests/vhost.pp:33 on node > eurwebtest02.eurweb > Am i wrong?The service should not be in the define, it should be in a separate class, and instead of service require => File, in the define specify file { ...: notify => Service["apache2''] } Nan -- 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.