43 lines
1.0 KiB
YAML
43 lines
1.0 KiB
YAML
|
|
- name: Debug iis_site_name
|
||
|
|
debug:
|
||
|
|
var: iis_site_name
|
||
|
|
|
||
|
|
#Lấy đường dẫn vật lý của iis site
|
||
|
|
- name: Get the physical path of the current IIS site
|
||
|
|
win_shell: |
|
||
|
|
Import-Module WebAdministration
|
||
|
|
$site = Get-Website -Name "{{ iis_site_name }}"
|
||
|
|
$site.PhysicalPath
|
||
|
|
register: active_path
|
||
|
|
|
||
|
|
# Chuẩn hóa giá trị của active_path
|
||
|
|
- name: Normalize active_path
|
||
|
|
set_fact:
|
||
|
|
active_path: "{{ active_path.stdout | trim }}"
|
||
|
|
|
||
|
|
# Debug các biến quan trọng
|
||
|
|
- name: Debug active_path
|
||
|
|
debug:
|
||
|
|
var: active_path
|
||
|
|
|
||
|
|
- name: Debug blue_path
|
||
|
|
debug:
|
||
|
|
var: blue_path
|
||
|
|
|
||
|
|
# Chọn môi trường Blue hoặc Green để deploy
|
||
|
|
- name: Set target deployment environment
|
||
|
|
set_fact:
|
||
|
|
target_path: "{{ green_path if active_path == blue_path else blue_path }}" #lấy ra đường dẫn thư mục cần deploy
|
||
|
|
|
||
|
|
- name: Debug target_path
|
||
|
|
debug:
|
||
|
|
var: target_path
|
||
|
|
|
||
|
|
# Kiểm tra các thông số Nexus
|
||
|
|
- name: Debug Nexus URL
|
||
|
|
debug:
|
||
|
|
var: nexus_url
|
||
|
|
|
||
|
|
- name: Debug artifact name
|
||
|
|
debug:
|
||
|
|
var: artifact_name
|