LoginSignup
3
2

More than 5 years have passed since last update.

Chef Serverからローカルのchef-repoにオブジェクトをダウンロードする

Posted at

ここでは例として、rolesをダウンロードする。

ローカルのchef-repoにcd

現時点ではroles配下に何もない。

$ cd ~/work/chef-repo
$ ll roles/
total 16
-rw-r--r--  1 user  staff  632  5 22 18:21 README.md

knife downloadコマンドでChefサーバからオブジェクトをダウンロード

$ knife download roles
Created roles/base.json
Created roles/web.json

ダウンロードされていることを確認。

$ ll roles/
total 64
-rw-r--r--  1 user  staff  632  5 22 18:21 README.md
-rw-r--r--  1 user  staff  208  9 29 14:17 base.json
-rw-r--r--  1 user  staff  166  9 29 14:17 web.json

$ cat roles/base.json
roles/base.json
{
  "name": "base",
  "description": "base role",
  "run_list": [
    "recipe[audit]",
    "recipe[users]"
  ]
}

Dry Run

knife downloadに「--dry-run」オプションを付与すると、以下を事前に確認可能。

  • ダウンロード対象のオブジェクト
  • ローカルのChef-Repoに行われる処理
$ knife download roles --dry-run
Would create roles/base.json
Would create roles/web.json

ダウンロード候補

以下をダウンロード/管理しておくと良い。

  • data_bags
  • environments
  • nodes
  • roles
3
2
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
3
2