Chef clientã¨Windowsåã便å©ã³ãã³ãã®ã¤ã³ã¹ãã¼ã«ããã
Chefãæµè¡ã£ã¦ãã¾ãããåãæè¿ã®æµããåãã¦å§ããã°ããã®ã«ããChef使ããªã®ã§ãããä¾ã«ãã£ã¦Windowsã§Chefãåããã®ã¯çµæ§å¤§å¤ã§ãã
ä»åã¯Chef clientã®ã¤ã³ã¹ãã¼ã«ãããã¨ã¨ãã«ãChefãéçºãã¦ããopscodeã®æä¾ãã¦ããrecipeã使ã£ã¦Windowsåãã®ä¾¿å©ãªã³ã¼ãã使ããããã«ãããã¨æãã¾ãã
#ãªããgemã使ã£ã¦ã¤ã³ã¹ãã¼ã«ããæ¹æ³ãããã¾ãããä»åã¯ã¤ã³ã¹ãã¼ã©ã¼(msi)ã使ãã¾ãã
Chef clientã®ã¤ã³ã¹ãã¼ã«
0. gitãã¤ã³ã¹ãã¼ã«ããã¦ããªãå ´åã¯msgitãªã©ã使ã£ã¦ã¤ã³ã¹ãã¼ã«ãã¦ããã¦ãã ããã
1. こちらのページã®Step2ã«ãããªã³ã¯ããChefã®ã¤ã³ã¹ãã¼ã©ã¼ããã¦ã³ãã¼ãããå®è¡ãã¦ãã ããã
ã¤ã³ã¹ãã¼ã«å¾ã«ã³ã³ã½ã¼ã«ã§chef-soloãªã©ã®ãã¼ã¸ã§ã³ã表示ãããã°OKã§ãã
> chef-solo --version Chef: 0.10.8
2. ç¶ãã¦Chefã®recipeãªã©ã管çãããªãã¸ããªãä½ãã¾ããopscodeããªãã¸ããªã®éå½¢ãå
¬éãã¦ãã¾ãã®ã§
ãããã¯ãã¼ã³ãã¦ä½¿ãã¾ãã
> C: > cd \ > git clone git://github.com/opscode/chef-repo.git
cloneã§ä½ãããchef-repoã¨ãããã£ã¬ã¯ããªãchefã®ãªãã¸ããªã«ãªãã¾ããopscodeã®ããã¥ã¡ã³ãã§ã¯
ãã®ãã£ã¬ã¯ããªããã¼ã¸ã§ã³ç®¡çãããã¨ãæ¨å¥¨ããã¦ãã¾ãã
3. chefã®è¨å®ãã¡ã¤ã«ã¨ãã®ç®¡çç¨ãã£ã¬ã¯ããªãä½ãã¾ãã
> mkdir chef-repo\.chef > cd chef-repo\.chef > echo >> solo.rb > notepad.exe solo.rb
solo.rbã«ã¯chef-soloç¨ã®è¨å®ãæ¸ãã¾ãã
æä½éå¿
è¦ãªã®ã¯cookbookã®å ´æã¨cacheã®å ´æã§ããä»åã¯ä»¥ä¸ã®ããã«ãã¾ããã
solo.rb
file_cache_path "C://opscode/chef/cache/chef-solo" cookbook_path "C://chef-repo/cookbooks"
ããã§ä¸éãã®ã¤ã³ã¹ãã¼ã«ã¯å®äºã§ãã
Windowsåãã®ä¾¿å©ã³ã¼ãã使ããããã«ãã
ãã®ã¾ã¾ã§ãChefãå©ç¨ãããã¨ã¯ã§ãã¾ãããWindowsã¯ããã±ã¼ã¸ããã¼ã¸ã£ã¼ãããã¾ããã
zipã¨ãmsiã¨ããã©ããã£ã¦æä½ãããããã®ãâ¦ãã¨ãæ©ã¿ã®æ¹ã¯opscodeãå
¬éãã¦ããこちらのrecipeã使ãã¨ä¾¿å©ã§ãã
1. こちらのrecipeãzipçã§ãã¦ã³ãã¼ãããC:\\chef-repo\cookbooksã®ä¸ã«é ç½®ãã¾ãã
2. ãã®recipeãå®è¡ããããã«è¨å®ãã¾ãã
> cd chef-repo/.chef > echo >> win_default.json > notepad.exe win_default.json
win_default.json
{ "run_list": ["recipe[windows]"] }
3. recipeãå®è¡ãã¾ãã
> cd ../ > chef-solo -c .chef/solo.rb -j .chef/win_default.json
4. 失æãã¾ãããï¼å¤±æããªãã£ã人ã¯ãã§ãããã§ããã§ãããåã¯ãã®ã®è¦äºã«å¤±æãã¾ããã
registry.rbã§ã¨ã©ã¼ãã¿ãããªãã©ããã³ã¼ããè¦ã¦ã¿ãã¨51è¡ç®ããã㧠retry ã使ã£ã¦ããé¨åãããããããã§ãã
詳ããã¯ãruby 1.9.2 retryãã§ããã£ã¦ãã ããã
ã¨ããããã¨ã©ã¼ããªããã°loopãåãã°ããï¼ã£ã½ãï¼ã®ã§é©å½ã«æ¸ãæãã¾ããã
registry.rb(line: 46~)
begin registry_update(:open) rescue Exception registry_update(:create) end redo #retry # start count loop over
5. å度recipeãå®è¡ããã¨ç¡äºã«ã¤ã³ã¹ãã¼ã«ãå®äºãã¾ãã次åã¯ã¤ã³ã¹ãã¼ã«ããã³ãã³ãã使ã£ã¦Windowsã«
ã½ããã¦ã§ã¢ãã¤ã³ã¹ãã¼ã«ãã¦ã¿ã¾ãã