2019-10-11 20:19:44 +02:00
|
|
|
|
|
|
|
|
2020-01-07 20:57:47 +01:00
|
|
|
By default, ``ansible-galaxy collection install`` uses https://galaxy.ansible.com as the Galaxy server (as listed in the
|
|
|
|
:file:`ansible.cfg` file under :ref:`galaxy_server`). You do not need any
|
|
|
|
further configuration.
|
|
|
|
|
|
|
|
See :ref:`Configuring the ansible-galaxy client <galaxy_server_config>` if you are using any other Galaxy server, such as Red Hat Automation Hub.
|
2019-11-15 16:49:51 +01:00
|
|
|
|
2019-10-11 20:19:44 +02:00
|
|
|
To install a collection hosted in Galaxy:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
ansible-galaxy collection install my_namespace.my_collection
|
|
|
|
|
|
|
|
You can also directly use the tarball from your build:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
ansible-galaxy collection install my_namespace-my_collection-1.0.0.tar.gz -p ./collections
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
The install command automatically appends the path ``ansible_collections`` to the one specified with the ``-p`` option unless the
|
|
|
|
parent directory is already in a folder called ``ansible_collections``.
|
|
|
|
|
|
|
|
|
|
|
|
When using the ``-p`` option to specify the install path, use one of the values configured in :ref:`COLLECTIONS_PATHS`, as this is
|
|
|
|
where Ansible itself will expect to find collections. If you don't specify a path, ``ansible-galaxy collection install`` installs
|
|
|
|
the collection to the first path defined in :ref:`COLLECTIONS_PATHS`, which by default is ``~/.ansible/collections``
|
|
|
|
|
|
|
|
You can also keep a collection adjacent to the current playbook, under a ``collections/ansible_collections/`` directory structure.
|
|
|
|
|
|
|
|
.. code-block:: text
|
|
|
|
|
2020-01-21 16:20:37 +01:00
|
|
|
./
|
|
|
|
├── play.yml
|
2019-10-11 20:19:44 +02:00
|
|
|
├── collections/
|
|
|
|
│ └── ansible_collections/
|
|
|
|
│ └── my_namespace/
|
|
|
|
│ └── my_collection/<collection structure lives here>
|
|
|
|
|
|
|
|
|
|
|
|
See :ref:`collection_structure` for details on the collection directory structure.
|