You can create arrays of identical resources:

file { [ '/etc/motd',
         '/etc/issue',
         '/etc/issue.net',
       ]:
  ensure   => file,
  owner    => 0,
  group    => 0,
  content  => template('manage_banners/some_banner_text.erb'),
}

Under the hood, when the catalog is compiled, it still gets split out into 3 separate resources that are managed independently, but in your manifests you can define them as a single block.

The other option, if these 3 files are always to be the same, is to pick one to put the actual content into and then use symlinks or hardlinks for the other two files.


On 2016-09-16 02:54 PM, Warron French wrote:
Its probably easiest to explain what I want to accomplish.

I want to create the following 3 files: */etc/motd, /etc/issue, /etc/issue.net* from a single (1) puppet file resource using the content => template('template.erb') syntax.

I don't want to create 3 separate file resources and use the exact same syntax three (3) times.

I have a class (I am a novice puppet code) and here is what I have in it so far...

class manage_banners::text {
       { file '/etc/motd':
               ensure  => 'file',
               owner   => '0',
               group   => '0',
               content => template('some_banner_text.erb'),
       }
}

class manage_banners::gdm {
     <snippet ... nothing in here yet>
}

class manage_banners::kde {
     <snippet ... nothing in here yet>
}

In the manage_banners::text class I don't want to place 3 file resources (one for each of the /etc/ files).

I am thinking that there is a solution for this, but I don't know how to keyword search for something like this.

Please help, and thank you,
Warron
--
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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c78a1ca7-7839-433f-8483-8976ecad9532%40googlegroups.com <https://groups.google.com/d/msgid/puppet-users/c78a1ca7-7839-433f-8483-8976ecad9532%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/af6dfdab-311d-7968-1aac-c958386e4829%40alter3d.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to