Chef knifeコマンド

提供: FreeBSD入門
移動: 案内検索
スポンサーリンク

Chefの knife コマンドとは, ローカルのchef-repoとChef サーバへのインタフェースを提供します。

読み方

knife
ないふ

概要

Chefは、knifeコマンドを利用して、chef-repoやChefサーバへの操作を行います。

使い方

バージョンの確認

% chef-solo -v
Chef: 11.6.0
% knife -v
Chef: 11.6.0

コマンドラインオプション

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 Wi                                                                                                                                                                                                                                                ndows, 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 comma                                                                                                                                                                                                                                                nds
    -E, --environment ENVIRONMENT    Set the Chef environment (except for in sea                                                                                                                                                                                                                                                rches, where this will be flagrantly ignored)
    -F, --format FORMAT              Which format to use for output
    -z, --local-mode                 Point knife commands at local repository in                                                                                                                                                                                                                                                stead 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 verb                                                                                                                                                                                                                                                osity
    -v, --version                    Show chef version
    -y, --yes                        Say yes to all prompts for confirmation
    -h, --help                       Show this message
 
Available subcommands: (for details, knife SUB-COMMAND --help)
 
** BOOTSTRAP COMMANDS **
knife bootstrap FQDN (options)
 
** CLIENT COMMANDS **
knife client bulk delete REGEX (options)
knife client create CLIENT (options)
knife client delete CLIENT (options)
knife client edit CLIENT (options)
knife client list (options)
knife client reregister CLIENT (options)
knife client show CLIENT (options)
 
** CONFIGURE COMMANDS **
knife configure (options)
knife configure client DIRECTORY
 
** COOKBOOK COMMANDS **
knife cookbook bulk delete REGEX (options)
knife cookbook create COOKBOOK (options)
knife cookbook delete COOKBOOK VERSION (options)
knife cookbook download COOKBOOK [VERSION] (options)
knife cookbook list (options)
knife cookbook metadata COOKBOOK (options)
knife cookbook metadata from FILE (options)
knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)
knife cookbook test [COOKBOOKS...] (options)
knife cookbook upload [COOKBOOKS...] (options)
 
** COOKBOOK SITE COMMANDS **
knife cookbook site download COOKBOOK [VERSION] (options)
knife cookbook site install COOKBOOK [VERSION] (options)
knife cookbook site list (options)
knife cookbook site search QUERY (options)
knife cookbook site share COOKBOOK CATEGORY (options)
knife cookbook site show COOKBOOK [VERSION] (options)
knife cookbook site unshare COOKBOOK
 
** DATA BAG COMMANDS **
knife data bag create BAG [ITEM] (options)
knife data bag delete BAG [ITEM] (options)
knife data bag edit BAG ITEM (options)
knife data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)
knife data bag list (options)
knife data bag show BAG [ITEM] (options)
 
** ENVIRONMENT COMMANDS **
knife environment compare [ENVIRONMENT..] (options)
knife environment create ENVIRONMENT (options)
knife environment delete ENVIRONMENT (options)
knife environment edit ENVIRONMENT (options)
knife environment from file FILE [FILE..] (options)
knife environment list (options)
knife environment show ENVIRONMENT (options)
 
** EXEC COMMANDS **
knife exec [SCRIPT] (options)
 
** HELP COMMANDS **
knife help [list|TOPIC]
 
** INDEX COMMANDS **
knife index rebuild (options)
 
** KNIFE COMMANDS **
Usage: /usr/local/bin/knife (options)
 
** NODE COMMANDS **
knife node bulk delete REGEX (options)
knife node create NODE (options)
knife node delete NODE (options)
knife node edit NODE (options)
knife node environment set NODE ENVIRONMENT
knife node from file FILE (options)
knife node list (options)
knife node run_list add [NODE] [ENTRY[,ENTRY]] (options)
knife node run_list remove [NODE] [ENTRIES] (options)
knife node run_list set NODE ENTRIES (options)
knife node show NODE (options)
 
** PATH-BASED COMMANDS **
knife delete [PATTERN1 ... PATTERNn]
knife deps PATTERN1 [PATTERNn]
knife diff PATTERNS
knife download PATTERNS
knife edit [PATTERN1 ... PATTERNn]
knife list [-dfR1p] [PATTERN1 ... PATTERNn]
knife show [PATTERN1 ... PATTERNn]
knife upload PATTERNS
knife xargs [COMMAND]
 
** RAW COMMANDS **
knife raw REQUEST_PATH
 
** RECIPE COMMANDS **
knife recipe list [PATTERN]
 
** ROLE COMMANDS **
knife role bulk delete REGEX (options)
knife role create ROLE (options)
knife role delete ROLE (options)
knife role edit ROLE (options)
knife role from file FILE [FILE..] (options)
knife role list (options)
knife role show ROLE (options)
 
** SEARCH COMMANDS **
knife search INDEX QUERY (options)
 
** SERVE COMMANDS **
Usage: /usr/local/bin/knife (options)
 
** SSH COMMANDS **
knife ssh QUERY COMMAND (options)
 
** SSL COMMANDS **
knife ssl check [URL] (options)
knife ssl fetch [URL] (options)
 
** STATUS COMMANDS **
knife status QUERY (options)
 
** TAG COMMANDS **
knife tag create NODE TAG ...
knife tag delete NODE TAG ...
knife tag list NODE
 
** USER COMMANDS **
knife user create USER (options)
knife user delete USER (options)
knife user edit USER (options)
knife user list (options)
knife user reregister USER (options)
knife user show USER (options)

knifeのセットアップ

% knife configure
WARNING: No knife configuration file found
Where should I put the config file? [/home/user/.chef/knife.rb]
Please enter the chef server URL: [https://vm2.local:443]
Please enter an existing username or clientname for the API: [user]
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem]
Please enter the path to a chef repository (or leave blank):
*****
 
You must place your client key in:
  /home/user/.chef/user.pem
Before running commands with Knife!
 
*****
 
You must place your validation key in:
  /etc/chef-server/chef-validator.pem
Before generating instance data with Knife!
 
*****
Configuration file written to /home/user/.chef/knife.rb

関連項目




スポンサーリンク