That's only true if you use symlinks. Hard links wouldn't have that issue, though Puppet currently can't handle those with the file{} resource.

However, the above point is almost irrelevant, because if you have people going around and randomly deleting files in /etc, I would argue that you have a WAY bigger problem than being worried about whether or not a MOTD is displayed, and one that can't be solved with configuration management software.

- Peter


On 9/18/2016 4:42 AM, Warron French wrote:

Hi, thanks Peter.

I am writing this module to write it based on the design I have had because... being a little lazy I guess you might say/think. I know that I could do a link, but I believe for something like this an actual file might be required, because if the main file is deleted, then the banner is lost entirely because the links will be broken.


Thanks.


On 9/16/2016 3:25 PM, Peter Kristolaitis wrote:

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 puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. 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 puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/af6dfdab-311d-7968-1aac-c958386e4829%40alter3d.ca <https://groups.google.com/d/msgid/puppet-users/af6dfdab-311d-7968-1aac-c958386e4829%40alter3d.ca?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 puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a587b59f-03b1-2c5a-d456-c655a9d0cde6%40gmail.com <https://groups.google.com/d/msgid/puppet-users/a587b59f-03b1-2c5a-d456-c655a9d0cde6%40gmail.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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c5a84f86-60fd-1984-fa5d-e9e761d2a341%40alter3d.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to