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.

53 lines
1.4 KiB

  1. ---
  2. - name: file_download | create local download destination directory
  3. file:
  4. path: "{{ download.dest|dirname }}"
  5. state: directory
  6. recurse: yes
  7. mode: 0755
  8. delegate_to: localhost
  9. become: false
  10. run_once: true
  11. when:
  12. - download_delegate != "localhost"
  13. - download_run_once
  14. - download.enabled
  15. - download.file
  16. - name: file_download | copy file to ansible host
  17. synchronize:
  18. src: "{{ download.dest }}"
  19. dest: "{{ download.dest }}"
  20. use_ssh_args: "{{ has_bastion | default(false) }}"
  21. mode: pull
  22. run_once: true
  23. become: false
  24. when:
  25. - download.enabled
  26. - download.file
  27. - download_run_once
  28. - ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"]
  29. - inventory_hostname == download_delegate
  30. - download_delegate != "localhost"
  31. - name: file_download | upload file to nodes
  32. synchronize:
  33. src: "{{ download.dest }}"
  34. dest: "{{ download.dest }}"
  35. use_ssh_args: "{{ has_bastion | default(false) }}"
  36. mode: push
  37. become: true
  38. register: get_task
  39. until: get_task is succeeded
  40. retries: 4
  41. delay: "{{ retry_stagger | random + 3 }}"
  42. when:
  43. - download.enabled
  44. - download.file
  45. - download_run_once
  46. - (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] and
  47. inventory_hostname != download_delegate or
  48. download_delegate == "localhost")
  49. tags:
  50. - upload
  51. - upgrade