用刀从ChefServer下载角色和食谱 [英] download roles and cookbooks from ChefServer with knife

查看:44
本文介绍了用刀从ChefServer下载角色和食谱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于我开始使用Chef Server管理控制台与Chef合作,现在我想开始使用文件并通过刀上传文件。
是否有一种方法可以通过刀来检索存储在ChefServer中的角色和环境,因此我可以将它们导入git中?

Given I started working with Chef using the Chef Server Management Console and I now want to start using a files and upload them via knife. Is there a way to retrive roles and environments that are stored on the ChefServer via knife, so I can them into git?

推荐答案

您可以使用刀环境列表刀环境show 命令来下载环境并替换环境

You can use the knife environment list and knife environment show commands to download environments and replace "environment" with "role" to do the same for roles.

mkdir environments
for env in `knife environment list`; do
  knife environment show $env --format=json > environments/$env.json
done

然后您可以将这些JSON文件检入git和用小刀编辑/上传。

You can then check these JSON files into git and edit/upload with knife.

这篇关于用刀从ChefServer下载角色和食谱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