Chef - 版本控制系统设置

使用版本控制系统是基础设施自动化的基本组成部分。有多种版本控制系统,例如 SVN、CVS 和 GIT。由于 GIT 在 Chef 社区中很受欢迎,我们将使用 GIT 设置。

注意 − 不要考虑在没有版本控制系统的情况下将基础设施构建为代码。

在 Windows 上

步骤 1 − 从 www.git-scm.org 下载 Windows 安装程序并按照安装步骤操作。

步骤 2 − 在 GitHub 上注册一个中央存储库。

步骤 3 −将 ssh 密钥上传到 GitHub 帐户,以便轻松与其交互。有关 ssh 密钥的详细信息,请访问以下链接 https://help.github.com/articles/generatingssh-keys

步骤 4 − 最后,通过访问 https://github.com/new 在 github 帐户上创建一个名为 chef-repo 的存储库。

在实际开始编写 cookbook 之前,可以在开发箱上设置初始 GIT 存储库并克隆 Opscode 提供的空存储库。

步骤 1 −下载 Opscode Chef 存储库空结​​构。

$ wget https://github.com/opscode/chef-repo/tarball/master

步骤 2 − 提取 tar 包。

$ tar –xvf master

步骤 3 − 重命名目录。

$ mv opscode-chef-repo-2c42c6a/ chef-repo

步骤 4 − 将当前工作目录更改为 chef repo。

$ cd chef-repo

步骤 5 −初始化一个新的 get repo。

$ git init.

步骤 6 − 连接到 git hub 上的 repo。

$ git remote add origin git@github.com:vipin022/chef-

步骤 7 − 将本地 repo 推送到 github。

$ git add.
$ git commit –m "empty repo structure created"
$ git push –u origin maste

通过使用上述过程,您将获得一个空的 chef repo。然后您可以开始开发 cookbook 和菜谱。完成后,您可以将更改推送到 GitHub。