Hello, I have this defined resource type which is working perfectly until I want an ssl an http vhost pointing to the same directory in which case the unique $servername variable became a singleton Do you have any idea how to get around this? I am pretty tired at the moment and cant think of any good solution. define vhost ($servername = "${hostname}.${domain}", $serveralias = [ "www.${hostname}.${domain}" ], $inorout = "1", $owner = "root", $group = "root", $enabled = "link", $rewrite = "", $ssl = "false", $cacert "", $certchain = "", $certfile = "", $keyfile = "" ) { $filename = $ssl ? { ''true'' => "${servername}-ssl", ''false'' => "${servername}", } file{ "/etc/apache2/sites-available/${filename}": ensure => present, content => template("${module_name}/vhost.erb"), require => Package[''apache2''], notify => Service[''apache2''], } file{ "/etc/apache2/sites-enabled/${filename}": ensure => "${enabled}", target => "/etc/apache2/sites-available/${filename}", require => File["/etc/apache2/sites-available/${filename}"], notify => Service[''apache2''], } file{ "/var/www/${servername}": ensure => directory, owner => "${owner}", group => "${group}", recurse => true, require => Package[''apache2''], } file{ "/var/www/${servername}/html/": ensure => directory, require => File["/var/www/${servername}"], } } Node configuration node eurwebtest03 inherits eurwebtest-template { vhost{ ''test'': servername => ''test.eurweb.com'', ssl => ''true'', enabled => ''link'', inorout => ''0''; ''test1'': servername => ''test.eurweb.com'', enabled => ''link'', inorout => ''0''; ''test2'': servername => ''test2.eurweb.com'', ssl => ''true'', enabled => ''link'', inorout => ''0''; ''test3'': servername => ''test3.eurweb.com'', enabled => ''link'', inorout => ''0''; } } Thank you -- 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.
Peter Horvath
2012-Mar-13 20:32 UTC
[Puppet Users] Re: vhost creation with and without ssl
I moved out the directory creations into a different class and included that class and it is working now. On Mar 13, 8:05 pm, Peter Horvath <peter.horvat...@gmail.com> wrote:> Hello, > > I have this defined resource type which is working perfectly until I > want an ssl an http vhost pointing to the same directory in which case > the unique $servername variable became a singleton > Do you have any idea how to get around this? I am pretty tired at the > moment and cant think of any good solution. > > define vhost ($servername = "${hostname}.${domain}", $serveralias = [ > "www.${hostname}.${domain}" ], $inorout = "1", $owner = "root", $group > = "root", $enabled = "link", $rewrite = "", $ssl = "false", $cacert > "", $certchain = "", $certfile = "", $keyfile = "" ) { > > $filename = $ssl ? { > ''true'' => "${servername}-ssl", > ''false'' => "${servername}", > } > > file{ "/etc/apache2/sites-available/${filename}": > ensure => present, > content => template("${module_name}/vhost.erb"), > require => Package[''apache2''], > notify => Service[''apache2''], > } > > file{ "/etc/apache2/sites-enabled/${filename}": > ensure => "${enabled}", > target => "/etc/apache2/sites-available/${filename}", > require => > File["/etc/apache2/sites-available/${filename}"], > notify => Service[''apache2''], > } > > file{ "/var/www/${servername}": > ensure => directory, > owner => "${owner}", > group => "${group}", > recurse => true, > require => Package[''apache2''], > } > > file{ "/var/www/${servername}/html/": > ensure => directory, > require => File["/var/www/${servername}"], > } > > } > > Node configuration > > node eurwebtest03 inherits eurwebtest-template { > vhost{ ''test'': > servername => ''test.eurweb.com'', > ssl => ''true'', > enabled => ''link'', > inorout => ''0''; > > ''test1'': > servername => ''test.eurweb.com'', > enabled => ''link'', > inorout => ''0''; > > ''test2'': > servername => ''test2.eurweb.com'', > ssl => ''true'', > enabled => ''link'', > inorout => ''0''; > > ''test3'': > servername => ''test3.eurweb.com'', > enabled => ''link'', > inorout => ''0''; > > } > > } > > Thank you-- 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.
Peter Horvath
2012-Mar-13 21:55 UTC
Re: [Puppet Users] Re: vhost creation with and without ssl
But still the problem with include that it includes the directory creation class once so it creates only the first docroot directory. and the directory for test2 and test3 will not be created. Can you help me a way around this? On 13 March 2012 20:32, Peter Horvath <peter.horvath77@gmail.com> wrote:> I moved out the directory creations into a different class and > included that class and it is working now. > > > On Mar 13, 8:05 pm, Peter Horvath <peter.horvat...@gmail.com> wrote: >> Hello, >> >> I have this defined resource type which is working perfectly until I >> want an ssl an http vhost pointing to the same directory in which case >> the unique $servername variable became a singleton >> Do you have any idea how to get around this? I am pretty tired at the >> moment and cant think of any good solution. >> >> define vhost ($servername = "${hostname}.${domain}", $serveralias = [ >> "www.${hostname}.${domain}" ], $inorout = "1", $owner = "root", $group >> = "root", $enabled = "link", $rewrite = "", $ssl = "false", $cacert >> "", $certchain = "", $certfile = "", $keyfile = "" ) { >> >> $filename = $ssl ? { >> ''true'' => "${servername}-ssl", >> ''false'' => "${servername}", >> } >> >> file{ "/etc/apache2/sites-available/${filename}": >> ensure => present, >> content => template("${module_name}/vhost.erb"), >> require => Package[''apache2''], >> notify => Service[''apache2''], >> } >> >> file{ "/etc/apache2/sites-enabled/${filename}": >> ensure => "${enabled}", >> target => "/etc/apache2/sites-available/${filename}", >> require => >> File["/etc/apache2/sites-available/${filename}"], >> notify => Service[''apache2''], >> } >> >> file{ "/var/www/${servername}": >> ensure => directory, >> owner => "${owner}", >> group => "${group}", >> recurse => true, >> require => Package[''apache2''], >> } >> >> file{ "/var/www/${servername}/html/": >> ensure => directory, >> require => File["/var/www/${servername}"], >> } >> >> } >> >> Node configuration >> >> node eurwebtest03 inherits eurwebtest-template { >> vhost{ ''test'': >> servername => ''test.eurweb.com'', >> ssl => ''true'', >> enabled => ''link'', >> inorout => ''0''; >> >> ''test1'': >> servername => ''test.eurweb.com'', >> enabled => ''link'', >> inorout => ''0''; >> >> ''test2'': >> servername => ''test2.eurweb.com'', >> ssl => ''true'', >> enabled => ''link'', >> inorout => ''0''; >> >> ''test3'': >> servername => ''test3.eurweb.com'', >> enabled => ''link'', >> inorout => ''0''; >> >> } >> >> } >> >> Thank you > > -- > 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.