Displaying 20 results from an estimated 400 matches similar to: "inline_template private method `gets' called for false:FalseClass"
2010 Oct 14
8
manipulating facter variable
I''m trying to manipulate the following facter variable:
ipaddress => 10.85.207.2
What I need is the second group of digits. If it''s 84 then location is
A, but if it''s 85 then location is B.
In puppet I couldn''t grab this second set of digits, but maybe there
is a way?
I''ve already tried to make a custom fact, but my ruby knowledge is
*ahem* pretty
2012 Jul 25
3
manifest variable with sed - problem
Hello,
i have a problem in my sudo manifest file, because in the variable $name
comes sometimes usernames like user.lastname, but i need for sudo
(includedir */etc/sudoers.d/*) file names with no dots (like user_lastname).
I need a new variable, where is the dots change by underscores.
My first try was like this, but it isn''t working well.
$name_underscore = "`echo $name | sed
2012 Aug 27
5
Append string to list items.
I have an array:
$nodes = [''gfs01'' ,''gfs02'', ''gfs03'', ''gfs04]
and a string variable:
$brick_store = "/var/bricks"
How can I append "/var/bricks" to each item in the array? Lack of a
looping construct makes this challenging in puppet.
Such that:
brick_array = [''gfs01:/var/bricks'',
2012 Mar 27
1
Arrays from templates
Hi,
I am having an issue trying to use the inline_template function to
return an array. This is what I do:
$array = inline_template ("<%= a=[''a1'',''b2'',''c3'']; a %>")
notify {"array: ${array}":}
And that works, showing the typical comma-less string:
notice: /Stage[main]//Notify[array: a1b2c3]/message: defined
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
Hi,
I want to use a file resource to write a facts.yaml file for
Mcollective. For some reason it won''t provide a valid yaml format if I
dump my scope to hash and convert to_yaml.
file {
"/etc/mcollective/facts.yaml" :
owner => root,
group => root,
mode => 400,
loglevel => debug,
#content => inline_template("<%= scope.to_hash.reject {
2011 Jun 16
7
Problem with usage of arrays
Hi there,
i can''t use array in puppet. Here is my codesnipplet:
$callapidata = [ ''wert1'',''wert2'']
notice $callapidata[1]
A puppetrun results in:
Could not retrieve catalog from remote server: Error 400 on SERVER:
can''t convert String into Integer at /etc/puppet/myenv/modules/
uc4client/manifests/init.pp:41 on node testnode
Thanks for your
2009 Oct 29
2
template issue: nested variables?
I need to do something like this
node foo {
$iface = pcn0
...
}
# the template
<%= network_<%= iface %> %>/<% netmask_<%= iface %> %>
The idea being that a file would be built on the client holding the
value of pcn0''s network/netmask
Of course, I''m trying to avoid hard coding the interface name in order
to keep my code portable.
Thanks in advance
2009 Jun 30
6
Variable named "memory" in templates
I tried to use a Puppet variable named "$memory" and access it from
a template, like this:
$memory = 4711
file {
"/tmp/test.txt":
content => inline_template("memory = <%= memory %>\n");
}
One would think that my file would contain "memory = 4711" after that,
but instead the memory variable seems to hold a
2013 Jun 10
5
Does stdlib break the regsubst function?
Hi all,
We are currently using the regsubst function of Puppet to generate some
information out of our hostnames (customer, environment, and so.). The
manifest is running fine since months.
7: $customer = regsubst($::fqdn, ''(^[^-]*)-[^-]*.*'', "\\1")
8: $environment = regsubst($::fqdn, ''^[^-]*-([^-]*).*'', "\\1")
9: $product =
2011 Mar 31
5
Exclude a resource from reports
A little while back I asked how to make puppet not report on a
resource.. and was shown the loglevel metaparam:
Quoting bellman@nsc.liu.se:
There is a metaparameter called ''loglevel''. If you set that
to something lower than "notice" (i.e. either "info" or "debug"),
then Puppet won''t report that it applied the resource...
So I made my
2010 Apr 23
1
regsubst questions
I am attempting to set some variables in my manifest and I amd seeing
a result I don''t quite understand. Here is a section of code from my
manifest:
$boot_time = generate(''/usr/bin/env'', ''/bin/date'', ''+%H:%m'')
notice("boot_time => $boot_time")
$boot_hour =
2012 Aug 28
1
Array References?
The first notice command shows the array as having two elements. The
second notice command shows the same array as having only one element.
Some sort of variable reference thing? How can I make a copy of the
$nodes array rather than make a reference to it?
notice ("NODES1=$nodes")
$n2 = $nodes
$useless = inline_template("<%= n2.shift -%>")
notice
2012 Dec 03
4
Unnecessary changes when creating facts.yaml
I have set up puppet to create a facts.yaml file for mcollective using the
following line:
content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~
/(uptime.*|timestamp|.*free|macaddress.*|ipaddress)/ }.to_yaml %>"),
However, it is creating a lot of unnecessary changes by reordering the
facts in the yaml output as you can see in the diff output between to
2012 Dec 14
11
Puppet and Mcollective yaml file changing when it shouldn't
Has anyone else ran into this?
debug: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content:
Executing ''diff -u /var/tmp/facts.yaml
/tmp/puppet-file20121214-13448-933j3r-0''
notice: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content:
--- /var/tmp/facts.yaml 2012-12-14 00:53:20.000000000 +0000
+++ /tmp/puppet-file20121214-13448-933j3r-0 2012-12-14
2012 Feb 16
2
Basic string manipulation in puppet
Hi all,
Been searching the net for a few hours now.
I have a basic operation I wish to perform but, cannot find examples
close enough to what I''m after to implement it myself.
This is what I want to do:
$version = ''10.2.0''
I want to manipulate the string to make a new var ($cutversion), equal
just 102.
For example in perl (since I know it):
$version =
2012 Oct 02
4
Removing intermediate variables in calculation
Hello,
I have a small Puppet 2.7 module to configure Sonatype Nexus Professional.
The module takes, among other things, a baseurl in the form of
"http://example.com/path" and I''d like it to extract the "/path" from that
variable into a separate variable IF an optional "path" variable haven''t
been supplied.
Here is an extract:
class
2011 Aug 08
12
Hash Interpolation inside double quotes?
I''ve got this:
file {
''/opt/sugarsync/tomcat/tomcat-home/current'':
ensure => "tomcat-$config[''tomcat_version_server'']";
where $config[''tomcat_version_server''] was set with extlookup (the yaml
one), by loading:
---
tomcat_config:
tomcat_version_server: 6.0.20-1
tomcat_version_libs: 1.0-1
2012 Feb 29
3
Modifying a FACT Value In a Manifest
In my network every subnets default gateway is X.X.X.1. That router
gateway is always running ntpd which I want to give be default as the ntp
server in every hosts ntp.conf.
Since there is no official "default gateway" fact yet, what I want to be
able to do in my manifest is take the $ipaddress fact and turn it into the
gateway for that subnet.
For example...
IP = 10.1.1.12
GW =
2009 Jul 30
7
arrays, loops, etc
Inspired by the recent thread titled "Array input of dirs, ensuring
their existence" I thought I''d write up the problem I''m running into. I
was chatting on irc about it, I don''t think puppet has a clean solution.
Like the other poster, I''m defining an object that takes an array. In
my case, I''m defining gpg keystore, which can contain a
2013 Apr 04
6
replacing mkdir -p
Puppet right now requires every element of a path to have an individual
file definition. This makes it had to take an arbitrary path as a
parameter. You are forced to require your client to make the entire path
structure for you or instead you use an exec resource and call mkdir -p.
Using an exec resource does not generate an File resources so autorequire
does not work.
I didn''t