be-portal env

This commit is contained in:
thienqb123456
2025-03-03 16:23:31 +07:00
parent 965d8b431c
commit ad216b4fef
2 changed files with 12 additions and 14 deletions
+11 -13
View File
@@ -24,19 +24,17 @@
debug:
var: artifact_name
- name: Set environment variable for IIS App Pool
hosts: windows_servers
tasks:
- name: Thiết lập ASPNETCORE_ENVIRONMENT cho App Pool
win_shell: |
$appPoolName = "{{ iis_app_pool }}"
$envVarName = "ASPNETCORE_ENVIRONMENT"
$envVarValue = "{{ aspnetcore_environtment }}"
$appPool = Get-Item "IIS:\AppPools\$appPoolName"
$appPool.EnvironmentVariables[$envVarName] = $envVarValue
$appPool | Set-Item
args:
executable: powershell.exe
- 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: 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