Home / How to install and use Ansible collections from Ansible Galaxy having no internet access?

How to install and use Ansible collections from Ansible Galaxy having no internet access?

Download the relevant collections’ tarballs from Automation Hub or Ansible Galaxy on a system connected to the internet.

You must now do the following actions on each of the Tower nodes:

Make a directory for collections, like /opt/collections/

# mkdir /opt/collections/

Change the file’s permissions and group ownership for the sei user as follows.

# chown sei:sei /opt/collections/ [i.e drwxr-xr-x. 2 sei sei 9 Jan 9 09:08 collections]

Modify the collections paths parameter in /etc/ansible/ansible.cfg to include the following.

[defaults]
collections_paths = /opt/collections/

To install the tarball, move the archive to the Tower node’s /opt/collections/ directory.

Install the collection on your Tower node using the sei user by running the below command.

# su sei -

$ ansible-galaxy collection install /opt/collections/<name_of_collection>.tar.gz -p /opt/collections/

If you don’t want to change the /etc/ansible/ansible.cfg file, you may also create an ansible.cfg file in the project directory’s root of the SCM and change the collections path.

Leave a Reply