Reputation: 97447
I'm having two machines. One is the Ansible Controller where I execute my playbooks from and the other one is the Remote Machine (target
) which I would like to install/update. The important thing is that the Controller runs within the corporate network but the target
is outside that network (only accessible via ssh).
So I need to download a file (from within the corporate network) and copy it to the target
node.
I've tried to use: ansible.builtin.get_url
to download the file but unfortunately it will do that on the Remote (target
) Machine which has of course no access to the corporate network.
Does someone has a tip/idea?
Update: Using ansible [core 2.11.6]
Upvotes: 8
Views: 7098
Reputation: 12083
To download something to the local Ansible Controller you may use the following approach.
- name: Download something to Ansible Controller
delegate_to: localhost
get_url:
url: "https://{{ ansible_user }}:{{ ansible_password }}@files.example.com/installer.rpm"
dest: "/tmp/{{ ansible_user }}"
owner: "{{ ansible_user }}"
tags: download,local
Please take note that according Controlling where tasks run: delegation and local actions, delegate_to
is not a parameter of module get_url
but of the task.
Upvotes: 12