fix4
This commit is contained in:
@@ -41,38 +41,13 @@
|
||||
debug:
|
||||
msg: "IIS site {{ iis_site_name }} exists!"
|
||||
|
||||
- name: Get current ASPNETCORE_ENVIRONMENT
|
||||
ansible.windows.win_shell: |
|
||||
Import-Module WebAdministration
|
||||
$envVars = Get-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/{{ iis_site_name }}" `
|
||||
-filter "system.webServer/aspNetCore/environmentVariables" `
|
||||
-name "."
|
||||
$envVar = $envVars | Where-Object { $_.name -eq "ASPNETCORE_ENVIRONMENT" }
|
||||
if ($envVar) { $envVar.value } else { "NOT_SET" }
|
||||
register: current_env
|
||||
changed_when: false # Tránh bị đánh dấu là "changed" nếu chỉ đọc dữ liệu
|
||||
|
||||
- name: Debug current environment
|
||||
debug:
|
||||
var: current_env.stdout
|
||||
|
||||
- name: Set ASPNETCORE_ENVIRONMENT for IIS site if different
|
||||
ansible.windows.win_shell: |
|
||||
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_environment }}'}
|
||||
when: current_env.stdout != aspnetcore_environment
|
||||
|
||||
# - 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 }}"}
|
||||
|
||||
-value @{name="ASPNETCORE_ENVIRONMENT"; value="{{ aspnetcore_environment }}""}
|
||||
|
||||
#Lấy đường dẫn vật lý của iis site
|
||||
- name: Get the physical path of the current IIS site
|
||||
|
||||
Reference in New Issue
Block a user