Please help.
For example:
How i can pass parameters to defined puppet type *apache::vhost *and create
instance from foreman :
Definition: apache::vhost
···
#
# This class installs Apache Virtual Hosts
#
# Parameters:
# - The $port to configure the host on
# - The $docroot provides the DocumentationRoot variable
# - The $template option specifies whether to use the default template or
override
# - The $priority of the site
# - The $serveraliases of the site
# - The $options for the given vhost
# - The $vhost_name for name based virtualhosting, defaulting to *
#
# Actions:
# - Install Apache Virtual Hosts
#
# Requires:
# - The apache class
#
# Sample Usage:
# apache::vhost { 'site.name.fqdn':
# priority => '20',
# port => '80',
# docroot => '/path/to/docroot',
# }
define apache::vhost(
$port,
$docroot,
$template = ‘apache/vhost-default.conf.erb’,
$priority = ‘25’,
$servername = ‘’,
$serveraliases = ‘’,
$options = “Indexes FollowSymLinks MultiViews”,
$vhost_name = ‘*’
) {
include apache
Below is a pre-2.6.5 idiom for having a parameter default to the title,
but you could also just declare $servername = “$title” in the parameters
list and change srvname to servername in the template.
if $servername == ‘’ {
$srvname = $title
} else {
$srvname = $servername
}
case $operatingsystem {
‘centos’, ‘redhat’, ‘fedora’: { $vdir = ‘/etc/httpd/conf.d’
$logdir = ‘/var/log/httpd’}
‘ubuntu’, ‘debian’: { $vdir = ‘/etc/apache2/sites-enabled’
$logdir = ‘/var/log/apache2’}
default: { $vdir = ‘/etc/apache2/sites-enabled’
$logdir = ‘/var/log/apache2’}
}
file {
"${vdir}/${priority}-${name}.conf":
content => template($template),
owner => ‘root’,
group => ‘root’,
mode => ‘755’,
require => Package[‘httpd’],
notify => Service[‘httpd’],
}
}
With regards, Vladislav.
Use hiera or foreman to fill in all those variables. You could auto
populate with defined types and puppet 3 and foreman to.
···
On Feb 13, 2013 11:29 AM, "Vlados Vlados" wrote:
Please help.
For example:
How i can pass parameters to defined puppet type *apache::vhost *and
create instance from foreman :
Definition: apache::vhost
This class installs Apache Virtual Hosts
Parameters:
- The $port to configure the host on
- The $docroot provides the DocumentationRoot variable
- The $template option specifies whether to use the default template or
override
- The $priority of the site
- The $serveraliases of the site
- The $options for the given vhost
- The $vhost_name for name based virtualhosting, defaulting to *
Actions:
- Install Apache Virtual Hosts
Requires:
- The apache class
Sample Usage:
apache::vhost { ‘site.name.fqdn’:
priority => ‘20’,
port => ‘80’,
docroot => ‘/path/to/docroot’,
}
define apache::vhost(
$port,
$docroot,
$template = ‘apache/vhost-default.conf.erb’,
$priority = ‘25’,
$servername = ‘’,
$serveraliases = ‘’,
$options = “Indexes FollowSymLinks MultiViews”,
$vhost_name = ‘*’
) {
include apache
Below is a pre-2.6.5 idiom for having a parameter default to the title,
but you could also just declare $servername = “$title” in the parameters
list and change srvname to servername in the template.
if $servername == ‘’ {
$srvname = $title
} else {
$srvname = $servername
}
case $operatingsystem {
‘centos’, ‘redhat’, ‘fedora’: { $vdir = ‘/etc/httpd/conf.d’
$logdir = ‘/var/log/httpd’}
‘ubuntu’, ‘debian’: { $vdir = ‘/etc/apache2/sites-enabled’
$logdir = ‘/var/log/apache2’}
default: { $vdir = ‘/etc/apache2/sites-enabled’
$logdir = ‘/var/log/apache2’}
}
file {
"${vdir}/${priority}-${name}.conf":
content => template($template),
owner => ‘root’,
group => ‘root’,
mode => ‘755’,
require => Package[‘httpd’],
notify => Service[‘httpd’],
}
}
With regards, Vladislav.
–
You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
You can't instantiate resources (defined types, or native) over the
Puppet ENC interface. Maybe use create_resources instead, e.g.
define foo($a, $b) {
notify { "$title: got $a and $b": }
}
class createfoo($data){
create_resources(foo, $data)
}
Then in foreman for the createfoo class, set the data parameter to:
···
On 13/02/13 17:29, Vlados Vlados wrote:
> Please help.
> For example:
> How i can pass parameters to defined puppet type *apache::vhost *and
> create instance from foreman :
data:
first:
a: "param 1a"
b: "param 1b"
second:
a: "param 2a"
b: “param 2b”
–
Dominic Cleal
Red Hat Engineering
Hi Vlados,
Can you show me how you solve your problem ? I a facing the same issue but
I don't know how to set the varibles in foreman.
Regards.
···
Le mercredi 13 février 2013 18:29:00 UTC+1, Vlados Vladosov a écrit :
>
> Please help.
> For example:
> How i can pass parameters to defined puppet type *apache::vhost *and
> create instance from foreman :
>
>
>
>
> # Definition: apache::vhost
> #
> # This class installs Apache Virtual Hosts
> #
> # Parameters:
> # - The $port to configure the host on
> # - The $docroot provides the DocumentationRoot variable
> # - The $template option specifies whether to use the default template or
> override
> # - The $priority of the site
> # - The $serveraliases of the site
> # - The $options for the given vhost
> # - The $vhost_name for name based virtualhosting, defaulting to *
> #
> # Actions:
> # - Install Apache Virtual Hosts
> #
> # Requires:
> # - The apache class
> #
> # Sample Usage:
> # apache::vhost { 'site.name.fqdn':
> # priority => '20',
> # port => '80',
> # docroot => '/path/to/docroot',
> # }
>
>
> define apache::vhost(
> $port,
> $docroot,
> $template = 'apache/vhost-default.conf.erb',
> $priority = '25',
> $servername = '',
> $serveraliases = '',
> $options = "Indexes FollowSymLinks MultiViews",
> $vhost_name = '*'
> ) {
>
> include apache
>
> # Below is a pre-2.6.5 idiom for having a parameter default to the title,
> # but you could also just declare $servername = "$title" in the parameters
> # list and change srvname to servername in the template.
>
> if $servername == '' {
> $srvname = $title
> } else {
> $srvname = $servername
> }
> case $operatingsystem {
> 'centos', 'redhat', 'fedora': { $vdir = '/etc/httpd/conf.d'
> $logdir = '/var/log/httpd'}
> 'ubuntu', 'debian': { $vdir = '/etc/apache2/sites-enabled'
> $logdir = '/var/log/apache2'}
> default: { $vdir = '/etc/apache2/sites-enabled'
> $logdir = '/var/log/apache2'}
> }
> file {
> "${vdir}/${priority}-${name}.conf":
> content => template($template),
> owner => 'root',
> group => 'root',
> mode => '755',
> require => Package['httpd'],
> notify => Service['httpd'],
> }
>
> }
>
>
>
>
> With regards, Vladislav.
>
>
Hi
Everybody solve the problem ?
I kknow is very old, but i have the same problem today
thx
···
Le jeudi 13 mars 2014 09:58:49 UTC+1, James James a écrit :
>
> Hi Vlados,
>
> Can you show me how you solve your problem ? I a facing the same issue but
> I don't know how to set the varibles in foreman.
>
>
> Regards.
>
>
> Le mercredi 13 février 2013 18:29:00 UTC+1, Vlados Vladosov a écrit :
>>
>> Please help.
>> For example:
>> How i can pass parameters to defined puppet type *apache::vhost *and
>> create instance from foreman :
>>
>>
>>
>>
>> # Definition: apache::vhost
>> #
>> # This class installs Apache Virtual Hosts
>> #
>> # Parameters:
>> # - The $port to configure the host on
>> # - The $docroot provides the DocumentationRoot variable
>> # - The $template option specifies whether to use the default template or
>> override
>> # - The $priority of the site
>> # - The $serveraliases of the site
>> # - The $options for the given vhost
>> # - The $vhost_name for name based virtualhosting, defaulting to *
>> #
>> # Actions:
>> # - Install Apache Virtual Hosts
>> #
>> # Requires:
>> # - The apache class
>> #
>> # Sample Usage:
>> # apache::vhost { 'site.name.fqdn':
>> # priority => '20',
>> # port => '80',
>> # docroot => '/path/to/docroot',
>> # }
>>
>>
>> define apache::vhost(
>> $port,
>> $docroot,
>> $template = 'apache/vhost-default.conf.erb',
>> $priority = '25',
>> $servername = '',
>> $serveraliases = '',
>> $options = "Indexes FollowSymLinks MultiViews",
>> $vhost_name = '*'
>> ) {
>>
>> include apache
>>
>> # Below is a pre-2.6.5 idiom for having a parameter default to the title,
>> # but you could also just declare $servername = "$title" in the parameters
>> # list and change srvname to servername in the template.
>>
>> if $servername == '' {
>> $srvname = $title
>> } else {
>> $srvname = $servername
>> }
>> case $operatingsystem {
>> 'centos', 'redhat', 'fedora': { $vdir = '/etc/httpd/conf.d'
>> $logdir = '/var/log/httpd'}
>> 'ubuntu', 'debian': { $vdir = '/etc/apache2/sites-enabled'
>> $logdir = '/var/log/apache2'}
>> default: { $vdir = '/etc/apache2/sites-enabled'
>> $logdir = '/var/log/apache2'}
>> }
>> file {
>> "${vdir}/${priority}-${name}.conf":
>> content => template($template),
>> owner => 'root',
>> group => 'root',
>> mode => '755',
>> require => Package['httpd'],
>> notify => Service['httpd'],
>> }
>>
>> }
>>
>>
>>
>>
>> With regards, Vladislav.
>>
>>
Hi,
I have solved my problem so can you explain me yours ?
···
2014-05-12 14:20 GMT+02:00 Damien Mathieu :
Hi
Everybody solve the problem ?
I kknow is very old, but i have the same problem today
thx
Le jeudi 13 mars 2014 09:58:49 UTC+1, James James a écrit :
Hi Vlados,
Can you show me how you solve your problem ? I a facing the same issue
but I don’t know how to set the varibles in foreman.
Regards.
Le mercredi 13 février 2013 18:29:00 UTC+1, Vlados Vladosov a écrit :
Please help.
For example:
How i can pass parameters to defined puppet type *apache::vhost *and
create instance from foreman :
Definition: apache::vhost
This class installs Apache Virtual Hosts
Parameters:
- The $port to configure the host on
- The $docroot provides the DocumentationRoot variable
- The $template option specifies whether to use the default template
or override
- The $priority of the site
- The $serveraliases of the site
- The $options for the given vhost
- The $vhost_name for name based virtualhosting, defaulting to *
Actions:
- Install Apache Virtual Hosts
Requires:
- The apache class
Sample Usage:
apache::vhost { ‘site.name.fqdn’:
priority => ‘20’,
port => ‘80’,
docroot => ‘/path/to/docroot’,
}
define apache::vhost(
$port,
$docroot,
$template = ‘apache/vhost-default.conf.erb’,
$priority = ‘25’,
$servername = ‘’,
$serveraliases = ‘’,
$options = “Indexes FollowSymLinks MultiViews”,
$vhost_name = ‘*’
) {
include apache
Below is a pre-2.6.5 idiom for having a parameter default to the
title,
but you could also just declare $servername = “$title” in the
parameters
list and change srvname to servername in the template.
if $servername == ‘’ {
$srvname = $title
} else {
$srvname = $servername
}
case $operatingsystem {
‘centos’, ‘redhat’, ‘fedora’: { $vdir = ‘/etc/httpd/conf.d’
$logdir = ‘/var/log/httpd’}
‘ubuntu’, ‘debian’: { $vdir = ‘/etc/apache2/sites-enabled’
$logdir = ‘/var/log/apache2’}
default: { $vdir = ‘/etc/apache2/sites-enabled’
$logdir = ‘/var/log/apache2’}
}
file {
"${vdir}/${priority}-${name}.conf":
content => template($template),
owner => ‘root’,
group => ‘root’,
mode => ‘755’,
require => Package[‘httpd’],
notify => Service[‘httpd’],
}
}
With regards, Vladislav.
–
You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/o-Sqjo-n21A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.
I have created a puppet module
(https://github.com/soumentrivedi/foreman_resources) to achieve this.
I have imported this module into my Foreman instance, performed the
required setup for Puppet Future Parser (mentioned in the Readme of the
module) and tested this Puppetlabs postgresql module. All looks ok and
works fine. I have given a sample yaml example as well for how to pass
values.
I am sure there might be many more slicker ways in achieving this, the
current solution works for us perfectly fine.
Feedback on the module is always welcome. 
···
On Wednesday, July 16, 2014 9:59:27 PM UTC+1, James James wrote:
>
> Hi,
>
> I have solved my problem so can you explain me yours ?
>
>
> 2014-05-12 14:20 GMT+02:00 Damien Mathieu >:
>
>> Hi
>>
>> Everybody solve the problem ?
>>
>> I kknow is very old, but i have the same problem today
>>
>> thx
>>
>> Le jeudi 13 mars 2014 09:58:49 UTC+1, James James a écrit :
>>
>>> Hi Vlados,
>>>
>>> Can you show me how you solve your problem ? I a facing the same issue
>>> but I don't know how to set the varibles in foreman.
>>>
>>>
>>> Regards.
>>>
>>>
>>> Le mercredi 13 février 2013 18:29:00 UTC+1, Vlados Vladosov a écrit :
>>>>
>>>> Please help.
>>>> For example:
>>>> How i can pass parameters to defined puppet type *apache::vhost *and
>>>> create instance from foreman :
>>>>
>>>>
>>>>
>>>>
>>>> # Definition: apache::vhost
>>>> #
>>>> # This class installs Apache Virtual Hosts
>>>> #
>>>> # Parameters:
>>>> # - The $port to configure the host on
>>>> # - The $docroot provides the DocumentationRoot variable
>>>> # - The $template option specifies whether to use the default template
>>>> or override
>>>> # - The $priority of the site
>>>> # - The $serveraliases of the site
>>>> # - The $options for the given vhost
>>>> # - The $vhost_name for name based virtualhosting, defaulting to *
>>>> #
>>>> # Actions:
>>>> # - Install Apache Virtual Hosts
>>>> #
>>>> # Requires:
>>>> # - The apache class
>>>> #
>>>> # Sample Usage:
>>>> # apache::vhost { 'site.name.fqdn':
>>>> # priority => '20',
>>>> # port => '80',
>>>> # docroot => '/path/to/docroot',
>>>> # }
>>>>
>>>>
>>>> define apache::vhost(
>>>> $port,
>>>> $docroot,
>>>> $template = 'apache/vhost-default.conf.erb',
>>>> $priority = '25',
>>>> $servername = '',
>>>> $serveraliases = '',
>>>> $options = "Indexes FollowSymLinks MultiViews",
>>>> $vhost_name = '*'
>>>> ) {
>>>>
>>>> include apache
>>>>
>>>> # Below is a pre-2.6.5 idiom for having a parameter default to the
>>>> title,
>>>> # but you could also just declare $servername = "$title" in the
>>>> parameters
>>>> # list and change srvname to servername in the template.
>>>>
>>>> if $servername == '' {
>>>> $srvname = $title
>>>> } else {
>>>> $srvname = $servername
>>>> }
>>>> case $operatingsystem {
>>>> 'centos', 'redhat', 'fedora': { $vdir = '/etc/httpd/conf.d'
>>>> $logdir = '/var/log/httpd'}
>>>> 'ubuntu', 'debian': { $vdir = '/etc/apache2/sites-enabled'
>>>> $logdir = '/var/log/apache2'}
>>>> default: { $vdir = '/etc/apache2/sites-enabled'
>>>> $logdir = '/var/log/apache2'}
>>>> }
>>>> file {
>>>> "${vdir}/${priority}-${name}.conf":
>>>> content => template($template),
>>>> owner => 'root',
>>>> group => 'root',
>>>> mode => '755',
>>>> require => Package['httpd'],
>>>> notify => Service['httpd'],
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>> With regards, Vladislav.
>>>>
>>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Foreman users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/foreman-users/o-Sqjo-n21A/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> foreman-user...@googlegroups.com .
>> To post to this group, send email to forema...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/foreman-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>