Closed dellock6 closed 1 year ago
Hi Luca, thanks for the feedback!
A method to solve for the scenario you outlined is already present. There is a variable called iso_download
which has a default of false
. Removing iso_download
, or commenting it out, in your playbook will have the desired effect.
Here's a snippet from the code. Please note that this step is only performed if iso_download
is set to true
.
- name: Download ISO
ansible.windows.win_get_url:
url: "{{ iso_url }}"
dest: "{{ destination }}{{ destination_iso_file }}"
checksum: "{{ iso_checksum }}"
checksum_algorithm: sha256
force: true
when: iso_download | bool
Does this alleviate the issue for you?
Another reason for using the method outlined above is, by default, the destination ISO file is called vbr.iso
. This was done on purpose so ISOs from multiple versions don't add up. So when someone performs an upgrade, the previous ISO is overwritten. This also means that if force
was set to false
, Ansible would never download the ISO and the automation would most likely fail shortly after assuming the ISO was for a previous version of Veeam.
Ah, I see. Well, explained this way it makes sense. Probably one way to allow both re-using the existing ISO and do the upgrades could be to keep the original file names, but I still need to test the upgrade. Fine for now!
Using playbooks it's also possible to keep the original file name. An example of this can be found in the sample playbooks in the documentation:
- name: Veeam Backup & Replication Install
hosts: veeam
tasks:
- include_role:
name: veeamhub.veeam.veeam_vas
tasks_from: vbr_install
vars:
version: "12"
destination: "C:\\install\\"
destination_iso_file: "VeeamBackup&Replication_12.0.0.1420_20230209.iso"
sql_install_username: "sql_install"
sql_install_password: "ChangeM3!"
sql_service_username: "svc_sql"
sql_service_password: "ChangeM3!"
sql_username: "sa"
sql_password: "ChangeM3!"
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_vault.html#single-encrypted-variable
Closing this issue as this functionality is already in place.
i added to mount_iso.yml , find an ISO in the download directory. If present skip download, using this when debugging.
#FIND ISO
- name: Find ISO file equal or greater than 9 GB ending with .iso
ansible.windows.win_find:
paths: "{{ destination }}"
patterns: '*.iso'
size: 9g
register: iso_file_info
- name: Debug ISO File Info
debug:
var: (iso_file_info.matched | int) == 0
#Create DIR if path doesn't exist in find results
- name: Create download directory
ansible.windows.win_file:
path: "{{ destination }}"
state: directory
when: (iso_file_info.matched | int) == 0
#Download ISO if file path does not exist
- name: Download ISO with Retry
ansible.windows.win_get_url:
url: "{{ iso_url }}"
dest: "{{ destination }}{{ destination_iso_file }}"
checksum: "{{ iso_checksum }}"
checksum_algorithm: sha256
force: true
retries: 3
delay: 10
until: win_get_url_out is succeeded
when: (iso_file_info.matched | int) == 0
register: win_get_url_out
Foce: true is the default, but it means that every time the procedure downloads the entire file. Since it's almost 10GB, this is a huge waste of time in my opinion. In my local clone I edited the line to set force:false, we should consider to have this behavior as the new default.