cookbook 'nodes', '~> 0.0.5'
nodes (6) Versions 0.0.5 Follow0
store node attributes in data bag items
cookbook 'nodes', '~> 0.0.5', :supermarket
knife supermarket install nodes
knife supermarket download nodes
nodes cookbook
This is a cookbook for managing node attributes in data bags.
The idea is, you probably keep your cookbooks, roles, environments,
and data bags under version control, and maybe you even upload them
via a CI server. Great. But then you can also set attributes on
individual nodes using knife node edit
. That doesn't sound like a
good idea for long-term maintainability. Some people create per-node
roles, but that doesn't seem very attractive.
So the solution proposed here is to store per-node attributes in data
bag items. To make node-specific attribute changes, you just
manipulate and upload your data bags using your normal change process.
And include this cookbook in your run list to make the changes
effective.
More precisely, at this to your run list, ideally very early:
recipe[nodes]
Structure your data bags this way:
data_bags/
+---nodes/
+---host1.example.com.json
+---host2.example.com.json
The data bag item name should be the Chef node name (usually the host
name, but not necessarily).
The individual per-node data bag items should look like this:
{ "id": "host1.example.com", "default_attributes": { "foo1": "bar1" }, "force_default_attributes": { "foo2": "bar2" }, "override_attributes": { "foo3": "bar3" }, "force_override_attributes": { "foo4": "bar4" } }
This looks very similar to a role or environment JSON file.
The attributes are actually applied in a recipe, so they have lower
precedence than roles or environments. Since a per-node setting is
usually supposed to override such global settings, the force_
variants will often be useful.
Here is a somewhat realistic example:
{ "id": "specialhost.example.com", "force_override_attributes": { "sysctl": { "params": { "vm": { "swappiness": 0 } } } } }
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.0.5 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.0.5 failed this metric
FC064: Ensure issues_url is set in metadata: nodes/metadata.rb:1
FC065: Ensure source_url is set in metadata: nodes/metadata.rb:1
FC066: Ensure chef_version is set in metadata: nodes/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: nodes/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.0.5 passed this metric
Testing File Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.5 failed this metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.0.5 failed this metric
FC064: Ensure issues_url is set in metadata: nodes/metadata.rb:1
FC065: Ensure source_url is set in metadata: nodes/metadata.rb:1
FC066: Ensure chef_version is set in metadata: nodes/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: nodes/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.0.5 passed this metric
Testing File Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.5 failed this metric
FC065: Ensure source_url is set in metadata: nodes/metadata.rb:1
FC066: Ensure chef_version is set in metadata: nodes/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: nodes/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.0.5 passed this metric
Testing File Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.5 failed this metric
0.0.5 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number