https://www.puppet.com/community logo
Join Slack
Powered by
# puppet
  • o

    op-ct

    02/07/2023, 4:37 PM
    That is a best practice, not the best practice.
  • b

    Brian Schonecker

    02/07/2023, 4:37 PM
    puppet-chrony defines defaults in init.pp and doesn't have a common.yaml file. So now I'm even more confused.
  • d

    Dr Bunsen Honeydew

    02/07/2023, 4:37 PM
    See the
    puppet-chrony
    module at https://forge.puppet.com/puppet/chrony?src=slack&channel=puppet
  • w

    wil.rodriguez

    02/07/2023, 4:37 PM
    That's fair enough. I have found that it's helpful to set default values AND hiera, just to avoid having to go back and forth when trying to figure out what default values are supposed to be.
  • b

    Brian Schonecker

    02/07/2023, 4:37 PM
    If the variable is set to a default in init.pp AND is defined in common.yaml, then what I'm seeing is that the value comes from common.yaml.
  • w

    wil.rodriguez

    02/07/2023, 4:38 PM
    But that can also be confusing and lead to this particular conversation lol
  • b

    Brian Schonecker

    02/07/2023, 4:38 PM
    Indeed.
  • s

    Slackbot

    02/07/2023, 4:40 PM
    This message was deleted.
    w
    • 2
    • 1
  • b

    Brian Schonecker

    02/07/2023, 4:41 PM
    Perhaps this is an example of "Doctor it hurts when I put values in init.pp and common.yaml."
  • b

    Brian Schonecker

    02/07/2023, 4:41 PM
    It makes a lot more sense to me for the default values to be in init.pp as I don't have to go hunting for them.
  • b

    Brian Schonecker

    02/07/2023, 4:42 PM
    However, it also makes sense to me to put lengthy hashes in common.yaml to reduce the clutter in init.pp.
    💯 1
  • w

    wil.rodriguez

    02/07/2023, 4:42 PM
    As someone who works with the simp modules regularly, yes. Assume all of them have a good amount of technical debt. They're very well written and maintained modules, but they were written at a diferent time in puppet's development. The OnyxPoint team has done a remarkable job of modernizing them over time, but SIMP is big, and it takes time to move things forward.
  • s

    Slackbot

    02/07/2023, 4:42 PM
    This message was deleted.
    💯 3
    w
    o
    c
    • 4
    • 3
  • o

    op-ct

    02/07/2023, 4:42 PM
    +1 about tech debt and big :P
  • o

    op-ct

    02/07/2023, 4:43 PM
    @wil.rodriguez For simple default values that don't change under conditions, it is we've found it often more practical to keep parameter defaults along with the code definition. Puppet Strings will include the default, and the code is easier to to reason about and review (most code reviewers do not configure/execute
    puppet lookup
    locally)
  • b

    Brian Schonecker

    02/07/2023, 4:43 PM
    I've got a custom module I'm writing and it needs four filesystems mounted which requires a dirtree, directory, LVM, etc. That would quickly overwhelm the init.pp file but it's easier to read in common.yaml.
    💯 2
  • o

    op-ct

    02/07/2023, 4:43 PM
    @wil.rodriguez For simple default values that don't change under conditions, it is we've found it often more practical to keep parameter defaults along with the code definition. Puppet Strings will include the default, and the code is easier to to reason about and review (most code reviewers do not configure/execute
    puppet lookup
    locally)
  • o

    op-ct

    02/07/2023, 4:43 PM
    Then that's the right answer
  • b

    Brian Schonecker

    02/07/2023, 4:44 PM
    Yeah, I'm gonna have to do a balancing act and not double-define variable defaults in init.pp and common.yaml. Thanks everyone for helping out this old dog.
    👍 2
  • w

    wil.rodriguez

    02/07/2023, 4:46 PM
    I agree, and in my previous role as the primary guiding puppet SME at USAA, I advised this as well. Default values that live inside of the puppet code are far easier to find than hunting through any number of different layers of hiera for a value. This is extra true when you're working in profiles rather than component modules. That said, puppet isn't exactly known for its top tier performance. It's a DSL of an interpreted language. So, it is definitely often preferable to short circuit the lookup for default values and put as much in hiera as possible so it can be caught by the blazing fast C++ based hiera libraries rather than being punted back over to ruby. Granted, it's only a single layer of separation in many cases, but that can add up in large environments.
  • o

    op-ct

    02/07/2023, 4:58 PM
    I wouldn't expect a performance hit in the case of parameter defaults―if APL is looking up a parameter, the Puppet code for that class has already been interpreted, including its parameters' default values. 🤔
  • b

    bastelfreak

    02/07/2023, 5:56 PM
    @Brian Schonecker Vox Pupuli best practice is to add data directly to the class and use hiera in modules when the defaults are OS specific. puppet-strings will pick up the data from the classes/defined resources and render them into the REFERENCE.md. puppet-strings doesnt read hiera
    👍 1
  • b

    Brian Schonecker

    02/07/2023, 6:17 PM
    @bastelfreak thank you for the information. Now I have to learn puppet-strings as I've not heard of that before.
  • b

    bastelfreak

    02/07/2023, 6:17 PM
    ah 😄
  • b

    bastelfreak

    02/07/2023, 6:17 PM
    that's the inline annotations we do
  • b

    Brian Schonecker

    02/07/2023, 6:17 PM
    I have much more to learn before I can even think about contributing to Vox Pupuli.
  • b

    bastelfreak

    02/07/2023, 6:18 PM
    https://github.com/voxpupuli/puppet-dbbackup/blob/master/manifests/init.pp#L1-L18 as an example
  • b

    bastelfreak

    02/07/2023, 6:18 PM
    https://github.com/voxpupuli/puppet-dbbackup/blob/master/manifests/init.pp#L1-L18 as an example
  • b

    bastelfreak

    02/07/2023, 6:18 PM
    naaa
  • b

    bastelfreak

    02/07/2023, 6:18 PM
    I don't think so
1...297298299...428Latest