provison files
This commit is contained in:
@@ -252,13 +252,24 @@ class Provision extends BaseController
|
|||||||
//echo "<pre>$output</pre>";
|
//echo "<pre>$output</pre>";
|
||||||
//log_message('critical', "Test poath -> ".$output);
|
//log_message('critical', "Test poath -> ".$output);
|
||||||
|
|
||||||
$this->runAnsibleShell('a file wll be sent');
|
$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;
|
||||||
|
$this->db->query("UPDATE provision_plans SET updated = now() WHERE id = $planId");
|
||||||
|
$this->runAnsibleShell($playFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
public function runAnsibleShell($provisionFile){
|
public function runAnsibleShell($provisionFile){
|
||||||
try{
|
try{
|
||||||
log_message('critical', "***** ***** Provision :: runAnsibleShell($provisionFile) ");
|
log_message('critical', "***** ***** Provision :: runAnsibleShell($provisionFile) ");
|
||||||
$shellCommand ="/var/www/html/ANSIBLE/auto_play.sh ";
|
$shellCommand ="/var/www/html/ANSIBLE/auto_play.sh /var/www/html/ANSIBLE/$provisionFile";
|
||||||
log_message('critical', $shellCommand);
|
log_message('critical', $shellCommand);
|
||||||
$output = shell_exec($shellCommand );
|
$output = shell_exec($shellCommand );
|
||||||
log_message('critical', "***** ***** Provision :: runAnsibleShell(output) AFTER SHELL RUN ".serialize($output));
|
log_message('critical', "***** ***** Provision :: runAnsibleShell(output) AFTER SHELL RUN ".serialize($output));
|
||||||
|
|||||||
Reference in New Issue
Block a user