Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 3.87 KB

ansiblegalaxy_user_documentation.md

File metadata and controls

64 lines (41 loc) · 3.87 KB

Overview

Ansible Galaxy provides a way to install community collections and roles for Ansible.

Full documentation on installing ansible-galaxy can be found on the Ansible Galaxy project website.

You can create a proxy repository in Nexus Repository Manager (NXRM) that will cache packages from a remote Ansible Galaxy repository, like https://galaxy.ansible.com/. Then, you can make the ansible-galaxy client use your Nexus Repository Proxy instead of the remote repository.

Installation

See installing the plugin.

Repository configuration

To proxy an Ansible Galaxy repository, you simply create a new 'ansiblegalaxy (proxy)' as documented in Repository Management in detail. Minimal configuration steps are:

  • Define 'Name' - e.g. ansiblegalaxy-proxy
  • Define URL for 'Remote storage' - e.g. https://galaxy.ansible.com/
  • Select a Blob store for Storage

Configuring the ansible-galaxy client

You must set the Galaxy API endpoint/server when using the client, either by:

  • provide the -s API_SERVER or --server API_SERVER argument for each installation command.
  • configure GALAXY_SERVER configuration value or ANSIBLE_GALAXY_SERVER environment variable.

See the following resources for additional detail:

Usage

Using the ansible-galaxy client, you can now download packages from your NXRM Ansible Galaxy proxy:

ansible-galaxy collection install azure.azcollection -s http://localhost:8081/repository/ansible/

The command above tells ansible-galaxy to fetch (and install) packages from your NXRM Ansible Galaxy proxy. The NXRM Ansible Galaxy proxy will download any missing packages from the remote Ansible Galaxy repository, and cache the packages on the NXRM Ansible Galaxy proxy. The next time any client requests the same package from your NXRM Ansible Galaxy proxy, the already cached package will be returned to the client.

Role installation support

Due to a bug in Ansible prior to version 2.12, ansible-galaxy would download roles directly from Github.com, even if the download_url for the role specified a different location. This resulted in artifacts not being downloaded through Nexus when using this repository format.

The fix was merged and released in Ansible 2.12.0. Please be sure to use version 2.12.0 (or later) to avoid the issue, or adjust your infrastructure accordingly.