provision update

This commit is contained in:
CHIEFSOFT\ameye
2025-01-25 15:19:11 -05:00
parent 5681a78c98
commit 9641eff93b
+14 -32
View File
@@ -14,29 +14,7 @@ class Provision extends BaseController
$this->prepareDataBase(); // allocte port for the conyainer use
$this->updateProvision();
$provArrv = [
"11833.devprov.mermsemr.com",
"94099.devprov.mermsemr.com",
"33271.devprov.mermsemr.com",
"49819.devprov.mermsemr.com",
"82790.devprov.mermsemr.com",
"23233.devprov.mermsemr.com",
"89354.devprov.mermsemr.com",
"73344.devprov.mermsemr.com",
"37338.devprov.mermsemr.com",
"43333.devprov.mermsemr.com",
"85959.devprov.mermsemr.com",
"23607.devprov.mermsemr.com",
"57257.devprov.mermsemr.com",
"63404.devprov.mermsemr.com"
];
foreach ($provArrv as $svv){
$tgt = $ansible_folder = str_replace(".", "_", $svv).".yml";
$this->runAnsibleShell("/var/www/html/ANSIBLE/".$tgt);
}
// $this->runAnsibleShell('/var/www/html/ANSIBLE/94099_devprov_mermsemr_com.yml');
return 0;
}
@@ -243,23 +221,27 @@ class Provision extends BaseController
// Use ls command with shell_exec function
$output = shell_exec('ls -alt /var/www/html/ANSIBLE/');
// Display the list of all files and directories
// Display the list of all files and directories
echo "<pre>$output</pre>";
$shellCommand ="/var/www/html/ANSIBLE/auto_play.sh ";
log_message('critical', $shellCommand);
$output = shell_exec($shellCommand );
var_dump($output);
log_message('critical', "Test poath -> ".$output);
$this->runAnsibleShell('a file wll be sent');
return 0;
}
public function runAnsibleShell($provisionFile){
try{
log_message('critical', "***** ***** Provision :: runAnsibleShell($provisionFile) ");
$shellCommand ="ansible-playbook --vault-password-file /var/www/html/ANSIBLE/secrets.pass --key-file ~/.ssh/ansible_worker -i /var/www/html/ANSIBLE/inventory $provisionFile";
log_message('critical', $shellCommand);
log_message('critical', "***** ***** Provision :: runAnsibleShell($provisionFile) ");
$shellCommand ="/var/www/html/ANSIBLE/auto_play.sh ";
log_message('critical', $shellCommand);
$output = shell_exec($shellCommand );
// var_dump($output);
log_message('critical', "***** ***** Provision :: runAnsibleShell(output) AFTER SHELL RUN ".$output);
// $shellCommand ="ansible-playbook --vault-password-file /var/www/html/ANSIBLE/secrets.pass --key-file ~/.ssh/ansible_worker -i /var/www/html/ANSIBLE/inventory $provisionFile";
// 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());
}