diff --git a/ANSIBLE/templates/composers/A000001/docker-compose.yml b/ANSIBLE/templates/composers/A000001/docker-compose.yml index 9fb59bc..19990b9 100644 --- a/ANSIBLE/templates/composers/A000001/docker-compose.yml +++ b/ANSIBLE/templates/composers/A000001/docker-compose.yml @@ -11,6 +11,7 @@ services: - ./apache_log:/var/log/apache2:Z environment: - PROVISION_UID=PROVISION_UID_REPLACE + - TEMPLATE_NAME=TEMPLATE_NAME_REPLACE # - APACHE_RUN_USER=1000 # - APACHE_RUN_GROUP=1000 networks: diff --git a/ANSIBLE/templates/composers/A000002/docker-compose.yml b/ANSIBLE/templates/composers/A000002/docker-compose.yml index 9fb59bc..19990b9 100644 --- a/ANSIBLE/templates/composers/A000002/docker-compose.yml +++ b/ANSIBLE/templates/composers/A000002/docker-compose.yml @@ -11,6 +11,7 @@ services: - ./apache_log:/var/log/apache2:Z environment: - PROVISION_UID=PROVISION_UID_REPLACE + - TEMPLATE_NAME=TEMPLATE_NAME_REPLACE # - APACHE_RUN_USER=1000 # - APACHE_RUN_GROUP=1000 networks: diff --git a/app/Controllers/Provision.php b/app/Controllers/Provision.php index 01c6be6..78b46db 100644 --- a/app/Controllers/Provision.php +++ b/app/Controllers/Provision.php @@ -177,6 +177,10 @@ class Provision extends BaseController $composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents); $composer_template_contents = str_replace("CNT_DB_DATA", '172.16.4.96:3307', $composer_template_contents); $composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); + $templateRandom = rand(1,6).'p'; + $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents); + + //Save to the specific path $destination_composer_path = $ansible_folder . "/parts/" . $provisionUID . "/docker-compose.yml"; @@ -371,6 +375,8 @@ class Provision extends BaseController $composer_template_contents = str_replace("CNT_DB_PASS", $provisionUID, $composer_template_contents); $composer_template_contents = str_replace("CNT_DB_DATA", '172.16.4.96:3307', $composer_template_contents); $composer_template_contents = str_replace("PROVISION_UID_REPLACE", $provisionUID, $composer_template_contents); + $templateRandom = rand(1,6).'p'; + $composer_template_contents = str_replace("TEMPLATE_NAME_REPLACE", $templateRandom, $composer_template_contents); //Save to the specific path $composerFile = fopen($destination_composer_path, "w") or die("Unable to open file!"); fwrite($composerFile, $composer_template_contents);