I am relatively new to Ansible. I need to use Ansible from a dev laptop to set up some servers (both Ubuntu and Centos) that are isolated without any Internet access. The laptop has Internet access for development and it can ssh into these servers.
I wonder what’s the best practice in this case. I am trying to avoid setting a mirror repo on the laptop. I am also trying to avoid manually figuring out all the packages along with their dependencies. Is there any way that Ansbile modules (such as yum or apt) can help to download and assemble all packages on the laptop and then copy and install them on the servers?
Usually with servers in a protected setup without direct access you have
internal repository servers, that will carry the packages for your servers.
But you could fire up such a repository on your own laptop and configure the
servers to connect to your laptop. For RPM based distributions like CentOS
have a look into the createrepo command. "createrepo --update ." inside a
directory containing an rpm file will create the necessary infrastructure.
If you expose this directory using a webserver you're all done. Now you can
use ansibles yum_repository command like:
And you are ready and setup to install software from this ..
For a one shot operation this may be possible, but for larger setups I would
recommend to install a repository server that your servers can connect to.
Btw. for debian packages for Ubuntu this would work in similar ways. Ansible
has an apt_repository module for a longer time than the yum_repository one.