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

    William Myers

    10/04/2022, 11:10 PM
    within site.pp , do classes have to be assigned underneath a node, or can you do it in reverse where you declare a class and then the nodes it should be installed on?
  • w

    William Myers

    10/04/2022, 11:10 PM
    Or set up group-based aliases ?
  • n

    natemccurdy

    10/04/2022, 11:10 PM
    They don’t have to be assigned underneath a node, but it’s strongly recommended to do so.
  • w

    William Myers

    10/04/2022, 11:11 PM
    How would I go about grouping nodes/tasks ?
  • w

    William Myers

    10/04/2022, 11:11 PM
    E.G. (Webservers)
  • w

    William Myers

    10/04/2022, 11:11 PM
    and then have sub tasks for specific subsects
  • w

    William Myers

    10/04/2022, 11:11 PM
    Webservers , Webservers_appname
  • n

    natemccurdy

    10/04/2022, 11:11 PM
    With a combination of facts and the “Roles and Profiles” design pattern: https://puppet.com/docs/pe/2019.8/osp/the_roles_and_profiles_method.html
  • n

    natemccurdy

    10/04/2022, 11:13 PM
    Ideally, there would be some way to group all your related nodes together. Some people have good hostnaming conventions and can group everything by hostname…. but that’s not always possible. The other way to group nodes is with facts. Then you can assign Puppet code to groups of nodes with conditional logic in the
    default
    node definition based on the value of a fact.
  • w

    William Myers

    10/04/2022, 11:13 PM
    ah nice, so I could tag them in some manner and then assign classes etc based on that fact?
  • n

    natemccurdy

    10/04/2022, 11:15 PM
    yup, exactly. And a common way to do that in the Puppet community is with facts. In particular, there would be a fact called
    role
    that you make and add to all of your nodes. This
    role
    fact just acts a label that you can use in conditional logic to include other classes and modules. (that’s one part of the “roles and profiles” pattern)
  • n

    natemccurdy

    10/04/2022, 11:16 PM
    https://gist.github.com/natemccurdy/07e8f08f0b1811e8cbb8996bd08e5915 Here’s an example that I find works really well…. This uses the
    node default {}
    definition, and looks at the trusted fact called
    pp_role
    (but for example’s sake, imagine that’s just
    role
    ), and includes a class named after the fact’s value.
  • n

    natemccurdy

    10/04/2022, 11:21 PM
    By the way, this thing we’re talking about is called “classification”. The process of determining which classes to assign to a node. That term will help you find other docs and blog posts about the matter.
  • n

    natemccurdy

    10/04/2022, 11:22 PM
    By the way, this thing we’re talking about is called “classification”. The process of determining which classes to assign to a node. That term will help you find other docs and blog posts about the matter.
  • w

    William Myers

    10/04/2022, 11:22 PM
    thank you 😃
  • i

    Ian CB

    10/05/2022, 8:03 AM
    Hi .. I had a question re hiera searching hieradata files - this relates to upgrading from hiera3 to hiera5 … Our previous hiera.yaml included the definitions class_module_files/${calling_class} and class_module_files/${calling_module} - the $calling_* variables do not exist for hiera5 - which is fine we want to consolidate the hieradata files anyway …. as I understand it in hiera3 calling_class is the full class name (eg profile:web server:fred) and the calling_module the top level (using the same eg profile) The question relates to the content of the hieradata files - if we have a profile:web server:fred.yaml file with hieradata does that data within it get read no matter the hieradata variable name ? I’d expect hieradata in these files to be for a specific class or module only - however some existing files have data for other unrelated modules. I think the hieradata will be read /used when the $calling_class or $calling_module result in the yaml files being included in the list to be parsed (when using hiera3) - I just want to be sure !
  • m

    Martin Minkus

    10/05/2022, 12:03 PM
    I updated the PR for facter 4 so it passes rubocop https://github.com/puppetlabs/facter/pull/2519 and updated the ticket to Ready for Merge
  • h

    hbui

    10/05/2022, 1:23 PM
    Everything is driven by the hiera.yaml, you can use
    puppet lookup <key> --node <nodename> --environment <environment>  --explain
    to see the path that puppet consults including the hiera.yaml files consulted. Typically it consults the hiera.yaml on the system (which is also typically empty) and then moves on to the hiera.yaml in the controlrepo. If the hierarchy you defined has fact names in the path to the file, then puppet will load that fact name and construct the path and then look in that yaml file for any key you lookup e.g.
    Copy code
    ---
    version: 5
    defaults:
      # location of the hiera yaml data directory, relative to this file
      datadir: data
      data_hash: yaml_data
    
    hierarchy:
      - name: "Global override"
        path: "global.yaml"
    
      - name: "Per-node data (yaml version)"
        path: "nodes/%{::clientcert}.yaml"
    
      - name: "Per operatingsystem"
        path: "os/%{::operatingsystem}.yaml"
    
      - name: "common"
        path: "common.yaml"
    this is an old sample hiera.yaml and puppet will consult global.yaml first and then consult the next layers. The second and third layers will be specific to the node that is checking in. The first and fourth will be the same regardless the node. Does that answer your question?
  • d

    Dr Bunsen Honeydew

    10/05/2022, 1:23 PM
    ```- took a hit! Ouch. (Karma: -75)
  • s

    Slackbot

    10/05/2022, 1:32 PM
    This message was deleted.
    i
    • 2
    • 1
  • s

    Slackbot

    10/05/2022, 1:35 PM
    This message was deleted.
    j
    h
    • 3
    • 6
  • h

    hbui

    10/05/2022, 1:35 PM
    What was the error you got when you removed it?
  • s

    Slackbot

    10/05/2022, 1:36 PM
    This message was deleted.
    h
    s
    • 3
    • 35
  • j

    John Ratliff

    10/05/2022, 1:37 PM
    Copy code
    sudo /opt/puppetlabs/bin/puppet agent --test --agent_disabled_lockfile=/nonexisting --noop  2>&1 | tee /home/jdratlif/puppet.log
    Info: Using configured environment 'production'
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    Info: Loading facts
    Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'classes' on node REDACTED                                                                                                                                       
    Warning: Not using cache on failed catalog
    Error: Could not retrieve catalog; skipping run
  • s

    sameer

    10/05/2022, 2:09 PM
    one of my team mate agreed with a new node definition abc03 without role:muleserver but also suggested to add somethiing if fqdn!= abc03 then apply vhost config......
  • s

    sameer

    10/05/2022, 2:31 PM
    message has been deleted
  • s

    Slackbot

    10/05/2022, 4:55 PM
    This message was deleted.
    l
    b
    • 3
    • 3
  • l

    Lumiere

    10/05/2022, 4:56 PM
    not sure why it's happening given the code in the erb
  • w

    William Myers

    10/05/2022, 5:31 PM
    If a puppet module really only has one function (copy and then execute an installer package), is it best practice to have a single manifest for install.pp or should there still be an init.pp that references it?
  • n

    natemccurdy

    10/05/2022, 5:33 PM
    in my opinion,
    init.pp
    is fine for something that small.
1...183184185...428Latest