29 lines
870 B
YAML
29 lines
870 B
YAML
|
|
# Tải artifact từ Nexus
|
||
|
|
- name: Download artifact from Nexus
|
||
|
|
win_get_url:
|
||
|
|
url: "{{ nexus_url }}/{{ artifact_name }}"
|
||
|
|
dest: "{{ temp_dir }}\\{{ artifact_name }}"
|
||
|
|
validate_certs: no
|
||
|
|
url_username: "{{ nexus_username }}"
|
||
|
|
url_password: "{{ nexus_password }}"
|
||
|
|
register: download_status
|
||
|
|
vars:
|
||
|
|
nexus_url: "{{ nexus_url }}"
|
||
|
|
artifact_name: "{{ artifact_name }}"
|
||
|
|
nexus_username: "{{ nexus_username }}"
|
||
|
|
nexus_password: "{{ nexus_password }}"
|
||
|
|
|
||
|
|
# Kiểm tra xem artifact đã được tải thành công chưa
|
||
|
|
- name: Verify artifact download
|
||
|
|
fail:
|
||
|
|
msg: "Failed to download artifact from Nexus."
|
||
|
|
when: download_status is failed
|
||
|
|
|
||
|
|
# Giải nén artifact vào thư mục target
|
||
|
|
- name: Deploy Backend to target environment
|
||
|
|
win_unzip:
|
||
|
|
src: "{{ temp_dir }}\\{{ artifact_name }}"
|
||
|
|
dest: "{{ target_path }}"
|
||
|
|
overwrite: yes
|
||
|
|
|