diff --git a/ANSIBLE/templates/A000003.yml b/ANSIBLE/templates/A000003.yml index 446972a..247ec21 100644 --- a/ANSIBLE/templates/A000003.yml +++ b/ANSIBLE/templates/A000003.yml @@ -4,9 +4,8 @@ tasks: - name: Set up docker-compose file template: - src: "WHAT_PART_FOLDER/docker-compose.yml" + src: "WHAT_PART_FOLDER_LOCAL/docker-compose.yml" dest: "DESTINATION_FOLDER" - delegate_to: localhost - name: docker compose up shell: diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 291891b..77e5b3a 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -13,7 +13,7 @@ class Home extends BaseController { $public_path = FCPATH; $ansible_folder = str_replace("public/", "ANSIBLE", $public_path); - + $partMachineLocal = "/home/chiefsoft/MermsProvision/ANSIBLE/parts/"; if (!is_dir($ansible_folder."/parts") ){ mkdir($ansible_folder."/parts", 0700); } @@ -39,6 +39,8 @@ class Home extends BaseController // THIS PROVISONING COMPOSERS $composer_template_path = $ansible_folder."/templates/composers/".$productId."/docker-compose.yml"; + $composer_template_path_local = $partMachineLocal.$productId."/docker-compose.yml"; + $prov_name = str_replace(".", "_", $pr->internal_url).".yml"; $template_file = $ansible_folder ."/templates/".$pr->product_id.".yml"; //Get the domposer template file @@ -59,6 +61,7 @@ class Home extends BaseController $template_content_processed = str_replace("WHAT_HOST_IN_USE", $productId."_SERVER", $template_content); $template_content_processed = str_replace("WHAT_PART_FOLDER", $partFolder, $template_content_processed); $template_content_processed = str_replace("DESTINATION_FOLDER", $destinationHomeFolder, $template_content_processed); + $template_content_processed = str_replace("WHAT_PART_FOLDER_LOCAL", $composer_template_path_local, $template_content_processed); // depends on the local machine // CREATE PROVISOINING FILE $myfile = fopen( $ansible_folder ."/".$prov_name, "w") or die("Unable to open file!"); fwrite($myfile, $template_content_processed);