@ -146,11 +146,20 @@ This command builds a tarball of the collection in the current directory, which
You can upload your tarball to one or more distribution servers. You can also distribute your collection locally by copying the tarball to install your collection directly on target systems.
.._ignoring_files_and_folders_collections:
Ignoring files and folders
--------------------------
You can exclude files from your collection with either :ref:`build_ignore <build_ignore>` or :ref:`manifest_directives`. For more information on the :file:`galaxy.yml` file, see :ref:`collections_galaxy_meta`.
.._build_ignore:
Include all, with explicit ignores
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
By default the build step includes all the files in the collection directory in the tarball except for the following:
* ``galaxy.yml``
@ -175,12 +184,90 @@ For example, to exclude the :file:`sensitive` folder within the ``playbooks`` fo
- playbooks/sensitive
- '*.tar.gz'
For more information on the :file:`galaxy.yml` file, see :ref:`collections_galaxy_meta`.
..note::
The ``build_ignore`` feature is only supported with ``ansible-galaxy collection build`` in Ansible 2.10 or newer.
.._manifest_directives:
Manifest Directives
^^^^^^^^^^^^^^^^^^^
..versionadded:: 2.14
The :file:`galaxy.yml` file supports manifest directives that are historically used in Python packaging, as described in `MANIFEST.in commands <https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands>`_.
..note::
The use of ``manifest`` requires installing the optional ``distlib`` Python dependency.
..note::
The ``manifest`` feature is only supported with ``ansible-galaxy collection build`` in Ansible 2.14 or newer, and is mutually exclusive with ``build_ignore``.
For example, to exclude the :file:`sensitive` folder within the ``playbooks`` folder as well as any ``.tar.gz`` archives, set the following in your :file:`galaxy.yml` file:
..code-block:: yaml
manifest:
directives:
- recursive-exclude playbooks/sensitive **
- global-exclude *.tar.gz
By default, the ``MANIFEST.in`` style directives would exclude all files by default, but there are default directives in place. Those default directives are described below. To see the directives in use during build, pass ``-vvv`` with the ``ansible-galaxy collection build`` command.
``<namespace>-<name>-*.tar.gz`` is expanded with the actual ``namespace`` and ``name``.
The ``manifest.directives`` supplied in :file:`galaxy.yml` are inserted after the default includes and before the default excludes.
To enable the use of manifest directives without supplying your own, insert either ``manifest: {}`` or ``manifest: null`` in the :file:`galaxy.yml` file and remove any use of ``build_ignore``.
If the default manifest directives do not meet your needs, you can set ``manifest.omit_default_directives`` to a value of ``true`` in :file:`galaxy.yml`. You then must specify a full compliment of manifest directives in :file:`galaxy.yml`. The defaults documented above are a good starting point.
Below is an example where the default directives are not included.
- This uses C(fnmatch) to match the files or directories.
- Some directories and files like C(galaxy.yml), C(*.pyc), C(*.retry), and
C(.git) are always filtered.
- Mutually exclusive with C(manifest_directives)
type:list
version_added:'2.10'
- key:manifest
description:
- A dict controlling use of manifest directives used in building the collection artifact.
- The key C(directives) is a list of MANIFEST.in style L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands)
- The key C(omit_default_directives) is a boolean that controls whether the default directives are used