using defined types in foreman to create instance

Showing 1-8 of 8 messages
using defined types in foreman to create instance Vlados 2/13/13 9:29 AM
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.

Re: [foreman-users] using defined types in foreman to create instance Dominic Cleal 2/13/13 9:31 AM
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 :

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:

---
data:
  first:
    a: "param 1a"
    b: "param 1b"
  second:
    a: "param 2a"
    b: "param 2b"

--
Dominic Cleal
Red Hat Engineering
Re: [foreman-users] using defined types in foreman to create instance Corey Osman 2/13/13 9:34 AM

Use hiera or foreman to fill in all those variables.  You could auto populate with defined types and puppet 3 and foreman to.

--
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-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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Re: [foreman-users] using defined types in foreman to create instance Vlados 2/13/13 9:35 AM
Cool, thank you!

среда, 13 февраля 2013 г., 21:31:32 UTC+4 пользователь Dominic Cleal написал:
Re: using defined types in foreman to create instance James James 3/13/14 1:58 AM
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.
Re: using defined types in foreman to create instance Damien Mathieu 5/12/14 5:20 AM
Hi

Everybody solve the problem ?

I kknow is very old, but i have the same problem today

thx
Re: [foreman-users] Re: using defined types in foreman to create instance James James 7/16/14 1:59 PM
Hi,

I have solved my problem so can you explain me yours ?


--
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.

Re: [foreman-users] Re: using defined types in foreman to create instance soumen trivedi 11/11/14 3:44 AM
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. :)