How run cookbook with dependencies in chef?

后端 未结 3 1930
遥遥无期
遥遥无期 2021-01-23 17:57

I have configured workstation up this step in get started (OS redhat 6.5). I have launched a node. I modified a cookbook like that:

myCookbook/metadata.rb

3条回答
  •  天涯浪人
    2021-01-23 18:34

    @rastasheep has described how the berkshelf tool is now bundled with the chefdk package.

    It's really easy to use and worth learning. It's designed to work like the gem bundler tool.

    Example

    └── myCookbook
        ├── Berksfile       <-- Berkshelf configuration file
        ├── Berksfile.lock  <-- Lock file generated by Berkshelf
        ├── metadata.rb
        ├── README.md
        └── recipes
            └── default.rb
    

    Berksfile

    source "https://supermarket.getchef.com"
    
    metadata
    

    The "source" directive tells berkshelf where to download dependencies from. The "metadata" directive tells berkshelf to take dependencies from the cookbook metadata.

    Using Berkshelf

    The "install" command will download the cookbook dependencies (Cached under ~/.berkshelf)

    $ cd myCookbook
    $ berks install
    Resolving cookbook dependencies...
    Fetching 'myCookbook' from source at .
    Fetching cookbook index from https://supermarket.getchef.com...
    Installing maven (1.2.0)
    Installing 7-zip (1.0.2)
    Installing ark (0.9.0)
    Installing chef_handler (1.1.6)
    Installing java (1.29.0)
    Installing windows (1.34.8)
    Using myCookbook (0.1.0) from source at .
    

    Berkshelf can also upload all the cookbooks into your chef server

    $ berks upload
    Uploaded 7-zip (1.0.2) to: 'http://127.0.0.1:8889/'
    Uploaded ark (0.9.0) to: 'http://127.0.0.1:8889/'
    Uploaded chef_handler (1.1.6) to: 'http://127.0.0.1:8889/'
    Uploaded java (1.29.0) to: 'http://127.0.0.1:8889/'
    Uploaded maven (1.2.0) to: 'http://127.0.0.1:8889/'
    Uploaded myCookbook (0.1.0) to: 'http://127.0.0.1:8889/'
    Uploaded windows (1.34.8) to: 'http://127.0.0.1:8889/'
    

提交回复
热议问题