Ask Your Question
0

view my inheritance relationships?

asked 2017-06-08 12:33:16 -0600

erichymowitz gravatar image

Greetings.

I'm not sure if I'm using the word inheritance the way Puppet uses the word. It's the only word I can think of.

I have a site manifest with lots of profiles. For example:

class profiles::generic
(
  $patchhour = 13,
  $patchminute = 0,
  $hostfile,
)
{
  class { 'etchostfile' :
    hostfile => $hostfile,
  }
  class { 'systempatch' :
    hour => $patchhour,
    minute => $patchminute,
  }
}
class profiles::testsystem
(
  $patchhour = 14,
  $patchminute = 30,
  $hostfile = "primary",
)
{
  class { 'profiles::sdogeneric' :
    hostfile => $hostfile,
    patchhour => $patchhour,
    patchminute => $patchminute,
  }
  include testpackage
}
class profiles::prodsystem
(
  $patchhour = 13,
  $patchminute = 0,
  $hostfile = "primary",
)
{
  class { 'profiles::sdogeneric' :
    hostfile => $hostfile,
    patchhour => $patchhour,
    patchminute => $patchminute,
  }
  include prodpackage
}
node 'cutlass'
{
  class { 'profiles::prodsystem' :
    patchminute => 10,
  }
}
node 'volvo'
{
  class { 'profiles::testsystem' :
    patchminute => 25,
    hostfile => "alternate",
  }
}

The intent, if it's not obvious, is that we have

  • a "generic" profile with a set of default values (patch at 1pm, no specific host file)
  • a "testsystem" profile that inherits all of the the "generic" profile defaults, but patches at 2:30pm by default and uses the "primary" host file by default
  • a "prodsystem" profile that inherits all of the "generic" profile defaults, but uses the "primary" host file by default
  • a production machine that patches at 1:10pm (keep the default hour but change the minute)
  • a test machine that patches at 2:25pm and specifies the "alternate" host file

So Question 1 is ... is there a better way to do this? Should I be using (say) global variables instead of parameters passed from profile to profile? I'd prefer to stay away from hiera and keep all of my info in the manifest.

And Question 2 is ... does anybody have or recommend a script or a viewer or a recommended way that I can parse my config and specifically view

  • cutlass specified the patchminutes as 10, which overrides the profiles::prodsystem default patchminute which is 0, which overrides the profiles::generic default patchminute which is (also) 0"
  • cutlass will use the profiles::prodsystem default hour which is 13, which overrides the profiles::generic default patchhour which is (also) 13"

? I know that puppet compile find cutlass will give me the final catalog info, but not (as far as I can tell) the path it used to get those values.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-08 16:37:27 -0600

ramindk gravatar image

So Question 1 is ... is there a better way to do this? Should I be using (say) global variables instead of parameters passed from profile to profile? I'd prefer to stay away from hiera and keep all of my info in the manifest.

The better way is to use Hiera. It's designed to solve this problem. It also includes lookup tools so you can verify that node 'my_node' is getting the correct values solving Question 2 as well.

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

Stats

Asked: 2017-06-08 12:33:16 -0600

Seen: 120 times

Last updated: Jun 08