From 476794f5d3a0a374c795304d13441576e6d5ed57 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 15 Jul 2025 17:26:46 -0400 Subject: [PATCH] Fix files data --- ANSIBLE/templates/A000002.yml | 21 ++++- ANSIBLE/templates/A000005.yml | 21 ++++- .../composers/A000005/docker-compose.yml | 20 +++++ app/Controllers/BaseController.php | 76 +++++++++---------- 4 files changed, 98 insertions(+), 40 deletions(-) diff --git a/ANSIBLE/templates/A000002.yml b/ANSIBLE/templates/A000002.yml index 7769c7e..bc00db1 100644 --- a/ANSIBLE/templates/A000002.yml +++ b/ANSIBLE/templates/A000002.yml @@ -1 +1,20 @@ -A000002 \ No newline at end of file +--- +- hosts: WHAT_HOST_IN_USE + + tasks: + - name: Creates directory DESTINATION_FOLDER + ansible.builtin.file: + path: DESTINATION_FOLDER + state: directory + mode: 0775 + recurse: yes + + - name: Set up docker-compose file + template: + src: "WHAT_PART_LOCAL/docker-compose.yml" + dest: "DESTINATION_FOLDER" + + - name: docker compose up + shell: + chdir: "DESTINATION_FOLDER/" + cmd: docker-compose up -d \ No newline at end of file diff --git a/ANSIBLE/templates/A000005.yml b/ANSIBLE/templates/A000005.yml index 6827259..bc00db1 100644 --- a/ANSIBLE/templates/A000005.yml +++ b/ANSIBLE/templates/A000005.yml @@ -1 +1,20 @@ -A000005 \ No newline at end of file +--- +- hosts: WHAT_HOST_IN_USE + + tasks: + - name: Creates directory DESTINATION_FOLDER + ansible.builtin.file: + path: DESTINATION_FOLDER + state: directory + mode: 0775 + recurse: yes + + - name: Set up docker-compose file + template: + src: "WHAT_PART_LOCAL/docker-compose.yml" + dest: "DESTINATION_FOLDER" + + - name: docker compose up + shell: + chdir: "DESTINATION_FOLDER/" + cmd: docker-compose up -d \ No newline at end of file diff --git a/ANSIBLE/templates/composers/A000005/docker-compose.yml b/ANSIBLE/templates/composers/A000005/docker-compose.yml index e69de29..6c5b5f5 100644 --- a/ANSIBLE/templates/composers/A000005/docker-compose.yml +++ b/ANSIBLE/templates/composers/A000005/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3' + +services: + openemr-WHAT_CONTAINER_NAME: + container_name: WHAT_CONTAINER_NAME + image: wordpress:latest + ports: + - 'ALLOCATED_PORT:80' + restart: always + volumes: ['DESTINATION_FOLDER:/var/www/html'] + environment: + WORDPRESS_DB_HOST: CNT_DB_DATA + WORDPRESS_DB_USER: CNT_DB_NAME + WORDPRESS_DB_PASSWORD: CNT_DB_PASS + WORDPRESS_DB_NAME: CNT_DB_NAME + networks: + - wpsite + +networks: + wpsite: diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index ed125d0..b3fab5e 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -207,42 +207,42 @@ abstract class BaseController extends Controller return 0; } - public function ansibleProvisionBAD($ansibleToken,$params){ - log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ".$ansibleToken); - log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ". serialize( $params)); - - $result = "Unhandled exception"; - $base_url = "http://172.16.4.90:3000"; - $PROJECT_ID= 8; - $cookies = tempnam('/tmp','cookie.txt'); - - # 1. Login - $url = $base_url . "/api/project/$PROJECT_ID/tasks"; - log_message('critical', "***** ***** ansibleProvision CALL::URL ". $url); - $ch = curl_init( $url ); - # Setup request to send json via POST. - $payload = json_encode( $params ); - $authorization = "Authorization: Bearer ".$ansibleToken; // Prepare the authorisation token - curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload ); - curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json',$authorization)); - # Return response instead of printing. - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); - # Fetch the headers, not the body content: - - # Send request. - $result = curl_exec($ch); - $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $result = 'HTTP code: ' . $httpcode; - - curl_close($ch); - - log_message('critical', "***** ***** Provision :: ansibleProvision($httpcode) ".$httpcode); - - if ($httpcode != "204") { - return "Login failed! $result"; - } - - return 0; - - } +// public function ansibleProvisionBAD($ansibleToken,$params){ +// log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ".$ansibleToken); +// log_message('critical', "***** ***** Provision CALL:: ansibleProvision() Token ". serialize( $params)); +// +// $result = "Unhandled exception"; +// $base_url = "http://172.16.4.90:3000"; +// $PROJECT_ID= 8; +// $cookies = tempnam('/tmp','cookie.txt'); +// +// # 1. Login +// $url = $base_url . "/api/project/$PROJECT_ID/tasks"; +// log_message('critical', "***** ***** ansibleProvision CALL::URL ". $url); +// $ch = curl_init( $url ); +// # Setup request to send json via POST. +// $payload = json_encode( $params ); +// $authorization = "Authorization: Bearer ".$ansibleToken; // Prepare the authorisation token +// curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload ); +// curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json',$authorization)); +// # Return response instead of printing. +// curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); +// # Fetch the headers, not the body content: +// +// # Send request. +// $result = curl_exec($ch); +// $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); +// $result = 'HTTP code: ' . $httpcode; +// +// curl_close($ch); +// +// log_message('critical', "***** ***** Provision :: ansibleProvision($httpcode) ".$httpcode); +// +// if ($httpcode != "204") { +// return "Login failed! $result"; +// } +// +// return 0; +// +// } }