public function transformValues(array $values, VagrantBundle $vagrantBundle) { $map = ["mysql" => "php5-mysql", "mariadb" => "php5-mysql", "pgsql" => "php5-pgsql", "sqlite" => "php5-sqlite", "mongodb" => "php5-mongo"]; $playbook = $vagrantBundle->getPlaybook(); foreach ($map as $role => $package) { if ($playbook->hasRole($role)) { $values = $this->addPhpPackage($package, $values); } } return $values; }
/** * {@inheritdoc} */ public function setup(array $requestVars, VagrantBundle $vagrantBundle) { if (!array_key_exists($this->getSlug(), $requestVars)) { return; } if (!$this->installRole($requestVars)) { return; } $config = $requestVars[$this->getSlug()]; if (!is_null($this->role)) { $vagrantBundle->getPlaybook()->addRole($this->role); } $vagrantBundle->getVarsFile()->addMultipleVars([$this->getSlug() => $config]); }
/** * {@inheritdoc} */ public function setup(array $requestVars, VagrantBundle $vagrantBundle) { if (!$this->installRole($requestVars)) { return; } $playbook = $vagrantBundle->getPlaybook(); $roleMap = $this->getRolePackageMap(); foreach ($roleMap as $role => $package) { if ($playbook->hasRole($role)) { $this->addPhpPackage($package, $requestVars); } } parent::setup($requestVars, $vagrantBundle); }
public function indexAction(Request $request, Application $app) { $requestVars = $request->request->all(); $requestVars['server']['locale'] = $this->extractLocale($request->getLanguages()); $inventory = $this->getInventory($requestVars); $varsFile = new VarfileRenderer('all'); $playbook = new PlaybookRenderer(); // @todo fix str_replace $playbook->setVarsFilename(str_replace('ansible/', '', $varsFile->getFilePath())); $loader = new \Twig_Loader_Filesystem($this->get('ansible.templates')); $vagrantBundle = new VagrantBundle($this->get('ansible.path'), new \Twig_Environment($loader)); $vagrantBundle->setPlaybook($playbook)->setVarsFile($varsFile)->setInventory($inventory); $app['roles']->setupRole($requestVars, $vagrantBundle); $playbook->addRole('app'); $zipPath = tempnam(sys_get_temp_dir(), "phansible_bundle_"); if ($vagrantBundle->generateBundle($zipPath, $playbook->getRoles())) { $vagrantfile = $vagrantBundle->getVagrantFile(); return $this->outputBundle($zipPath, $app, $vagrantfile->getName()); } return new Response('An error occurred.'); }
public function transformValues(array $values, VagrantBundle $vagrantBundle) { $vagrantFile = $this->getVagrantfile($values); $vagrantBundle->setVagrantFile($vagrantFile); return $values; }