@Override public void install() { // TODO flag to force reinstallation DynamicTasks.queue( ChefSoloTasks.installChef(getInstallDir(), false), ChefSoloTasks.installCookbooks(getInstallDir(), getRequiredConfig(CHEF_COOKBOOKS), false)); }
public void run() { Entity e = EffectorTasks.findEntity(); if (cookbooksAndUrls==null) throw new IllegalStateException("No cookbooks defined to install at "+e); for (String cookbook: cookbooksAndUrls.keySet()) DynamicTasks.queue(installCookbook(chefDirectory, cookbook, cookbooksAndUrls.get(cookbook), force)); } }).buildFactory();
public static TaskFactory<?> runChef(String runDir, String phase) { return runChef(runDir, phase, false); } /** see {@link ChefConfig#CHEF_RUN_CONVERGE_TWICE} for background on why 'twice' is available */
protected void startWithChefSoloAsync() { // TODO make directories more configurable (both for ssh-drivers and for this) String installDir = Urls.mergePaths(AbstractSoftwareProcessSshDriver.BROOKLYN_HOME_DIR, "chef-install"); String runDir = Urls.mergePaths(AbstractSoftwareProcessSshDriver.BROOKLYN_HOME_DIR, "apps/"+entity().getApplicationId()+"/chef-entities/"+entity().getId()); DynamicTasks.queue( ChefSoloTasks.installChef(installDir, false), ChefSoloTasks.installCookbooks(installDir, ChefConfigs.getRequiredConfig(entity(), CHEF_COOKBOOKS), false)); DynamicTasks.queue(ChefSoloTasks.buildChefFile(runDir, installDir, "launch", ChefConfigs.getRequiredConfig(entity(), CHEF_RUN_LIST), entity().getConfig(CHEF_LAUNCH_ATTRIBUTES))); DynamicTasks.queue(ChefSoloTasks.runChef(runDir, "launch", entity().getConfig(CHEF_RUN_CONVERGE_TWICE))); }
public static TaskFactory<?> installChef(String chefDirectory, boolean force) { // TODO check on entity whether it is chef _server_ String installCmd = cdAndRun(chefDirectory, ChefBashCommands.INSTALL_FROM_OPSCODE); if (!force) installCmd = BashCommands.alternatives("which chef-solo", installCmd); return SshEffectorTasks.ssh(installCmd).summary("install chef"); }
@Override public void customize() { DynamicTasks.queue(ChefSoloTasks.buildChefFile(getRunDir(), getInstallDir(), "launch", getRequiredConfig(CHEF_RUN_LIST), getEntity().getConfig(CHEF_LAUNCH_ATTRIBUTES))); }
/** see {@link ChefConfig#CHEF_RUN_CONVERGE_TWICE} for background on why 'twice' is available */ public static TaskFactory<?> runChef(String runDir, String phase, Boolean twice) { String cmd = "sudo chef-solo -c "+phase+".rb -j "+phase+".json -ldebug"; if (twice!=null && twice) cmd = BashCommands.alternatives(cmd, cmd); return SshEffectorTasks.ssh(cdAndRun(runDir, cmd)). summary("run chef for "+phase).requiringExitCodeZero(); }
public static TaskFactory<?> installCookbook(String chefDirectory, String cookbook, String url, boolean force) { // TODO if it's server, try knife first // TODO support downloads from classpath / local server return SshEffectorTasks.ssh(cdAndRun(chefDirectory, ChefBashCommands.downloadAndExpandCookbook(url, cookbook, force))). summary("install cookbook "+cookbook).requiringExitCodeZero(); }
@Override public void launch() { DynamicTasks.queue(ChefSoloTasks.runChef(getRunDir(), "launch", getEntity().getConfig(CHEF_RUN_CONVERGE_TWICE))); }