Ask Your Question

How do I create puppet modules that only apply to Linux, inside a .pp file

asked 2016-11-30 12:14:29 -0600

jrbast gravatar image

updated 2016-11-30 18:16:24 -0600

lupin gravatar image

I know I can create rules and assign classes in the puppet master, but I still would like to limit to just Linux hosts as the manifest's .pp code is only for Linux, not any other OS.

Would this be valid?

class profile::baseline::stinstpost {
  if ( $::osfamily == 'RedHat' ) {
    file { '/storix/custom/':
      ensure    => directory,
    file { '/storix/custom/stinstpost' :
      ensure    => file,
      source    => 'puppet:///modules/profile/stinstpost',
      owner     => 'root',
      group     => 'root',
      mode      => '0755',
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-11-30 18:20:32 -0600

lupin gravatar image

updated 2016-11-30 18:21:25 -0600

Your code will only create the /storix/custom directory if the OS family is RedHat, however it will not prevent the next resource stinstpost to be be created. If you meant by Linux as the kernel independent of the Distro then you can use the kernel fact instead.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-11-30 12:14:29 -0600

Seen: 34 times

Last updated: Nov 30 '16