v3 #1

Open
thienvv wants to merge 69 commits from v3 into main
5 changed files with 45 additions and 17 deletions
Showing only changes of commit fc9cbbd564 - Show all commits
@@ -3,5 +3,4 @@ iis_site_name: "portal-api.hanoitimes.vn"
blue_path: "C:\\deploy\\portal\\be\\hnt\\blue"
green_path: "C:\\deploy\\portal\\be\\hnt\\green"
aspnetcore_environtment: "Hnt_Beta"
iis_app_pool: "portal-api.hanoitimes.vn"
aspnetcore_environtment: "Hnt_Beta"
+3 -1
View File
@@ -1,4 +1,6 @@
temp_dir: "C:\\deploy\\vpress\\temp"
iis_site_name: "api-portal-2025"
blue_path: "C:\\deploy\\vpress\\portal\\be\\blue"
green_path: "C:\\deploy\\vpress\\portal\\be\\green"
green_path: "C:\\deploy\\vpress\\portal\\be\\green"
aspnetcore_environtment: "Uat"
@@ -0,0 +1,6 @@
temp_dir: "C:\\deploy\\vpress\\temp"
iis_site_name: "api-portal-2025"
blue_path: "C:\\deploy\\vpress\\portal\\be\\blue"
green_path: "C:\\deploy\\vpress\\portal\\be\\green"
aspnetcore_environtment: "Uat"
@@ -0,0 +1,6 @@
temp_dir: "C:\\deploy\\vpress\\temp"
iis_site_name: "api-portal-2025"
blue_path: "C:\\deploy\\vpress\\portal\\be\\blue"
green_path: "C:\\deploy\\vpress\\portal\\be\\green"
aspnetcore_environtment: "Uat"
+29 -14
View File
@@ -3,10 +3,6 @@
debug:
var: iis_site_name
- name: Debug iis_app_pool
debug:
var: iis_app_pool
- name: Debug aspnetcore_environtment
debug:
var: aspnetcore_environtment
@@ -24,17 +20,36 @@
debug:
var: artifact_name
- name: Set registry key for IIS App Pool environment variable
win_regedit:
path: "HKLM:\\SYSTEM\\CurrentControlSet\\Services\\W3SVC\\AppPools\\{{ iis_app_pool }}\\Environment"
name: "TEST_ENV"
type: string
data: "{{ aspnetcore_environtment }}"
- name: Validate required variables
assert:
that:
- iis_site_name is defined and iis_site_name | length > 0
- aspnetcore_environtment is defined and aspnetcore_environtment | length > 0
- blue_path is defined and blue_path | length > 0
- nexus_url is defined and nexus_url | length > 0
- artifact_name is defined and artifact_name | length > 0
fail_msg: "One or more required variables are missing or empty!"
- name: Check if IIS site exists
win_iis_site:
name: "{{ iis_site_name }}"
state: absent
check_mode: yes
register: site_check
- name: Fail if IIS site does not exist
fail:
msg: "IIS site '{{ iis_site_name }}' does not exist!"
when: site_check is changed
- name: Set ASPNETCORE_ENVIRONMENT for site
win_shell: |
Import-Module WebAdministration
Add-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/{{ iis_site_name }}" `
-filter "system.webServer/aspNetCore/environmentVariables" `
-name "." `
-value @{name="ASPNETCORE_ENVIRONMENT"; value="{{ aspnetcore_environtment }}"}
- name: Khởi động lại App Pool (hoặc IIS) để áp dụng
win_iis_webapppool:
name: "{{ iis_app_pool }}"
state: restarted
#Lấy đường dẫn vật lý của iis site
- name: Get the physical path of the current IIS site