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.');
 }