Skip to content

Sample configuration run chef solo

kohkimakimoto edited this page Apr 12, 2013 · 2 revisions
<?php 
host('dev', array('host' => '192.168.0.11', 'port' => '22', 'login_name' => 'kohkimakimoto'), 'development');
host('web', array('host' => '192.168.0.12', 'port' => '22', 'login_name' => 'kohkimakimoto'), 'production');
host('db',  array('host' => '192.168.0.13', 'port' => '22', 'login_name' => 'kohkimakimoto'), 'production');

/**
 * Run chef-solo
 * https://github.com/kohkimakimoto/chef-for-centos
 */
$hosts4chef = get('hosts');
foreach ($hosts4chef as $host4chef => $host4chef_values) {
  desc('Run chef-solo at server ['.$host4chef.'].');
  task('chef_'.$host4chef, array('hosts' => $host4chef), function($host, $args){

    run("sh /var/chef/bin/chef-host", array("user" => "root"));

  });
}
Clone this wiki locally