"package" resourceを使う
$ cd <chef-repo dir>/cookbooks
$ knife cookbook craete install_screen -o ./
$ cd install_screen
$ vi recipes/default.rb
package "screen" do
action :install
end
$ cd ../..
$ vi nodes/<server>.json
{
"run_list":[
"recipe[install_screen]" # ★
]
}
[vagrant@vmchef1 ~]$ which screen
/usr/bin/which: no screen in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/vagrant/bin)
$ knife solo cook [email protected]
Recipe: install_screen::default
* package[screen] action install
- install version 4.0.3-16.el6 of package screen
[vagrant@vmchef1 ~]$ which screen
/usr/bin/screen