public void install(VMInstance vmi){ try { startPuppetAgent(vmi.getType().getPrivateKey(),vmi.getType().getLogin(), vmi.getType().getPasswd(), vmi.getName(), vmi.getPublicAddress()); } catch (Exception e) { e.printStackTrace(); } }
/** * Install puppet, manage the repo, change the hostname and execute puppet on a VM * @param pr the puppet resource * @param n the vm instance on which puppet will be installed and executed * @param hostname the new hostname of the vm for puppet * @param path the path to the puppet manifest */ private void managePuppet(PuppetResource pr, VMInstance n, String hostname, String path){ PuppetMarionnetteConnector puppet=new PuppetMarionnetteConnector(pr.getMaster(),n); //check if the configuration file is in the repo and manage the repo MercurialConnector mc=new MercurialConnector(pr.getRepo(),pr.getRepositoryKey()); journal.log(Level.INFO, ">> Mercurial connector created"); mc.addFile(path, pr.getUsername()); //Touch the site.pp file puppet.touchSiteFile(); //call the update host command puppet.configureHostname(n.getType().getPrivateKey(), n.getType().getLogin(),n.getType().getPasswd(), n.getPublicAddress(), pr.getMaster(), hostname, pr.getConfigureHostnameCommand()); //start the puppet run puppet.install(n); }