Thienvv - them playbook cho deploy_fe_portal, roles,...

This commit is contained in:
thienqb123456
2025-01-09 18:35:25 +07:00
parent 88a3e6bf5b
commit d3eb6b9351
8 changed files with 137 additions and 2 deletions
+45
View File
@@ -0,0 +1,45 @@
# 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 }}"
# Debug download_status
- name: Debug download_status
debug:
var: download_status
- name: Check if the download was successful
debug:
msg: "Download successful: {{ download_status.msg }}"
# Kiểm tra ở trên server đã tồn tại file vùa tải xuống không
- name: Check if the artifact file exists
stat:
path: "{{ temp_dir }}/{{ artifact_name }}"
register: file_status
changed_when: false
failed_when: false
# Debug file_status
- name: Debug file_status
debug:
var: file_status
# Giải nén artifact vào thư mục target
- name: Deploy to target environment
win_unzip:
src: "{{ temp_dir }}\\{{ artifact_name }}"
dest: "{{ target_path }}"
overwrite: yes