[Puppet Users] Re: erb including other erbs

2011-04-06 Thread draeath
That didn't exactly help me out.

I would like to include one .erb from inside another .erb (vs
concatenating .erbs together, which is what I'm gathering is what
happens when done in the manifest).

The file path I gave was an example, as the one given is written in a
way that suggests absolute system paths.

This is the entry in question:
http://docs.puppetlabs.com/guides/templating.html#combining-templates

On Apr 6, 6:48 pm, Nan Liu  wrote:
> On Wed, Apr 6, 2011 at 2:54 PM, draeath  wrote:
> > In the puppet documentation, it is stated:
>
> > "You can also use templates to fill in variables in addition to
> > filling out file contents."
> > template('/path/to/template1','/path/to/template2')
>
> I don't have the specific document, so not sure if I'm missing any
> context, I presume this simply means:
>
> $foo = template('/path/to/foo.erb')
>
> file { '/etc/a':
>   content => template('/path/to/foo.erb')
>
> }
> > My question: is this done in the ERB file, or in the puppet manifest?
> > If done in the ERB file, I assume it also has to be within <% %> tags,
> > but unlike all the other examples in the documentation it is not
> > presented this way.
>
> > The /path/to/ - is there some way to properly do this, or do I need to
> > do '/etc/puppet/files/templates/./foo.erb' ?
>
> Please follow the modules 
> convention:http://docs.puppetlabs.com/guides/modules.html
>
> For portability, place the file in $module_name/templates/ directory
> and use the module name:
> $foo = template("${module_name}/foo.erb")
>
> Thanks,
>
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] erb including other erbs

2011-04-06 Thread draeath
In the puppet documentation, it is stated:

"You can also use templates to fill in variables in addition to
filling out file contents."
template('/path/to/template1','/path/to/template2')

My question: is this done in the ERB file, or in the puppet manifest?
If done in the ERB file, I assume it also has to be within <% %> tags,
but unlike all the other examples in the documentation it is not
presented this way.

The /path/to/ - is there some way to properly do this, or do I need to
do '/etc/puppet/files/templates/./foo.erb' ?

Thanks!

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: factor value 'value-x' for 'somefact' not in required list 'value-w,value-x,value-y,value-z'

2011-03-17 Thread draeath
On Thu, Mar 17, 2011 at 6:10 PM, Nigel Kersten 
wrote:
> On Thu, Mar 17, 2011 at 12:14 PM, draeath  wrote:
>> On Mar 17, 2:20 pm, draeath wrote:
>>> Greetings all,
>>>
>>> (puppet 0.25.x)
>>>
>>> I'm trying to use puppetd on some SuSE clients. I had to find and put
>>> the zypper provider into the system, as it was absent. I'll show the
>>> contents of this file below.
>>>
>>> The issue that I'm running into is this:
>>> err: //syslog/Package[syslogd]: Failed to retrieve current state of
>>> resource: Provider zypper is not functional on this platform
>>> debug: facter value 'sles' for 'operatingsystem' not in required list
>>> 'suse,sles,sled,opensuse'
>>>
>>> This makes no sense to me at all. sles is quite clearly in that list.
>>>
>>> Here's the code from 
>>> zypper.rb:https://github.com/mmrobins/puppet/blob/bug%2Fmaster%2F3802-zypper/li...
>>>
>>> Note this:
>>> confine:operatingsystem => [:suse, :sles, :sled, :opensuse]
>>>
>>> I have no idea if this is correct or not, as I know near zero about
>>> ruby.
>>>
>>> What's up with this?
>>
>> As a workaround I'm simply doing an if $operatingsystem == "SuSE"
>> check, and if it exists, it's putting a modified copy of the file down
>> that doesn't have that confine statement. This seems to work, but it
>> feels ugly to do so.
>
>
> Do you know if SuSE always reported as "SuSE" or whether it was "suse"
> in the past?
>
> This could be a consequence of us moving away from automatically
> downcasing fact values. I'm not sure where we should do this, whether
> it's in the confine for this provider, all confines, or in Facter
> itself.
>

To be honest, I have no idea. I'm a new user to puppet, and have not
touched SuSE in a long time prior to this project.
I do find it interesting that the debug shows it as 'sles' - but in
the manifests, it is read as 'SuSE'. Rather, at least the code we are
using is checking for and acting on SuSE (and it works).

