LoginSignup
0
0

More than 5 years have passed since last update.

knifeのzオプションについて

Last updated at Posted at 2014-11-30
$ knife data bag create passwords

ERROR: Your private key could not be loaded from /etc/chef/client.pem
Check your configuration file and ensure that your private key is readable

data bagをいじっていて、鍵の場所があっていないと怒られた。

ググってみると、-zというオプションを使うといいらしい。
とりあえず、knifeのhelpを参照する。

$ knife -h

Usage: knife sub-command (options)
    -s, --server-url URL             Chef Server URL
        --chef-zero-host HOST        Host to start chef-zero on
        --chef-zero-port PORT        Port to start chef-zero on
    -k, --key KEY                    API Client Key
        --[no-]color                 Use colored output, defaults to false on Windows, true otherwise
    -c, --config CONFIG              The configuration file to use
        --defaults                   Accept default values for all questions
    -d, --disable-editing            Do not open EDITOR, just accept the data as is
    -e, --editor EDITOR              Set the editor to use for interactive commands
    -E, --environment ENVIRONMENT    Set the Chef environment (except for in searches, where this will be flagrantly ignored)
    -F, --format FORMAT              Which format to use for output
    -z, --local-mode                 Point knife commands at local repository instead of server
    -u, --user USER                  API Client Username
        --print-after                Show the data after a destructive operation
    -V, --verbose                    More verbose output. Use twice for max verbosity
    -v, --version                    Show chef version
    -y, --yes                        Say yes to all prompts for confirmation
    -h, --help                       Show this message

-zはknifeコマンドをサーバではなく、ローカルのレポジトリ参照してくれるようだ。

$ knife data bag create passwords -z

Created data_bag[passwords]

これで、/etc/chef/client.pemではなくchef-repo内の鍵を使ってくれたみたいだ。

↑でもこれは、鍵がchef-repoの中に入ってるから、あまり健全じゃないかも。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0