1

I know that you can setup proxy in Ansible to provision behind corporate network: https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html

like this:

environment:
    http_proxy: http://proxy.example.com:8080

Unfortunately in my case there is no access to internet from the server at all. Downloading roles locally and putting them under /roles folder seems solve the role issue, but roles still download packages from the internet when using:

package:
   name: package-name
   state: present

I guess there is no way to make dry/pre run so Ansible downloads all the packages, then push that into repo and run Ansible provision using locally downloaded packages?

Maksim Luzik
  • 5,863
  • 4
  • 36
  • 57

3 Answers3

2

This isn't really a question about Ansible, as all Ansible is doing is running the relevant package management system on the target host (i.e. yum, dnf or apt or whatever). So it is a question of what solution the specific package management tool provides, for this case.

There are a variety of solutions and for example in the Centos/RHEL world you can:

There is another class of tool generally called an artefact repository. These started out life as tools to store binaries built from code, but have added a bunch of features to act as a proxy and cache packages from a wide variety of sources (OS Packages, PIP, NodeJS, Docker, etc). Two examples that have limited free offerings:

They of course still need to collect those packages from a source, so at some point those are going to have to be downloaded to placed within these systems.

clockworknet
  • 2,736
  • 1
  • 15
  • 19
1

Like clockworknet pointed out this is more related to the RHEL package handling. Setting up local mirror somewhere inside the closed network can provide a solution in this situation. More info on "How to create a local mirror of the latest update for Red Hat Enterprise Linux 5, 6, 7 without using Satellite server?": https://access.redhat.com/solutions/23016

Maksim Luzik
  • 5,863
  • 4
  • 36
  • 57
0

My solution:

note: did that for APT and works fine, would expect the same for yum

Markus
  • 1,887
  • 18
  • 23