We are using "0.25.5" - which version did downcasing of fact values
take stop taking place?

(apologies for just now replying directly to you Nigel - I'm not used
to using google groups, I'm used to using NNTP clients :) )

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: factor value 'value-x' for 'somefact' not in required list 'value-w,value-x,value-y,value-z'

2011-03-17 Thread draeath
On Mar 17, 2:20 pm, draeath wrote:
> Greetings all,
>
> (puppet 0.25.x)
>
> I'm trying to use puppetd on some SuSE clients. I had to find and put
> the zypper provider into the system, as it was absent. I'll show the
> contents of this file below.
>
> The issue that I'm running into is this:
> err: //syslog/Package[syslogd]: Failed to retrieve current state of
> resource: Provider zypper is not functional on this platform
> debug: facter value 'sles' for 'operatingsystem' not in required list
> 'suse,sles,sled,opensuse'
>
> This makes no sense to me at all. sles is quite clearly in that list.
>
> Here's the code from 
> zypper.rb:https://github.com/mmrobins/puppet/blob/bug%2Fmaster%2F3802-zypper/li...
>
> Note this:
> confine:operatingsystem => [:suse, :sles, :sled, :opensuse]
>
> I have no idea if this is correct or not, as I know near zero about
> ruby.
>
> What's up with this?

As a workaround I'm simply doing an if $operatingsystem == "SuSE"
check, and if it exists, it's putting a modified copy of the file down
that doesn't have that confine statement. This seems to work, but it
feels ugly to do so.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] factor value 'value-x' for 'somefact' not in required list 'value-w,value-x,value-y,value-z'

2011-03-17 Thread draeath
Greetings all,

(puppet 0.25.x)

I'm trying to use puppetd on some SuSE clients. I had to find and put
the zypper provider into the system, as it was absent. I'll show the
contents of this file below.

The issue that I'm running into is this:
err: //syslog/Package[syslogd]: Failed to retrieve current state of
resource: Provider zypper is not functional on this platform
debug: facter value 'sles' for 'operatingsystem' not in required list
'suse,sles,sled,opensuse'

This makes no sense to me at all. sles is quite clearly in that list.

Here's the code from zypper.rb:
https://github.com/mmrobins/puppet/blob/bug%2Fmaster%2F3802-zypper/lib/puppet/provider/package/zypper.rb

Note this:
confine:operatingsystem => [:suse, :sles, :sled, :opensuse]

I have no idea if this is correct or not, as I know near zero about
ruby.

What's up with this?

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] variable scope woes

2011-02-28 Thread draeath
OK - I may be doing this all wrong. If so, I would appreciate finding
out how it -should- be done.

The basic idea is this: a node sets some variables, includes some
classes (which autoload from modules). Some of the modules use
templates to fill in files.

In these templates, we try to access these variables, and fail to do
so. Here's some example code:

# site.pp
import "nodes/basenode.pp"
import "nodes/internal.pp"
import "nodes/external.pp"

# from the node .pp, imported from site.pp
node 'mirror.example.com' {
$my_role = "mirror"
include iptables
include basenode
include sendmail
include sshkeys
}

# from modules/sshkeys/manifests/init.pp
class sshkeys {
file { "/root/.ssh":
ensure => directory;
"/root/.ssh/authorized_keys2":
ensure => file,
mode => 644,
owner => root,
group => root,
content => template("authorized_keys2.erb"),
}
}

# from authorized_keys2.erb
<% if my_role=="mirror" %>
SSH KEY DATA GOES HERE
<% end %>

When this node checks in, the template cannot resolve $my_role, and so
the SSH key(s) are not written in.

--

Previously, everything (except the template file) was included in one
monolithic site.pp, and it all worked. It's only after I've split all
the classes out into modules that this started to happen. (I also
removed the nodes from inside site.pp and put them in files, imported
as above. I've looked through some documentation and haven't been able
to figure this out. No help was to be found on freenode either.

NOTE: I just grabbed my_role as it's the most critical variable that
gives me this issue. Other variables note related to node "roles" seem
to have problems as well, for example sticking hostnames in iptables
configuration.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.