Displaying 20 results from an estimated 28 matches for "lookupvar".
2012 Sep 03
2
erb syntaxes
Hi guys,
I''m trying to do the following in my template:
location <%= location %> {
proxy_pass <%= proxy %>;
<% if scope.lookupvar(''nginx::resource::location::proxy_header'') then
scope.lookupvar(''nginx::resource::location::proxy_header'').each do
|header| %>
proxy_set_header <%= header %>
<% end %>
}
But i''m getting this error instead:
err: Could n...
2012 May 29
1
Simply Auto Increment A Number
Hi,
I have a template which looks like this
<% scope.lookupvar(''openldap::params::ldapservers'').each do |var| -%>
olcSyncrepl: {0}rid=001 provider="ldap://<%= var %>:389"
type=refreshAndPer
sist retry="5 5 300 +" searchbase="<%=
scope.lookupvar(''openldap::params::searchbase'') %>"...
2012 Jan 23
13
Template Help Please
...e with data being passed in as a long
string of data which is being returned via extlookup()
i.e. $resolvers = "10.10.10.10 11.11.11.11.12.12.12.12"
The template should split those up and put a nameserver entry per line
in /etc/resolv.conf
I have this in the template now:-
<%= scope.lookupvar(''resolver::params::resolvers'').split(/\s+/).each
do | ns | %>
nameserver <%= ns %>
<% end -%>
Which is throwing a syntax error. Can''t for the life of me work out
whats wrong. Probably not had enough coffee yet.
Any ideas ?
Thanks
Paul
--
You received t...
2013 Mar 08
2
multiple pamameter values in puppet dashboard ENC
Is there a way to use send multiple parameter values using puppet dashboard
ENC?
For example,
nameserver = 10.0.0.1, 10.0.0.2
or perhaps
nameserver = [''10.0.0.1'',''10.0.0.2''}
then the template erb file can loop through each of the nameserver values
to set up mulitple nameservers in resolve.conf?
Thanks - Oli
--
You received this message because you are
2012 Aug 13
2
Variables and scope with inherits
...late("foo/foobar.erb"),
}
}
params:
class foo::params {
$bar = true
if $foo::bar {
$foobar = ''yes''
$foofoo = ''foo''
}
else {
$foobar = ''no''
$foofoo = ''bar''
}
}
foobar.erb:
<% if scope.lookupvar(''foo::boo'') -%>
<%= scope.lookupvar(''foo::foofoo'') %>
<% end -%>
<%= scope.lookupvar(''foo::params::foobar'') %>
<%= scope.lookupvar("foo::foofoo") %>
When I run puppet on the class I get:
puppet apply --module...
2009 May 31
9
No more than one "instances" of a type in define()?
Hi folks,
when I try to do something like:
define railsproject($name, $uid, $gid, $userpass, $sqlpass) {
mysql_database { "$name_staging": ensure => present }
mysql_database { "$name_production": ensure => present}
....more stuff...
}
I get:
Puppet::Parser::AST::Resource failed with error ArgumentError:
Duplicate definition: Mysql_database[] is already
2013 Jul 12
1
ERB template pain
...=> 7,
name => ''GG''
},
prod => {
id => 1,
name => ''Info''
}
}
In some other class, which I apply to a node I have defined file from a
templete, where I want to use those values depending on the zone property.
<%
$zone = scope.lookupvar(''y::_zone'')
$c_data = scope.lookupvar(''x::control[${zone}]'')
-%>
The zone property is OK and equals to dev.
I can''t access the $c_data as in looks like nil (undefined).
And I need to output something as:
ID=<%= $c_data[''id''] %&g...
2011 Oct 24
3
extlookup not working correctly in 2.7.6
I''m trying to upgrade from 2.6.7 to to 2.7.6 and I''m running into an
issue in my extlookup() calls. A lot of the variables which should be
defined aren''t defined within extlookup.rb. I''ve tested 2.6.7 agent
and 2.7.5 agent against the 2.6.7 master and 2.7.6 master. I adjusted
extlookup.rb slightly to provide some debug output.
2013 Jul 30
2
Failed to parse template, wrong number of arguments (create_resources)
...ppnode*
If I commend out the "create_resources" and the "define" blocks, the
template works just fine. I''m guessing maybe there is a scope issue here
or something, but I haven''t been able to track it down. I''ve tried this:
*ServerName <%= scope.lookupvar(test::appcfg[''serverName'']) %>*
*
*
but still no workie.
Any pointers or advice would be appreciated.
*
*
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails f...
2009 Nov 25
1
Puppet custom functions and user permissions
...has been added to in /etc/
group, when puppetmasterd runs the custom function the effective/real
user always only has the puppet group.
An example:
module Puppet::Parser::Functions
newfunction(:ossec_client_key, :type => :rvalue) do |args|
# Check if key for the fqdn already exists
fqdn = lookupvar(''fqdn'')
ip = lookupvar(''ipaddress'')
fout = File.open("/home/puppet/ossec_client_key.log", ''w'')
fout.puts "ossec_client_key executed with: " + fqdn + ":" + ip
userid = `id`
fout.puts "Shell commands run a...
2013 Nov 18
3
Is it possible to evaluate a string as a parameter name?
Hi,
I''m looking to combine a couple of fact names with the value of a class
parameter to create and lookup the resulting fact''s value. Is that
possible? For example, my class will take the parameter "my_default_nic"
from beyond. So I know that as long as $my_default_nic exists on the
client, then so will facts like macaddress_<NIC>, netmask_<NIC>,
2013 Feb 20
1
Access puppet hash name in templates
...ess is the title of the hash in my templates, so I
want to print out the title of the hash i.e. "eth5", how can I do that?
Also I have a variable called $int in my define class in the file for my
module (/etc/puppet/modules/net/manifests/addr.pp), how can I access that
using the scope.lookupvar function from this template in the same module?
Thanks Dan
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To...
2007 May 01
8
Custom functions and facts
Hello!
I''ve been trying to use facts from Facter in a custom function. I''ve
been following Matthew''s entry in the wiki
(http://www.reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions).
What i''m seeing is that Facter[''fqdn''].value is always returning the
fqdn of the puppetmaster host. I was expecting the fqdn of the client
host.
2011 Nov 16
11
What is the offical variable scope best practice?
...p, not include node definitions and facts.
2. in puppet class, using variables not local, must specify the namespace,
like $class::variable,
if it''s a top scope variable or a fact variable or a variable in node
definition, using $::variable.
3. in template erb files, always using scope.lookupvar("class::variable")
to get the value, even if the erb and the variable used in the same module
or it is a fact variable
are these points correct?
btw, only some of my old code give dynamic lookup warnings under puppet
2.7, does this mean the others not need to modify?
--
System Admini...
2012 Nov 01
0
Lookup and scoping of hiera data from erb templates
...bar: "boo"
baz: 42
So now, if I have an erb template in the my_module::backend class, the
only way to get directly to the values is via a helper variable like
class my_module::backend {
$config = hiera("backend")
}
and then access it in the template via
<%= scope.lookupvar("my_module::backend::config")["foo"]["bar"] %>
Which works, but kind of doesn''t feel right.
(Neither does leaving away the scope.lookupvar()).
What would be the idiomatic approach to this?
Is there a way to access Hiera values directly via the ERB templat...
2011 Jun 30
4
using memorysize fact in manifests
Hi,
I want some config depending on memorysize.
What I tried was
if ($memorysize >= 256 * 1024*1024) {
...
}
But this fails because $memorysize is a string (and contains a "G") and can''t be
compared to an int.
Are all facts strings? How do I work with numbers?
regards, Andreas
--
Andreas Kuntzagk
SystemAdministrator
MDC Berlin / BIMSB
Tel.: +49 30 9406 2997
--
2011 May 23
2
Variable interpolation challenge
I''m having a problem with variable interpolation that I haven''t found a good
solution to. I want to use a variable as part of the name of a fact, but
the interpolation doesn''t work as expected. I''ve allowed for passing the
mac address into my define() but if it''s not provided I want to look it up
via facter.
if
2011 Aug 22
12
exported resources and templating
...irst time,
then override the define with the content, but that only picks up the
2nd server. I''ve tried accessing the variable that gets populated
after the Memcache::Servers <<| |>> but it doesn''t get populated in
this scope. I''ve tried looking up the
scope.lookupvar(''memcached::servers::memcacheservers'') but the
exported resource is a define not a class and I couldn''t get it to
work. I''ve tried just using a script to populate the file with the
proper contents, but there is no way to ensure it is filled with all
the servers,...
2012 Apr 11
8
Facter not initialized in rspec in puppetlabs-stdlib?
...t things based on ''interfaces'' and related facts.
The functions themselves seem to work fine in my manifest-based smoketests,
but I am running into trouble that may or may not be due to my ignorance
about rspec or Facter. Something needs to be done to initialize Facter
because lookupvar(''interfaces'') just returns :undefined. I have not found
any examples in the existing rspec tests; getvar_spec.rb seems like it
should have something but the tests it does are pretty basic.
You can see some of what I''ve been trying at
https://github.com/wcooley/puppetl...
2010 Jun 24
7
Yet more variable scoping pain.
Some days I wonder why I even bother with puppet.
---
classes:
- datacentre::new_york
- role::appserver
- elements::tfel0
environment: production:
parameters:
< set key/value pairs here >
class ldap {
< do some stuff that behaves slightly differently between different
data centers >
}
class role::appserver {
include ldap
}
So, I wanted to set some variables in the