You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

  1. ---
  2. - name: file_download | Downloading...
  3. debug:
  4. msg:
  5. - "URL: {{ download.url }}"
  6. - "Dest: {{ download.dest }}"
  7. - name: file_download | Create dest directory
  8. file:
  9. path: "{{local_release_dir}}/{{download.dest|dirname}}"
  10. state: directory
  11. recurse: yes
  12. when:
  13. - download.enabled
  14. - download.file
  15. - group_names | intersect(download.groups) | length
  16. - name: file_download | Download item
  17. get_url:
  18. url: "{{download.url}}"
  19. dest: "{{local_release_dir}}/{{download.dest}}"
  20. sha256sum: "{{download.sha256 | default(omit)}}"
  21. owner: "{{ download.owner|default(omit) }}"
  22. mode: "{{ download.mode|default(omit) }}"
  23. validate_certs: "{{ download_validate_certs }}"
  24. register: get_url_result
  25. until: "'OK' in get_url_result.msg or 'file already exists' in get_url_result.msg"
  26. retries: 4
  27. delay: "{{ retry_stagger | random + 3 }}"
  28. when:
  29. - download.enabled
  30. - download.file
  31. - group_names | intersect(download.groups) | length
  32. - name: file_download | Extract archives
  33. unarchive:
  34. src: "{{ local_release_dir }}/{{download.dest}}"
  35. dest: "{{ local_release_dir }}/{{download.dest|dirname}}"
  36. owner: "{{ download.owner|default(omit) }}"
  37. mode: "{{ download.mode|default(omit) }}"
  38. copy: no
  39. when:
  40. - download.enabled
  41. - download.file
  42. - download.unarchive|default(False)
  43. - group_names | intersect(download.groups) | length