Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(download_file): Added option to download file locally to Ansible… #57

Merged
merged 3 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions roles/download_file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ None
| -------- | ------- | ----------- |
| `download_file_url` | `https://rabe.ch/wp-content/uploads/2016/07/favicon.ico` | URL of file to be downloaded. |
| `download_file_destination` | `/tmp/` | Downloaded file detination path on remote host. |
| `download_file_locally` | `false` | Download file to Ansible host (127.0.0.1) instead of remote host. |

## Dependencies

Expand All @@ -26,6 +27,7 @@ None
vars:
download_file_url: https://rabe.ch/wp-content/uploads/2016/07/favicon.ico
download_file_destination: /tmp/
download_file_locally: false
```

## License
Expand Down
1 change: 1 addition & 0 deletions roles/download_file/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# defaults file for download_file
download_file_url: https://rabe.ch/wp-content/uploads/2016/07/favicon.ico
download_file_destination: /tmp/
download_file_locally: false
3 changes: 2 additions & 1 deletion roles/download_file/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# tasks file for download_file
- name: Download file
- name: Download file {{ 'locally' if download_file_locally }}
ansible.builtin.get_url:
url: "{{ download_file_url }}"
dest: "{{ download_file_destination }}"
delegate_to: "{{ '127.0.0.1' if download_file_locally else omit }}"