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

    Yorokobi

    05/18/2022, 5:45 PM
    Usually you set the agent's environment in puppet.conf
    Copy code
    [main]
    environment = qa
    for example.
  • n

    natemccurdy

    05/18/2022, 5:46 PM
    No. Hiera is for storing and retrieveing data used as part of a Puppet run. What you’re describing is called node classification and assigning an “environment”. That’s either done manually like Yorokobi showed above, or automatically with an “External Node Classifier” (ENC).
  • l

    Les Shiner

    05/18/2022, 5:49 PM
    I think ENC is what I was looking for
  • l

    Les Shiner

    05/18/2022, 5:50 PM
    thanks @natemccurdy! I'll jump into that. And If I'm correct the ENC can override the local setting in the puppet.conf
  • n

    natemccurdy

    05/18/2022, 5:51 PM
    Yes, ENC’s take precedence. Though there is the option to write it so that the agent takes precedence.
  • n

    natemccurdy

    05/18/2022, 5:52 PM
    https://puppet.com/docs/puppet/7/nodes_external.html
  • l

    Les Shiner

    05/18/2022, 5:53 PM
    Thanks nate!
  • c

    csharpsteen

    05/18/2022, 8:54 PM
    Maybe some variant of: `bolt command run --targets all 'puppet facts upload --server new-puppetser.example`'
  • c

    csharpsteen

    05/18/2022, 8:54 PM
    Maybe some variant of:
    bolt command run --targets all 'puppet facts upload --server new-puppetser.example'
  • c

    csharpsteen

    05/18/2022, 8:54 PM
    Maybe some variant of:
    bolt command run --targets all 'puppet facts upload --server new-puppetserver.example'
  • w

    Willem Basson

    05/19/2022, 7:03 AM
    https://forge.puppet.com/modules/puppetlabs/ruby has been deprecated, but I see no reason for the deprecation, nor any recommendation for a replacement.
  • s

    Slackbot

    05/19/2022, 12:26 PM
    This message was deleted.
    b
    n
    • 3
    • 13
  • b

    bastelfreak

    05/19/2022, 12:29 PM
    I've a question about the
    /v3/facts
    API endpoint on Puppetserver: https://puppet.com/docs/puppet/5.5/http_api/http_facts.html what's the purpose of the
    expiration
    key in the payload? Does Puppetdb use that for anything?
  • n

    Neeloj

    05/19/2022, 12:37 PM
    thanks @bastelfreak, so I have to convert the jsonfile to class.. class moduleName::jsonfile and the requires attributes will work like before right ?
  • n

    Neeloj

    05/19/2022, 12:43 PM
    Yes I tested that it works thank you 🙂 @bastelfreak. Its possible to edit those files with Python ? Pyyaml cannot read class like that. do you have any idea or suggestion ?
  • b

    bastelfreak

    05/19/2022, 1:04 PM
    also https://github.com/voxpupuli/puppet-syntax can be used for json files
  • k

    krishna kant mishra

    05/19/2022, 2:41 PM
    What do in case of csr_attribute file is not available on the server and also server is not contactable to puppet master.
  • r

    Robert Emanuele

    05/19/2022, 4:44 PM
    When using the PDK to create a new resource, can a
    :namevar
    be something other than a String? If so how can I get a regex in the
    title_patterns
    to capture a value as an Integer or something else? (Am a bit of Ruby noob.)
  • h

    hbui

    05/19/2022, 4:56 PM
    generally, the pdk isn't used to create a new resource, it's used to create modules, classes, subclasses, defined types, etc (
    pdk new help
    ). Once created, you just add the resources as needed. https://puppet.com/docs/puppet/6/type.html
  • h

    hbui

    05/19/2022, 4:56 PM
    if you can be more specific about what you want to accomplish, we can probably be of more help
  • h

    hbui

    05/19/2022, 5:10 PM
    generally, the pdk isn't used to create a new resource, it's used to create modules, classes, subclasses, defined types, etc (
    pdk new help
    ). Once created, you just add the resources as needed. https://puppet.com/docs/puppet/6/type.html
  • r

    Robert Emanuele

    05/19/2022, 5:22 PM
    https://puppet.com/docs/puppet/7/about_the_resource_api.html#composite-namevars
  • r

    Robert Emanuele

    05/19/2022, 5:24 PM
    This is what I’m looking at. I’m creating a resource type for Foreman’s smart proxy to added DNS entries beyond the scope of the Foreman API.
  • h

    hbui

    05/19/2022, 5:47 PM
    I believe that the title needs to be a string at the end of the day
  • n

    natemccurdy

    05/19/2022, 5:49 PM
    Correct. Resource titles must be strings.
  • h

    hbui

    05/19/2022, 5:49 PM
    typically, the title is used directly as the namevar, but sometimes that isn't enough and you can use two parameters (or more) to uniquely identify a resource (e.g. the title and the path for a file resource)
  • h

    hbui

    05/19/2022, 5:52 PM
    so you can either put the burden of uniqueness on the user of your new type/resource or you can give them a hand. In the case of the file resource, you wouldn't want the situation where someone had
    Copy code
    file { 'mydnsfile':
      path => '/etc/resolv.conf',
      mode => '0664',
    }
    
    file { 'resolverfile':
      path => '/etc/resolv.conf',
      mode => '0644',
    }
    you'd put puppet in a situation where you had a conflict about what you would want done, so you need to make path the namevar to guarantee that only one resource can own a file.
  • r

    Robert Emanuele

    05/19/2022, 6:00 PM
    I’m a 100% on that fact namevars have to be strings. My question is when defining the resource type using the PDK can the namevars I extract from the string be converted to other ruby types? are there any methods or definitions in the PDK resource API to define that conversion?
  • r

    Robert Emanuele

    05/19/2022, 6:00 PM
    I’m a 100% on that fact namevars have to be strings. My question is when defining the resource type using the PDK can the namevars I extract from the string be converted to other ruby types? are there any methods or definitions in the PDK resource API to define that conversion?
  • h

    hbui

    05/19/2022, 6:46 PM
    it's ruby, so I assume yes. I'd probably be looking at defining other parameters rather than try and pass all the data via the title string
1...464748...428Latest