Displaying 20 results from an estimated 20000 matches similar to: "Iterating over array to create users and files"
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
2012 Sep 10
3
How to remove last comma when iterating through hash in erb template
I need to produce a line in a config file in the format x = "ip1,ip2,ip3"
I am using the method below to sort the hash before iterating over it.
However, as you can see there will always be a final comma which breaks the
app that uses this config file. Does anyone know how I could remove the
final comma?
ipv4_bind_addresses = "<% routes.sort_by {|key, v| key}.each do |key,
2012 Feb 10
7
Hiera data unusable in a class with an array parameter
Given the following hiera hash:
common.yaml:
---
*allowed_ips:*
* "First IP": 1.2.3.4*
* "Second IP": 5.6.7.8*
and the module:
*class iptables ($role) {*
* file {/tmp/test:*
* content => template(iptables/test.erb)*
* }*
*}*
with the corresponding template test.erb:
*<% role.each do |role| -%>
*
* code*
*<% end %>*
*<%
2007 May 04
3
fileserver hanging
hello,
we just wanted to rollout our new puppetized dmz. therefore i change all
ip adresses from the test network to the live ips. after restarting
puppetmasterd it seems that the fileserver hangs:
client log:
debug: //true_base/update-check/File[/sbin/update_check.pl]/require:
requires Package[libmail-sendmail-perl]
debug: //true_base/puppetd/File[/etc/puppet/puppetd.conf]/require:
requires
2006 Nov 01
1
Class methods do not work with Puppet 0.20
Hello puppet-users,
I am having trouble getting my manifests to apply with Puppet 0.20.
Here''s what I''ve got:
I have a generic box class to setup my home environment on a given
machine. The class is mostly made up of file types, but I also have a
few methods that include file and package types amongs others. eg:
class box {
$owner = "owner"
$group =
2011 Nov 18
2
Are tildes actually valid in templates or is this a bug?
Hi all,
First off, we''re running Puppet 2.7.6 with Ruby 1.8.7 on CentOS 6.0.
Now, I''m using tildes in a template to prevent newlines from appearing but
ruby/puppet is choking on them.
*/tmp/puppet$ cat test.erb*
Line 1: Line 2 will exist if running on CentOS.
<% if operatingsystem == "CentOS" ~%>
Line 2: Yay, we''re running CentOS.
<% end ~%>
2006 Aug 28
10
Templates and arrays
I''m in the process of documenting templates right now, and I figured
I should see what happens when you use them with arrays:
$ cat ~/bin/test.pp
$values = [this, is, an, array, of, values]
$content = template("/tmp/templates/testing.erb")
file { "/tmp/temtest": content => $content }
$ cat /tmp/templates/testing.erb
<% values.each do |val| %>
I got
2011 Oct 18
2
Puppet node fails to pass facts to master
Hello Puppet list,
I am taking over the puppet configuration of a sysadmin who left, and
am having troubles deploying puppet to a new node. We are using puppet
v2.7.3 both on the client and the puppetmaster, on Ubuntu 10.10.
The node asks for a certificate fine, and I signed it on the
puppetmaster.
For the following logs extract I ve replaced the FQDN of my node by
puppet.example.com.
When doing
2010 Jul 06
2
%% in templates
Hiya,
I''ve recently updated my svn server so that it checks the syntax of
.erb files, on commit, along with .pp files. While doing this, I ran
across a small but niggling issue and wanted to see if I was just
doing something wrong or if it was a bug.
In my sudoers template file, I have a number of lines that start along
the lines of:
%sup ALL=NOPASSWD: ALL
%mon ALL=NOPASSWD: ALL
2006 Sep 20
2
Defining function in template files?
Hi,
Is it possible to define a function in a template file?
For example, I thought it might be a good idea to define my Debian
systems'' /etc/apt/sources.list files based on what level of stability
and freeness a system should have. So I have this puppet code:
#---------- apt.pp ----------------
define apt-sources-list
2013 Aug 08
1
Failed to parse template - undefined method `to_xs'
Hi
I''m getting the following error:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Failed to parse template bireportweb/reportdbconfig.xml.erb:
Filepath:
/data/ss/svn/puppet/modules/bireportweb/templates/reportdbconfig.xml.erb
Line: 16
Detail: undefined method `to_xs'' for #<String:0x7f7116858570>
This is the line within the
2013 Mar 12
2
Puppet with Passenger - 403 Forbidden
Morning all
Am in the process of testing a migration of Puppet 3 from webrick to
Puppet.
Have found the foreman modules (https://github.com/theforeman) which seems
to take care of a lot of the leg-work...
However having got Puppet running with Passenger in Apache, whenever trying
to access the Puppet master from a client, I was getting a ''403 Forbidden
error''.
Have dug
2011 Oct 06
1
More cloud provisioner stuff
I''m still having some issues with cloud provisioner. I have a fresh
install of provisioner, .60rc1, puppet 2.7.3, and dashboard 1.2.0.
Everything has a very default install as described in the
documentation. I was unable to get bootstrap to work, so I did things
in a linear fashion (create, install, classify). Classify is failing
and theres not really any good debug info, I just get
2010 Jun 28
4
Error 400 : could not find template
Hello,
I did make a stupid fault: not commiting changes to version control :-(
After the installation of puppet-dashboard, I added a recipe to add
report = true to puppet config files on clients.
Now all Puppet clients don''t update because of an error...
What can be the various reasons for an ''400'' error??
I guess it has something to do with rights.
Jun 28 09:52:36 pm
2011 Dec 20
8
Network config module won't work. -Mac address errors
Hello,
I created a module for modifying the base network settings on a
machine. However no matter what changes I make it keeps giving me the
error "has different MAC address than expected, ignoring" when the
network tries to startup.
I am testing this out on the puppet learning VM.
Does anyone see anything wrong with my code:
init.pp
--------------------------
define basehost
2008 May 12
8
Complex data structures in templates
Hi.
I wonder if it is possible to use more complex data structures in
templates than simple variables and arrays? I have been trying nested
arrays, as well as nested arrays and hashes, but nothing seems to work
(more specifically, nested arrays seem to be flattened into a single
array). Having only simple variables and arrays is a little limiting.
Something like the Perl-based Template Toolkit
2007 Aug 21
4
communication between classes / hosts
Hi there, me again!
I´m looking for a solution for the following:
I have two (a bunch really..) of services that work together and have to
exchange some configinformation between each other. I can get this to
work in only one of three cases:
1. Works
#
class serviceB {
file {"serviceBconfig":
content => $serviceA::serviceAvar
}
}
#
#
class serviceA {
$serviceAvar
2011 Feb 18
1
why 'Template missing' error with form_tag?
ROR newbie here...
I''m trying to build a form to upload a CSV file, then parse and store the
data. I have debugged this code up this point, but now when I browse to my
csv file, and click Upload, I get this error:
"Missing template uploads/process_file.html.erb in view path..."
Here is my view (in /uploads/new.html.erb)
<% form_tag ({:action =>
2012 Apr 24
3
How to increment variable in erb template ?
Hi'',
I''m looking for a way to increment variable in template (erb file).
I tried this, but it didn''t work
Compteur <%= compteur %>
> <% compteur = compteur + 1 %>
> Compteur <%= compteur %>
>
I''ve got this error :
> Error 400 on SERVER: Failed to parse template test/test.erb: undefined
> method `+'' for
2013 Oct 24
2
SSH Module with multiple conditions
I''ve written and deployed a simple Linux SSH module. But I need to modify
to include support for FreeBSD and AIX. On top of that, I need to include
some conditionals in there that (for example)
if (/etc/file1 contains string abc) ; then
install sshd-config-x & ssh-config-x
elsif (/etc/file1 contains string xyz); then
install sshd_config-y & ssh_config-y
else install