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?


  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?

1 Answer 1


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.

  • Just a follow up question if I may please. If I download the binary to master node myself, should I explicitly copy the files to all the target nodes before running the installation steps (using the binaries)? In other words, before using the binary to do the installation, should the binary be copied to target nodes? or will sensible do it automatically (it senses that the binaries on master node are needed for the installation to proceed on the target nodes and so it will copy them automatically for us)?
    – Biju
    Commented Feb 5, 2021 at 10:02
  • @Biju Automation is not magic. And you are the automator. If you want the file on the target node, you have to do something that causes it to be placed there. Commented Feb 5, 2021 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .