new data
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
CONTAINER_PORT=8094
|
||||
UID=1000
|
||||
|
||||
SERVER_PATH = production
|
||||
|
||||
PATH_MACHINE_LOCAL = '/home/chiefsoft/MermsProvision/ANSIBLE/parts/'
|
||||
REMOTE_COMPOSER_PATH = 'chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/
|
||||
DESTINATION_HOME_FOLDER = '/home/chiefsoft/SITES/'
|
||||
#--------------------------------------------------------------------
|
||||
# Example Environment Configuration file
|
||||
#
|
||||
|
||||
@@ -10,7 +10,7 @@ $routes->get('/', 'Home::index');
|
||||
$routes->get('/provision/prepare', 'Provision::prepareProvision');
|
||||
$routes->get('/provision/update', 'Provision::updateProvision');
|
||||
$routes->get('/provision/release', 'Provision::releaseProvision');
|
||||
$routes->get('/provision/target', 'Provision::directProvision');
|
||||
//$routes->get('/provision/target', 'Provision::directProvision');
|
||||
//$routes->get('/provision/demo', 'Provision::demo');
|
||||
$routes->get('/provision/haproxy', 'Provision::configureURL');
|
||||
|
||||
|
||||
@@ -96,7 +96,8 @@ class Provision extends BaseController
|
||||
$list_limit = 1; // for noow
|
||||
$public_path = FCPATH;
|
||||
$ansible_folder = str_replace("public/", "ANSIBLE", $public_path);
|
||||
$partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
//$partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
$partMachineLocal = $_ENV['PATH_MACHINE_LOCAL']; // "/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
if (!is_dir($ansible_folder . "/parts")) {
|
||||
mkdir($ansible_folder . "/parts", 0700);
|
||||
}
|
||||
@@ -138,7 +139,8 @@ class Provision extends BaseController
|
||||
$composer_template_contents = file_get_contents($composer_template_path);
|
||||
// Do the processing
|
||||
$composer_template_contents = str_replace("WHAT_CONTAINER_NAME", $ContainerName, $composer_template_contents);
|
||||
$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName;
|
||||
//$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName;
|
||||
$destinationHomeFolder =$_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName;
|
||||
$composer_template_contents = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $composer_template_contents);
|
||||
$composer_template_contents = str_replace("ALLOCATED_PORT", $allocatedPort, $composer_template_contents);
|
||||
$composer_template_contents = str_replace("CNT_DB_NAME", $ContainerName, $composer_template_contents);
|
||||
@@ -314,10 +316,15 @@ class Provision extends BaseController
|
||||
|
||||
public function releaseProvision(){
|
||||
$rsyncPass = "******noNEDD****";
|
||||
$remote_composer_path = "chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
$partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
// $remote_composer_path = "chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
// $partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
$remote_composer_path = $_ENV['REMOTE_COMPOSER_PATH']; // "chiefsoft@10.0.0.32:/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
$partMachineLocal = $_ENV['PATH_MACHINE_LOCAL']; // "/home/chiefsoft/MermsProvision/ANSIBLE/parts/";
|
||||
$ansibleToken = $this->ansibleLogin();
|
||||
$mysql ="SELECT pp.uid AS prov_uid, p.id AS mpid, p.product_id, pp.id AS plan_id, pp.uid , pp.provision_id, pp.play_file, p.uid AS provision_uid
|
||||
$mysql ="SELECT pp.uid AS prov_uid, p.id AS mpid,
|
||||
p.product_id, pp.id AS plan_id, pp.uid ,
|
||||
pp.provision_id, pp.play_file,
|
||||
p.uid AS provision_uid
|
||||
FROM provision_plans pp
|
||||
LEFT JOIN members_products p ON p.id =pp.provision_id
|
||||
ORDER BY pp.updated ASC LIMIT 1 ";
|
||||
@@ -333,7 +340,8 @@ class Provision extends BaseController
|
||||
|
||||
$ansible_host = $productId . "_SERVER";
|
||||
$ContainerName = $productId . str_pad($pr->mpid, 10, "0", STR_PAD_LEFT);
|
||||
$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName;
|
||||
//$destinationHomeFolder = "/home/chiefsoft/SITES/" . $ContainerName;
|
||||
$destinationHomeFolder = $_ENV['DESTINATION_HOME_FOLDER'] . $ContainerName;
|
||||
$composer_template_path_local = $partMachineLocal . $provisionUID;
|
||||
$composer_template_path_remote = $remote_composer_path . $provisionUID;
|
||||
$ansible_transport_path = $pr->provision_uid; // $ContainerName;
|
||||
@@ -358,24 +366,25 @@ class Provision extends BaseController
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public function runAnsibleShell($provisionFile){
|
||||
try{
|
||||
log_message('critical', "***** ***** Provision :: runAnsibleShell($provisionFile) ");
|
||||
$shellCommand ="/var/www/html/ANSIBLE/auto_play.sh A000001.yml OLU AMEYE "; ///var/www/html/ANSIBLE/$provisionFile";
|
||||
log_message('critical', $shellCommand);
|
||||
$output = shell_exec($shellCommand );
|
||||
log_message('critical', "***** ***** Provision :: runAnsibleShell(output) AFTER SHELL RUN ".serialize($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";
|
||||
// public function runAnsibleShell($provisionFile){
|
||||
// try{
|
||||
// log_message('critical', "***** ***** Provision :: runAnsibleShell($provisionFile) ");
|
||||
// $shellCommand ="/var/www/html/ANSIBLE/auto_play.sh A000001.yml OLU AMEYE "; ///var/www/html/ANSIBLE/$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());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// log_message('critical', "***** ***** Provision :: runAnsibleShell(output) AFTER SHELL RUN ".serialize($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 );
|
||||
//// $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;
|
||||
// }
|
||||
|
||||
public function directProvision(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user