Will Ansible download binaries on master node or on target nodes?

While installing OpenJDK using Ansible, the binaries are downloaded from Redhat repos.

SO I had a doubt, if I need to install OpenJDK on 100 target nodes, will Ansible

  1. Download the binaries once on master node and push them to the target nodes?

or

  1. Download the binaries separately on each of the 100 target nodes?

Approach #1 eliminates the redundancy of downloading the same binaries on 100 nodes and just downloads them once

But it also has the con of having to push the binaries to 100 nodes - this might be time consuming and might involve network latency as well.

Q1. Which approach does Ansible take (#1 or #2 mentioned above)? Q2. Also would Ansible allow us to choose between the 2 approaches above?


You choose which way you want to do it.

If you want to copy a file from a source URL directly to each node, you will use the get_url module. You may want to do this if all your nodes are at diverse locations and/or your bandwidth is unlimited or cheap.

If you want to copy a file from your control node to each node, you will use the copy module. You may want to do this if all your nodes are at the same premises as the control node and/or your bandwidth is limited or expensive.

You can also use get_url to download a file to your control node for distribution to your nodes by running the play as a local_action.