diff --git a/roles/download_file/README.md b/roles/download_file/README.md index 16934c5..139327f 100644 --- a/roles/download_file/README.md +++ b/roles/download_file/README.md @@ -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 @@ -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 diff --git a/roles/download_file/defaults/main.yml b/roles/download_file/defaults/main.yml index f2744c0..ff81257 100644 --- a/roles/download_file/defaults/main.yml +++ b/roles/download_file/defaults/main.yml @@ -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 diff --git a/roles/download_file/tasks/main.yml b/roles/download_file/tasks/main.yml index 105f826..78305c3 100644 --- a/roles/download_file/tasks/main.yml +++ b/roles/download_file/tasks/main.yml @@ -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 }}"