Patrick
2012-Oct-10 07:53 UTC
[Puppet Users] Create files from array -> Duplicate declaration
hello,
i want to create some files with an array:
class files (
...
$type = [ "file1", "file2", "file3",
"file4", "file5", "file5" ]
) {
define rsyslog($owner = root, $group = root, $mode = 644,
$ensure = present) {
file {"/etc/rsyslog.d/$type.conf":
ensure => $ensure,
owner => $owner,
group => $group,
mode => $mode,
content => template(''template.erb''),
}
}
rsyslog { $type: }
}
Puppet says Duplicate declaration:
File[/etc/rsyslog.d/oevd-intern-accesserrors.conf *(and how to fix this?*)]
is already declared in file
It works with only one element in my array...
anyone can help me?
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/jiEFtSDdGL8J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
kish
2012-Oct-10 08:21 UTC
Re: [Puppet Users] Create files from array -> Duplicate declaration
On Wed, Oct 10, 2012 at 1:23 PM, Patrick <patrick.rohrberg@googlemail.com> wrote:> hello, > > i want to create some files with an array: > > class files ( > ... > $type = [ "file1", "file2", "file3", "file4", "file5", "file5" ] > ) { > > > define rsyslog($owner = root, $group = root, $mode = 644, > $ensure = present) { > > file {"/etc/rsyslog.d/$type.conf":You could use $name here instead of $type,> ensure => $ensure, > owner => $owner, > group => $group, > mode => $mode, > content => template(''template.erb''), > } > } > rsyslog { $type: }-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2012-Oct-10 08:31 UTC
Re: [Puppet Users] Create files from array -> Duplicate declaration
Now puppet says "Cannot reassign variable name..." -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/b4ufhZOEEU8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2012-Oct-10 09:22 UTC
Re: [Puppet Users] Create files from array -> Duplicate declaration
Fixed now :)
Just replaced $type (is used by puppet) with $logtype and used $name for
the files.
But my last problem ist the template.
I''m using <%=
scope.lookupvar(''oevd_opendj::logtype'') %> and puppet
writes
file1file2file3file4
How can i resolve that?
Am Mittwoch, 10. Oktober 2012 10:31:59 UTC+2 schrieb
Patrick:>
> Now puppet says "Cannot reassign variable name..."
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/Acqm6XAn_RcJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
kish
2012-Oct-10 10:25 UTC
Re: [Puppet Users] Create files from array -> Duplicate declaration
On Wed, Oct 10, 2012 at 2:52 PM, Patrick <patrick.rohrberg@googlemail.com> wrote:> Fixed now :) > Just replaced $type (is used by puppet) with $logtype and used $name for the > files. > > But my last problem ist the template. > I''m using <%= scope.lookupvar(''oevd_opendj::logtype'') %> and puppet writes > file1file2file3file4 > How can i resolve that?You should iterate on logtype. eg. <% env_settings.each do |env_setting| -%> <%= env_setting %> <% end -%> That should help. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2012-Oct-10 11:14 UTC
Re: [Puppet Users] Create files from array -> Duplicate declaration
Am Mittwoch, 10. Oktober 2012 12:25:39 UTC+2 schrieb kish:> > On Wed, Oct 10, 2012 at 2:52 PM, Patrick > <patrick....@googlemail.com <javascript:>> wrote: > > Fixed now :) > > Just replaced $type (is used by puppet) with $logtype and used $name for > the > > files. > > > > But my last problem ist the template. > > I''m using <%= scope.lookupvar(''oevd_opendj::logtype'') %> and puppet > writes > > file1file2file3file4 > > How can i resolve that? > > You should iterate on logtype. > eg. > <% env_settings.each do |env_setting| -%> > <%= env_setting %> > <% end -%> > > That should help. >Thanks. But i think there is a problem now: $InputFilename /opt/app/logs/<%= logtype %> I have to replace <%= logtype %> with the current logtype eg. if puppet create the errors.conf file so $InputFilename should be /opt/appt/errors. scope.lookupvar(''oevd_opendj::name'') %> does not work. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/S-GtRjoDxk4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2012-Oct-10 14:07 UTC
Re: [Puppet Users] Create files from array -> Duplicate declaration
ok fixed now ;) Am Mittwoch, 10. Oktober 2012 13:14:34 UTC+2 schrieb Patrick:> > Am Mittwoch, 10. Oktober 2012 12:25:39 UTC+2 schrieb kish: >> >> On Wed, Oct 10, 2012 at 2:52 PM, Patrick >> <patrick....@googlemail.com> wrote: >> > Fixed now :) >> > Just replaced $type (is used by puppet) with $logtype and used $name >> for the >> > files. >> > >> > But my last problem ist the template. >> > I''m using <%= scope.lookupvar(''oevd_opendj::logtype'') %> and puppet >> writes >> > file1file2file3file4 >> > How can i resolve that? >> >> You should iterate on logtype. >> eg. >> <% env_settings.each do |env_setting| -%> >> <%= env_setting %> >> <% end -%> >> >> That should help. >> > > Thanks. > But i think there is a problem now: > $InputFilename /opt/app/logs/<%= logtype %> > > I have to replace <%= logtype %> with the current logtype > eg. > if puppet create the errors.conf file so $InputFilename should be > /opt/appt/errors. > scope.lookupvar(''oevd_opendj::name'') %> does not work. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/xDnm0tHZaxAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.