I'm fairly new to Chef and have been writing recipes for Kiosks that we use at work.

I've created a role for the Kiosk that contains a set of attributes, however one of these attributes is a unique ID that is different for each Kiosk node.

This ID is provided by our customer who uses the Kiosk, is abritrary, and can't be generated automatically.

What's best practice for setting this value? I'm using Chef Server and was thinking the best place to do it would be at Bootstrap but not entirely sure how.

  • That's quite vague about this id, can it be generated or should it be set to a specific value ?
    – Tensibai
    Commented Jul 27, 2018 at 9:52
  • It has to be set as a specific value, that's different for every node. Commented Jul 27, 2018 at 13:08
  • What I mean is would something like node.set['attribute']['id'] = node['fqdn'].hash % 9999(which give a number between 1 and 9999 derived from hostname) works or not
    – Tensibai
    Commented Jul 27, 2018 at 13:20
  • Unfortunately not, the ID is basically an ID given to us from a client and it's different on each node. We do not generate it. Commented Jul 27, 2018 at 13:47
  • then you should edit your question to specify that and show an example on how you get that id (or explain it with more details)
    – Tensibai
    Commented Jul 27, 2018 at 13:53

1 Answer 1


Yesterday I asked similar question and found this similar question after getting replies in my own post. What people suggested me in my question is editing a node by knife edit and then setting an attribute for that particular node manually. This attribute would be assigned only to this node. Or the other way - you could create a wrapper cookbook that would override attributes of your "base" cookbook. For more details check out answers and comments for my question.

Not the answer you're looking for? Browse other questions tagged or ask your own question.