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

    William Myers

    10/12/2022, 11:50 PM
    good to plan for the unexpected
  • s

    smortex

    10/13/2022, 1:12 AM
    Oh, and of course:
    Copy code
    $x = "foo\nDebian\nbar"
    $x =~ /^Debian$/ #=> true
    So you really want:
    Copy code
    $x =~ /\ADebian\z/ #=> false
    šŸ‘ for @natemccurdy opinion of avoiding Regexp if not necessary 🧌
    āž• 1
  • s

    Slackbot

    10/13/2022, 8:57 AM
    This message was deleted.
    b
    a
    +3
    • 6
    • 24
  • b

    bastelfreak

    10/13/2022, 9:08 AM
    to 2) you can put hiera data into a module, for example: https://github.com/voxpupuli/puppet-ferm/blob/master/hiera.yaml + https://github.com/voxpupuli/puppet-ferm/tree/master/data
  • a

    Alex Fisher

    10/13/2022, 9:09 AM
    eg. https://github.com/voxpupuli/puppet-telegraf/blob/master/data/defaults.yaml#L2
  • s

    Slackbot

    10/13/2022, 11:03 AM
    This message was deleted.
    n
    • 2
    • 1
  • n

    Neeloj

    10/13/2022, 11:40 AM
    hi all, I use to_json_pretty in my pp files. its possible to split the value1 ?
    Copy code
    content => to_json_pretty({
          param_one => 'value',
          param_two => ['value1'],
        }, true),
  • d

    Dr Bunsen Honeydew

    10/13/2022, 11:45 AM
    allthethings šŸ§‘ā€šŸ«Puppet Forge is about to start up in #CFD8Z9A4T
  • n

    Neeloj

    10/13/2022, 11:45 AM
    solved with: in front of content
    Copy code
    $new_value1= split($value1, ',')
  • s

    Slackbot

    10/13/2022, 12:02 PM
    This message was deleted.
    b
    b
    +3
    • 6
    • 18
  • b

    Brian Schonecker

    10/13/2022, 12:04 PM
    Good morning in the EST. I'm looking for advice on how to solve a pesudo-chicken and egg issue. I've got a mount point (linux) that I need mounted and that mount resource requires the file resource that defines the directory where the mount is located. Unfortunately, once Puppet mounts the file system, the permissions/ownerships are not as specified in the file resource. A second puppet run solves the problem. Is this an example of "run puppet twice?" The feels kind of dirty to me and I was hoping that there was a trick to ensure that the directory was created, filesystem mounted and then the directory permissions ensured without two Puppet runs. Any insight would be much appreciated. Automount is not an option.
  • i

    Ian CB

    10/13/2022, 3:04 PM
    Thanks @helindbe. the problem I have is that there are over 12,000 servers and several thousand hiera data files (it a bit of a mess TBH) and I need to work out a way to move the hieradata to puppet 7 / hiera 5 without breaking anything . Id really like to be able to run something that tells me all the hiera calls made for a host, the data returned and which file it was from (on the existing puppet 3 environment) - that way I can check if my cleaned up hieradata is consistent or if I’m going to change things
  • h

    helindbe

    10/13/2022, 3:34 PM
    puppet since 3.8.1 has built in support for diff between compiling with language version 3x and 4x , and there is a catalog preview tool from puppet (now deprecated, but fully functional for puppet 3) that picks up data from the instrumentation in puppet core. There is another catalog diff tool that is for general diffing that everyone is now using that can also be used for this. There are however many things that the built in instrumented diff output does for you that you do not get from other tools as it will tell you about specific puppet expressions that now evaluate differently than before. That output helps find what caused the diff, and that proved to be a big help.
  • h

    helindbe

    10/13/2022, 3:40 PM
    Read more here: https://github.com/puppetlabs-toy-chest/puppetlabs-catalog_preview
  • s

    Slackbot

    10/13/2022, 3:59 PM
    This message was deleted.
    t
    h
    d
    • 4
    • 4
  • b

    bastelfreak

    10/13/2022, 4:00 PM
    always use
    $facts
    or
    fact()
    to access facts
    this 1
    āž• 1
  • s

    Slackbot

    10/13/2022, 4:00 PM
    This message was deleted.
    āž• 2
    d
    • 2
    • 1
  • t

    tutelacool

    10/13/2022, 4:02 PM
    thank you .. Is this mentioned somewhere. I would like to share this information with the outside.
  • n

    natemccurdy

    10/13/2022, 4:02 PM
    https://puppet.com/docs/puppet/7/style_guide.html#style_guide_variables-referencing-facts
    gratitude thank you 2
    āž• 1
  • j

    jhoblitt

    10/13/2022, 4:28 PM
    The repo isn't a ton of help either as it looks like most of the changes are git submodule changes.
  • j

    jhoblitt

    10/13/2022, 4:28 PM
    https://github.com/puppetlabs/puppetserver/compare/7.9.1...7.9.2
  • j

    jhoblitt

    10/13/2022, 4:36 PM
    I've got a strange one... duplicate file resource error.
    Copy code
    [puppetserver] Puppet Evaluation Error: Error while evaluating a Function Call, Duplicate declaration: File[/home/rke] is already declared at (file: /etc/puppetlabs/code/environments/IT_3057_el8/site/profile/manifests/core/rke.pp, line: 38); cannot redeclare (file: /etc/puppetlabs/code/environments/IT_3057_el8/manifests/site.pp, line: 11) (file: /etc/puppetlabs/code/environments/IT_3057_el8/manifests/site.pp, line: 11, column: 3) on node
    One is declared in a profile and the other is "supposedly" coming from hiera (via site.pp). However, if I do
    puppet lookup
    on the test node, the conflicting file isn't there. There are however files which are below
    /home/rke
    .
  • j

    jhoblitt

    10/13/2022, 4:38 PM
    Copy code
    [root@foreman ~]# puppet lookup --node <foo> --facts facts.yaml files | grep "home/rke"
    Warning: Undefined variable 'cluster'; 
       (file & line not available)
    Warning: Undefined variable '::cluster'; 
       (file & line not available)
    "/home/rke/.bash_profile":
    "/home/rke/.bashrc":
    "/home/rke/.bashrc.d":
    "/home/rke/.bashrc.d/vimode.sh":
    "/home/rke/.bashrc.d/10_k8s-cookbook-path.sh":
    "/home/rke/.bashrc.d/kubeconfig.sh":
    "/home/rke/.bashrc.d/etc_bashrc.sh":
    "/home/rke/.bashrc.d/kubectl.sh":
    "/home/rke/.bashrc.d/git-prompt.sh":
  • n

    natemccurdy

    10/13/2022, 4:40 PM
    What exactly is on line 11 of
    manifests/site.pp
    ? File’s don’t just come from hiera… there has to be some Puppet code that instantiates those
    file
    resources based on data from Hiera. So what’s that Puppet code doing exactly?
  • j

    jhoblitt

    10/13/2022, 4:40 PM
    This is the entire site.pp, it hasn't changed for a couple of years:
    Copy code
    lookup('classes', Array[String], 'unique').include
    
    $files = lookup(
      name          => 'files',
      value_type    => Variant[Hash[String, Hash], Undef],
      merge         => 'deep',
      default_value => undef,
    )
    
    #if ($files) {
    #  ensure_resources('file', $files)
    #}
    
    $packages = lookup(
      name          => 'packages',
      value_type    => Variant[Array[String], Undef],
      merge         => 'unique',
      default_value => undef,
    )
    
    if ($packages) {
      ensure_packages($packages)
    }
  • j

    jhoblitt

    10/13/2022, 4:41 PM
    (I just commented out the ensure_resources() to confirm that it resolve the duplicate resource error)
  • n

    natemccurdy

    10/13/2022, 4:41 PM
    That files lookup is doing a deep merge. But the
    puppet lookup
    on the command line is not. That’s why there’s a discrepency.
  • n

    natemccurdy

    10/13/2022, 4:42 PM
    Try
    puppet lookup --node <foo> --facts facts.yaml --merge deep files | grep "home/rke"
  • n

    natemccurdy

    10/13/2022, 4:42 PM
    That files lookup is doing a deep merge. But the
    puppet lookup
    on the command line is not. That’s why there’s a discrepency.
1...196197198...428Latest