Skip to content

Commit

Permalink
feat(download_file): Download a file
Browse files Browse the repository at this point in the history
  • Loading branch information
smirta committed Jun 6, 2024
1 parent df7974a commit f8179df
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
33 changes: 33 additions & 0 deletions roles/download_file/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Ansible Role - radiorabe.common.download_file

Download a file using [`ansible.builtin.get_url`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/get_url_module.html).

## Requirements

None

## Role Variables

| Variable | Default | Description |
| -------- | ------- | ----------- |
| `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. |

## Dependencies

None


## Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

```yaml
- hosts: all
roles:
- download_file
```
## License
This role is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.
4 changes: 4 additions & 0 deletions roles/download_file/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# defaults file for download_file
download_file_url: https://rabe.ch/wp-content/uploads/2016/07/favicon.ico
download_file_destination: /tmp/
16 changes: 16 additions & 0 deletions roles/download_file/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
galaxy_info:
author: RaBe IT-Reaktion
description: Download file
issue_tracker_url: https://github.com/radiorabe/ansible-collection-common/issues
license: AGPL-3.0-only
min_ansible_version: '2.9'
platforms:
- name: EL
versions:
- all
- name: Fedora
version:
- all
galaxy_tags:
- radiorabe
dependencies: []
6 changes: 6 additions & 0 deletions roles/download_file/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# tasks file for download_file
- name: Download file
get_url:
url: "{{ download_file_url }}"
dest: "{{ download_file_destination }}"
2 changes: 2 additions & 0 deletions roles/download_file/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions roles/download_file/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- download_file

0 comments on commit f8179df

Please sign in to comment.