# 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 Backend to target environment win_unzip: src: "{{ temp_dir }}\\{{ artifact_name }}" dest: "{{ target_path }}" overwrite: yes