tagrget
This commit is contained in:
@@ -8,5 +8,7 @@ use CodeIgniter\Router\RouteCollection;
|
|||||||
$routes->get('/', 'Home::index');
|
$routes->get('/', 'Home::index');
|
||||||
|
|
||||||
$routes->get('/provision/prepare', 'Provision::prepareProvision');
|
$routes->get('/provision/prepare', 'Provision::prepareProvision');
|
||||||
$routes->get('/provision/update', 'Provision::updateProvision');
|
$routes->get('/provision/update', 'Provision::updateProvision');
|
||||||
$routes->get('/provision/release', 'Provision::releaseProvision');
|
$routes->get('/provision/release', 'Provision::releaseProvision');
|
||||||
|
$routes->get('/provision/target', 'Provision::directProvision');
|
||||||
|
|
||||||
|
|||||||
@@ -288,4 +288,34 @@ class Provision extends BaseController
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function directProvision(){
|
||||||
|
|
||||||
|
$mysql = "SELECT id AS plan_id, uid, provision_id, play_file from provision_plans ORDER BY updated ASC LIMIT 1 ";
|
||||||
|
$query = $this->db->query($mysql);
|
||||||
|
$provision_list = $query->getResult();
|
||||||
|
foreach ($provision_list as $pr) {
|
||||||
|
$playFile = $pr->play_file;
|
||||||
|
$planId = $pr->plan_id;
|
||||||
|
$provisionId = $pr->provision_id;
|
||||||
|
|
||||||
|
$this->db->query("UPDATE provision_plans SET updated = now() WHERE id = $planId");
|
||||||
|
$this->db->query("UPDATE members_products SET p_file = p_file + 1 WHERE id = $provisionId");
|
||||||
|
//$this->runAnsibleShell($playFile);
|
||||||
|
|
||||||
|
try{
|
||||||
|
log_message('critical', "***** ***** Provision :: runAnsibleShell($playFile) ");
|
||||||
|
$shellCommand ="ansible-playbook --vault-password-file /var/www/html/ANSIBLE/secrets.pass --key-file ~/.ssh/ansible_worker -i /var/www/html/ANSIBLE/inventory /var/www/html/ANSIBLE/$playFile";
|
||||||
|
log_message('critical', $shellCommand);
|
||||||
|
$output = shell_exec($shellCommand );
|
||||||
|
log_message('critical', "***** ***** Provision :: runAnsibleShell(output) AFTER SHELL RUN ".$output);
|
||||||
|
} catch ( \Exception $e){
|
||||||
|
log_message('critical', "***** ***** Provision Error:: runAnsibleShell() ".$e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user