FAQ
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.

Search Discussions

  • Kish at Oct 10, 2012 at 8:21 am

    On Wed, Oct 10, 2012 at 1:23 PM, Patrick 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 at Oct 10, 2012 at 8:38 am
    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 at Oct 10, 2012 at 9:22 am
    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 at Oct 10, 2012 at 10:31 am

    On Wed, Oct 10, 2012 at 2:52 PM, Patrick 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 at Oct 10, 2012 at 11:21 am

    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 at Oct 10, 2012 at 2:07 pm
    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
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 10, '12 at 7:56a
activeOct 10, '12 at 2:07p
posts7
users2
websitepuppetlabs.com

2 users in discussion

Patrick: 5 posts Kish: 2 posts

People

Translate

site design / logo © 2022 Grokbase