zoukankan      html  css  js  c++  java
  • chef cookbook 实战

    在Workstation中创建cookbook,并且上传到Chef server,以及其他与Chef相关的工作。

    安装chef client命令

    knife bootstrap 10.6.1.207 --sudo –x root -P passw0rd -N testcontroller.com

    在目标机器上运行 chef-client命令,验证该命令是否可以识别。

    1、创建cookbook

    $ cd ~/chef-repo
    $ knife cookbook create my-test

    2、编写recipe

    $ vim ~/chef-repo/cookbooks/my-test/recipes/test.rb
    puts "hello,world!!!"

    3、上传cookbook

    knife cook upload my-test

    4、配置node的run list

    run list定义了recipe的执行顺序。

    # knife  node run_list add testcontroller.com recipe[my-test::test]

    5、运行chef-client

      1)执行chef-client来从chef server上获取最新的cookbook,并且在目标node上执行。

    knife ssh your.host 'sudo chef-client' -m -x root -P Passw0rd

      -x username

      2)也可以自己登录到node上然后执行如下命令

    # chef-client

     参考链接:

    1、http://it.taocms.org/07/4103.htm

    2、http://www.ibm.com/developerworks/cn/cloud/library/1504_wangqw_chefcookbook/index.html

  • 相关阅读:
    ASP.NET教程4
    ASP.NET教程11
    TreeView Demo
    System.Net.Dns.GetHostByAddress(string) 已经过时
    会员注册实例
    ASP.NET教程2
    多表关联与表值函数
    ASP.NET教程6
    BusinessFrameWork
    ASP.NET教程8
  • 原文地址:https://www.cnblogs.com/relaxgirl/p/4561389.html
Copyright © 2011-2022 走看看