百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
K

knife-solo_data_bag

> 编程语言
开源

一个刀具插件,用于简化与数据包和 chef solo 的工作

156 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个刀具插件,用于简化与数据包和 chef solo 的工作

Knife Solo Data Bag

A knife plugin to make working with data bags easier in a chef solo environment.

If you are looking for a full featured chef solo management solution, you may want to check out knife solo.

Alternatives

knife data bag

The standard chef gem includes the knife command and commands to manipulate data bags.

knife-solo_data_bag has the following advantages over the knife data bag command:

  • allows recovery from errors when creating/editing JSON files,
  • allows import and export of the the contents in JSON format.

Deprecation Notices

  • Versions >= 2 only support Ruby versions 2.2 and above. If you need o use an earlier Ruby version, use knife-solo_data_bag = 11.4.0. If you need support for an earlier version of chef, use a knife solo data bag version = 12.x, you need to indicate that you're running in local mode, otherwise Chef will try to connect to a server.

In .chef/knife.rb, add:

ruby
local_mode       true

Create

Create a plain text data bag

$ knife solo data bag create apps app_1

Create an encrypted data bag with the provided string as the secret

$ knife solo data bag create apps app_1 -s secret_key

Create an encrypted data bag with the provided file content as the secret

$ knife solo data bag create apps app_1 --secret-file 'SECRET_FILE'

Create a data bag item with JSON from the command line (works with encryption)

$ knife solo data bag create apps app_1 --json '{"id": "app_1", "username": "bob"}'

Create a data bag item from a json file

$ knife solo data bag create apps app_1 --json-file foo.json

Edit

Edit a plain text data bag

$ knife solo data bag edit apps app_1

Edit an encrypted data bag with the provided string as the secret

$ knife solo data bag edit apps app_1 -s secret_key

Edit an encrypted data bag with the provided file content as the secret

$ knife solo data bag edit apps app_1 --secret-file 'SECRET_FILE'

List

List data bags

$ knife solo data bag list

Show

Show the plain text content of a data bag (if this is an encrypted data bag, it will return the encrypted data)

$ knife solo data bag show apps app_1

Show the unencrypted content of an encrypted data bag with the provided string as the secret

$ knife solo data bag show apps app_1 -s secret_key

Show the unencrypted content of an encrypted data bag with the provided file content as the secret

$ knife solo data bag show apps app_1 --secret-file 'SECRET_FILE'

You can also display any of the above variations in JSON format with -F json

$ knife solo data bag show apps app_1 -s secret_key -F json

Using Data Bags in Recipes

You can load your data bags inside you recipes as follows:

ruby
app_1 = Chef::EncryptedDataBagItem.load("apps", "app_1").to_hash

Notes

Data Bag Path

By default, this plugin will use the configured data_bag_path. This is defaulted to /var/chef/data_bags by Chef. It is possible to override this path in your Chef client config if desired. When using this plugin, it is also possible to override the path using the --data-bag-path argument.

Encrypted Data Bag Secret

This plugin respects the "encrypted_data_bag_secret" configuration option in knife.rb. Command line secret arguments (-s or --secret-file) will override the setting in knife.rb.

Version Support

This plugin has been tested on the following:

Chef:

  • ~> 11.8
  • ~> 12.16

Ruby:

  • 2.1.8
  • 2.2.2
  • 2.3.0

OS:

  • OSX
  • Linux

Development

Running tests requires an indication of the Gemfile to use:

bash
export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.chef.11.18.12
bundle
bundle exec rspec

Contribute

  • Fork the project
  • Make your feature addition or bug fix (with tests and docs) in a topic branch
  • Bonus points for not mucking with the gemspec or version
  • Send a pull request

License

See LICENSE for details

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言