### Run Integration Tests for Pytz Example Source: https://github.com/ansible/ansible-builder/blob/devel/test/data/README.md This command executes integration tests specifically for the 'pytz' example using py.test. ```bash py.test test/integration/test_build.py -k TestPytz ``` -------------------------------- ### Install Ansible Builder from Source (devel branch) Source: https://github.com/ansible/ansible-builder/blob/devel/docs/installation.md Install ansible-builder directly from the main development branch on GitHub. ```shell $ pip3 install https://github.com/ansible/ansible-builder/archive/devel.zip ``` -------------------------------- ### Install Ansible Builder from Source (specific ref) Source: https://github.com/ansible/ansible-builder/blob/devel/docs/installation.md Install ansible-builder from a specific tag or branch by replacing '' with the desired reference. ```shell $ pip3 install https://github.com/ansible/ansible-builder/archive/.zip ``` -------------------------------- ### Install Ansible Builder from PyPI Source: https://github.com/ansible/ansible-builder/blob/devel/docs/installation.md Use this command to install the latest stable version of ansible-builder from the Python Package Index. ```shell $ pip3 install ansible-builder ``` -------------------------------- ### Example Options Section Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md This snippet demonstrates how to configure various runtime options for an Ansible Builder execution environment, including container initialization, package manager path, and image tags. ```yaml options: container_init: package_pip: dumb-init>=1.2.5 entrypoint: '["dumb-init"]' cmd: '["csh"]' package_manager_path: /usr/bin/microdnf relax_passwd_permissions: false skip_ansible_check: true workdir: /myworkdir user: bob tags: - ee_development:latest ``` -------------------------------- ### Install Ansible Development Tools Source: https://github.com/ansible/ansible-builder/blob/devel/docs/installation.md Install the ansible-dev-tools package, which includes ansible-builder and other development utilities. This command also installs ansible-core if it's not already present. ```shell # This also installs ansible-core if it is not already installed $ pip3 install ansible-dev-tools ``` -------------------------------- ### Install Ansible Builder in Development Mode Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Install the project in editable mode within a virtual environment. This is the first step to setting up your development environment. ```bash (ansible-builder) $ pip install -e . ``` -------------------------------- ### Run Example Playbook Outside of Ansible-Runner Source: https://github.com/ansible/ansible-builder/blob/devel/test/data/README.md This command allows you to invoke the example playbook manually using Docker. It mounts the pytz data directory and runs the playbook within the 'exec-env-pytz' container image. ```bash docker run --rm --tty --interactive --mount "type=bind,src=$(pwd)/test/data/pytz,dst=/pytz" exec-env-pytz ansible-playbook -i localhost, /pytz/project/pytz.yml ``` -------------------------------- ### System Package Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Specifies system packages to be installed using bindep format. Can be a filename or a list of requirements. ```yaml system: - "openssl-devel" - "libffi-devel" ``` -------------------------------- ### Ansible Core Pip Installation Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Specifies how to install the ansible-core Python package. Can be a package name, versioned package, or a URL to a tarball. ```yaml ansible_core: package_pip: ansible-core ``` ```yaml ansible_core: package_pip: ansible-core==2.14.3 ``` ```yaml ansible_core: package_pip: https://github.com/example_user/ansible/archive/refs/heads/ansible.tar.gz ``` -------------------------------- ### Introspect Collections in Default Location Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use this command to introspect Ansible collections installed in the default location. No specific setup is required if collections are in the default path. ```bash $ ansible-builder introspect ``` -------------------------------- ### Python Package Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Defines Python installation requirements using PEP 508 format. Can be a filename or a list of requirements. ```yaml python: - requests - "django>=3.0,<4.0" ``` -------------------------------- ### Run pip check in build steps Source: https://github.com/ansible/ansible-builder/blob/devel/docs/scenario_guides/scenario_pip_check.md Add this snippet to your execution environment file to run `pip check` after all dependencies are installed. This ensures dependency compatibility and will fail the build if issues are found. ```yaml additional_build_steps: append_final: - RUN $PYCMD -m pip check ``` -------------------------------- ### Ansible Runner Pip Installation Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Specifies how to install the ansible-runner Python package. Supports package name, versioned package, or a URL to a tarball. ```yaml ansible_runner: package_pip: ansible-runner ``` ```yaml ansible_runner: package_pip: ansible-runner==2.3.2 ``` ```yaml ansible_runner: package_pip: https://github.com/example_user/ansible_runner/archive/refs/heads/ansible-runner.tar.gz ``` -------------------------------- ### Run Linters for Python 3.11 with Tox Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Execute linters for a specific Python version using tox. This ensures code quality and adherence to style guides. ```bash (ansible-builder) $ tox -e linters-py311 ``` -------------------------------- ### Introspect with Custom Path Source: https://github.com/ansible/ansible-builder/blob/devel/docs/collection_metadata.md When collections are installed manually or cloned from git, ensure they follow the `ansible_collections/NAMESPACE/COLLECTION` structure. Then, run `introspect` specifying the base directory containing your collections. ```bash ansible-builder introspect ~/ansible_collections/ ``` -------------------------------- ### Ansible Runner Settings Example Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md This YAML configuration shows how to set variables for an ansible-runner project, specifying the container image, execution executable, and process isolation settings. It is used when integrating a built image into an ansible-runner project. ```yaml --- container_image: image-name process_isolation_executable: podman # or docker process_isolation: true ``` -------------------------------- ### Run Collection Introspection Source: https://github.com/ansible/ansible-builder/blob/devel/docs/collection_metadata.md Use the `ansible-builder introspect` command to verify that collection dependencies will be processed correctly by Ansible Builder. Install the collection locally first, typically using `ansible-galaxy`. ```bash ansible-builder introspect COLLECTION_PATH ``` -------------------------------- ### Introspect Collections in a Specified Folder Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Specify the path to the Ansible collections folder to introspect. The folder must contain an `ansible_collections` subdirectory. This is useful when collections are not in the default installation path. ```bash $ ansible-builder introspect /path/to/collections ``` -------------------------------- ### Create and Build with Galaxy Keyring Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Creates and builds an execution environment, specifying a keyring for `ansible-galaxy` to verify collection signatures. If the keyring is not provided, no signature verification is performed. ```bash $ ansible-builder create --galaxy-keyring=/path/to/pubring.kbx $ ansible-builder build --galaxy-keyring=/path/to/pubring.kbx ``` -------------------------------- ### Build Execution Environment with Custom Definition File Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Builds an execution environment using a specified definition file instead of the default. ```bash $ ansible-builder build --file=my-ee-def.yml ``` -------------------------------- ### Build Execution Environment Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Builds an execution environment using the default definition file. The command outputs a build instruction file, creates a build context, and builds the container image. ```bash $ ansible-builder build Running command: podman build -f context/Containerfile -t ansible-execution-env:latest context Complete! The build context can be found at: /path/to/context ``` -------------------------------- ### Build Execution Environment with Multiple Tags Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Builds an execution environment and applies multiple custom tags to the resulting image. ```bash $ ansible-builder build --tag=tag1 --tag=tag2 ``` -------------------------------- ### Build Execution Environment with Custom Tag Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Builds an execution environment and applies a custom tag to the resulting image. ```bash $ ansible-builder build --tag=my-custom-ee ``` -------------------------------- ### Specify Container Runtime Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Specifies the containerization tool used to build images. The default is Podman. Use `docker` to use Docker. ```bash $ ansible-builder build --container-runtime=docker ``` -------------------------------- ### Build Execution Environment Manually Source: https://github.com/ansible/ansible-builder/blob/devel/test/data/README.md Use this command to build an execution environment manually. Specify the container runtime if using Docker. ```bash ansible-builder build \ -f test/data/pytz/execution-environment.yml \ -c my_new_bc \ -t my_new_tag ``` ```bash ansible-builder build \ -f test/data/pytz/execution-environment.yml \ -c my_new_bc \ -t my_new_tag \ --container-runtime docker ``` -------------------------------- ### Create and Build with Galaxy Keyring and Ignore Signature Status Code Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Creates and builds an execution environment, specifying a keyring for `ansible-galaxy` to verify collection signatures and ignoring specific error status codes during verification. This option is valid only when `--galaxy-keyring` is also set. ```bash $ ansible-builder create --galaxy-keyring=/path/to/pubring.kbx --galaxy-ignore-signature-status-code 500 $ ansible-builder build --galaxy-keyring=/path/to/pubring.kbx --galaxy-ignore-signature-status-code 500 ``` -------------------------------- ### Build and Run with Helper Script Source: https://github.com/ansible/ansible-builder/blob/devel/test/data/README.md Invoke the run.sh script to build and use the image within ansible-runner. This script automates deletion of existing contexts/images, creation of new ones, and running a playbook via ansible-runner. ```bash source test/data/run.sh pytz ``` -------------------------------- ### Detailed Execution Environment Definition (v3) Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md A comprehensive v3 execution environment definition showcasing advanced configurations. It includes build arguments, specific dependency versions, system packages, custom build steps, and additional build files. ```yaml --- version: 3 build_arg_defaults: ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre' dependencies: ansible_core: package_pip: ansible-core==2.14.4 ansible_runner: package_pip: ansible-runner galaxy: requirements.yml python: - six - psutil system: bindep.txt exclude: python: - docker system: - python3-Cython images: base_image: name: docker.io/redhat/ubi9:latest # NOTE: Ansible Builder requires RPM-based images (those using dnf package management). # Other RPM-based base images that should work: # - quay.io/rockylinux/rockylinux:9 # - quay.io/centos/centos:stream9 # - registry.fedoraproject.org/fedora:38 # - registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8:latest # (needs an account) # Non-RPM images (Debian, Ubuntu, Alpine, etc.) are not supported. # Custom package manager path for the RHEL based images # options: # package_manager_path: /usr/bin/microdnf additional_build_files: - src: files/ansible.cfg dest: configs additional_build_steps: prepend_base: - RUN echo This is a prepend base command! # Enable Non-default stream before packages provided by it can be installed. (optional) # - RUN $PKGMGR module enable postgresql:15 -y # - RUN $PKGMGR install -y postgresql prepend_galaxy: - COPY _build/configs/ansible.cfg /etc/ansible/ansible.cfg prepend_final: | RUN whoami RUN cat /etc/os-release append_final: - RUN echo This is a post-install command! - RUN ls -la /etc ``` -------------------------------- ### Write Combined Bindep Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use the `--write-bindep` flag to output all system-level dependencies found across introspected collections to a specified file. This aids in managing system package requirements. ```bash $ ansible-builder introspect --write-bindep=bindep.txt /path/to/collections ``` -------------------------------- ### Run Unit Tests for Python 3.11 with Tox Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Execute unit tests for a specific Python version using tox. This is a standard way to run tests within the project. ```bash (ansible-builder) $ tox -e unit-py311 ``` -------------------------------- ### Pass Build Arguments to Container Engine Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Passes build-time arguments to Podman or Docker, similar to `podman build` or `docker build`. The `EE_BASE_IMAGE` build argument is included by default in the Containerfile. ```bash $ ansible-builder build --build-arg FOO=bar ``` ```bash $ ansible-builder build --build-arg FOO=bar --build-arg SIMPLE=sample ``` ```bash $ ansible-builder build --build-arg EE_BASE_IMAGE=registry.example.com/another-ee ``` -------------------------------- ### Define Execution Environment Dependencies Source: https://github.com/ansible/ansible-builder/blob/devel/docs/collection_metadata.md Specify paths to Python and system package dependency files within a collection's `meta/execution-environment.yml` file. This is the recommended approach for clarity and to avoid conflicts with other uses of default dependency files. ```yaml dependencies: python: meta/ee-requirements.txt system: meta/ee-bindep.txt ``` -------------------------------- ### Simple Execution Environment Definition (v3) Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md A basic v3 execution environment definition. It specifies the base image and core Ansible dependencies. ```yaml --- version: 3 images: base_image: name: docker.io/redhat/ubi9:latest dependencies: ansible_core: package_pip: ansible-core ansible_runner: package_pip: ansible-runner ``` -------------------------------- ### Combine User Bindep Requirements with Collection Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use `--user-bindep` to specify an additional bindep requirements file to merge with collection requirements. This is useful for including custom system-level dependencies. ```bash $ ansible-builder introspect --user-bindep=user-bindep.txt --write-bindep=combined.txt /path/to/collections ``` -------------------------------- ### Specify Dependencies Using Files Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Define dependencies by referencing external files for Python (requirements.txt), system (bindep.txt), and Ansible Galaxy collections (requirements.yml). Also shows how to specify package names and versions for ansible-core, ansible-runner, and the Python interpreter. ```yaml dependencies: python: requirements.txt system: bindep.txt galaxy: requirements.yml ansible_core: package_pip: ansible-core==2.14.2 ansible_runner: package_pip: ansible-runner==2.3.1 python_interpreter: package_system: "python310" python_path: "/usr/bin/python3.10" ``` -------------------------------- ### Pass Extra Build CLI Arguments Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Allows passing additional command line arguments to the container engine build command (`docker build` or `podman build`). Use with caution as conflicts with existing arguments may occur. ```bash $ ansible-builder build --extra-build-cli-args='--pull --env=MY_ENV_VAR' ``` -------------------------------- ### Activate Virtual Environment and Run Single Pytest Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Activate the tox-created virtual environment and run a single, specific test using pytest. Allows for fine-grained control over test execution. ```bash (ansible-builder) $ source .tox/unit-py311/bin/activate (unit-py311) $ pytest -vvv -n1 test/unit/test_main.py::test_defnition_version ``` -------------------------------- ### Copying Files to EE with Ansible Builder v3 Schema Source: https://github.com/ansible/ansible-builder/blob/devel/docs/scenario_guides/scenario_copy.md This snippet demonstrates how to copy arbitrary files into an EE build context and then use them in subsequent build steps. The `additional_build_files` section copies a file to the build context, and `additional_build_steps` uses a `COPY` directive to move it into the image and a `RUN` command to update the CA trust store. ```yaml --- version: 3 images: base_image: name: quay.io/centos/centos:stream9 # vanilla image dependencies: # Use Python 3.9 python_interpreter: package_system: python39 python_path: /usr/bin/python3.9 # Collections to be installed galaxy: collections: - ansible.utils additional_build_files: # copy arbitrary files next to this EE def into the build context - we can refer to them later... - src: files/rootCA.crt dest: configs additional_build_steps: prepend_base: # copy a custom CA cert into the base image and recompute the trust database # because this is in "base", all stages will inherit (including the final EE) - COPY _build/configs/rootCA.crt /usr/share/pki/ca-trust-source/anchors - RUN update-ca-trust ``` -------------------------------- ### Prepare Virtual Environment for Single Test Execution Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Use tox to build the virtual environment for a specific test suite without running tests. This is a prerequisite for running pytest directly. ```bash (ansible-builder) $ tox -e unit-py311 --notest ``` -------------------------------- ### Ansible Builder EE Definition with Galaxy Environment Variables Source: https://github.com/ansible/ansible-builder/blob/devel/docs/scenario_guides/scenario_custom.md This snippet demonstrates an Ansible Builder version 3 EE definition that configures custom Galaxy server settings using environment variables. It shows how to specify collections, set Galaxy server URLs, and pass authentication tokens securely using ARG directives. ```yaml --- version: 3 images: base_image: # Needs login name: registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8:latest dependencies: # No need to specify ansible-core or ansible-runner dependencies # because they are included in the base image. # Collections to be installed using Galaxy galaxy: collections: - ansible.utils additional_build_steps: prepend_galaxy: # Environment variables used for Galaxy client configurations - ENV ANSIBLE_GALAXY_SERVER_LIST=automation_hub - ENV ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_URL=https://console.redhat.com/api/automation-hub/content/xxxxxxx-synclist/ - ENV ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_AUTH_URL=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token # define a custom build arg env passthru - we still also have to pass # `--build-arg ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN` to get it to pick it up from the env - ARG ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN options: package_manager_path: /usr/bin/microdnf # downstream images use non-standard package manager ``` -------------------------------- ### Specify and Use Environment Variable in EE Build Source: https://github.com/ansible/ansible-builder/blob/devel/docs/scenario_guides/scenario_using_env.md This snippet shows how to define an environment variable (`FOO=bar`) and then use it in a subsequent build step (`RUN echo $FOO > /tmp/file1.txt`) within the `prepend_base` section of an Ansible Builder EE definition. ```yaml --- version: 3 images: base_image: name: quay.io/centos/centos:stream9 dependencies: python_interpreter: package_system: python39 python_path: /usr/bin/python3.9 ansible_core: package_pip: ansible-core==2.14.0 ansible_runner: package_pip: ansible-runner==2.3.2 additional_build_steps: prepend_base: - ENV FOO=bar - RUN echo $FOO > /tmp/file1.txt ``` -------------------------------- ### Pass Secret ID and Source File via CLI Source: https://github.com/ansible/ansible-builder/blob/devel/docs/scenario_guides/scenario_secret_passing.md Use the `--extra-build-cli-args` option to pass a build CLI argument that defines the secret ID and its source file. ```bash ansible-builder build --extra-build-cli-args="--secret id=mytoken,src=my_secret_file.txt" ``` -------------------------------- ### Control Image Layer Squashing Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Controls the final image layer squashing. Valid values are `new`, `all`, or `off`. This flag is compatible only with the `podman` runtime. ```bash # Example for 'new' or 'all' squashing would be similar, specifying the value. # Default is 'off'. ``` -------------------------------- ### Specify Dependencies Using Inline Values Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Define dependencies directly within the configuration for Python packages, system packages with platform-specific matching, and Ansible Galaxy collections with versioning. Also shows how to specify package names and versions for ansible-core, ansible-runner, and the Python interpreter. ```yaml dependencies: python: - pywinrm system: - iputils [platform:rpm] galaxy: collections: - name: community.windows - name: ansible.utils version: 2.10.1 ansible_core: package_pip: ansible-core==2.14.2 ansible_runner: package_pip: ansible-runner==2.3.1 python_interpreter: package_system: "python310" python_path: "/usr/bin/python3.10" ``` -------------------------------- ### Combine User Pip Requirements with Collection Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use `--user-pip` to specify an additional pip requirements file to merge with collection requirements. This allows inclusion of custom Python dependencies. ```bash $ ansible-builder introspect --user-pip=user-requirements.txt --write-pip=combined.txt /path/to/collections ``` -------------------------------- ### Run Destructive Integration Tests with Tox Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Run integration tests that may modify the container runtime environment. Requires a special flag to enable. ```bash (ansible-builder) $ tox -e integration-py311 -- --run-destructive ``` -------------------------------- ### Write Combined Pip Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use the `--write-pip` flag to output all Python dependencies found across introspected collections to a specified file. This is helpful for managing project-wide Python dependencies. ```bash $ ansible-builder introspect --write-pip=requirements.txt /path/to/collections ``` -------------------------------- ### Excluding System Dependencies Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Excludes specific system dependencies by simple name matching or regular expression matching. ```yaml exclude: system: - "openssl-devel" - "~libxml2.*" ``` -------------------------------- ### Exclude Specific Bindep Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use `--exclude-bindep-reqs` with a file containing system package names to exclude them from the final bindep requirements output. This is useful for managing system dependencies. ```bash $ ansible-builder introspect --exclude-bindep-reqs=exclude.txt --write-bindep=filtered.txt /path/to/collections ``` -------------------------------- ### Reference Secret in EE Definition Source: https://github.com/ansible/ansible-builder/blob/devel/docs/scenario_guides/scenario_secret_passing.md Define additional build steps in the EE definition file to mount and use the secret. The secret is accessed via `/run/secrets/`. ```yaml --- version: 3 images: base_image: name: quay.io/centos/centos:stream9 additional_build_steps: prepend_base: - RUN --mount=type=secret,id=mytoken TOKEN=$(cat /run/secrets/mytoken) some_command options: skip_ansible_check: true ``` -------------------------------- ### Specify Build Context Directory Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Specifies the directory name for the build context Ansible Builder creates. The default directory name is `context` in the current working directory. ```bash $ ansible-builder build --context=/path/to/dir ``` -------------------------------- ### Excluding All Dependencies from Collections Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Excludes all Python and system dependencies from specified collections. ```yaml exclude: all_from_collections: - "community.general" - "ansible.posix" ``` -------------------------------- ### Exclude Requirements from Specific Collections Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use `--exclude-collection-reqs` with a file listing collection names to exclude all their requirements from the final output. This allows fine-grained control over which collection dependencies are included. ```bash $ ansible-builder introspect --exclude-collection-reqs=collections-to-skip.txt /path/to/collections ``` -------------------------------- ### Skip Docker Runtime in Integration Tests Source: https://github.com/ansible/ansible-builder/blob/devel/CONTRIBUTING.md Execute integration tests while skipping a specific container runtime, such as Docker. Uses the --skip-runtime pytest option. ```bash (ansible-builder) $ tox -e integration-py311 -- --skip-runtime docker ``` -------------------------------- ### Excluding Python Dependencies Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Excludes specific Python dependencies by simple name matching or regular expression matching. ```yaml exclude: python: - "requests" - "~urllib3.*" ``` -------------------------------- ### Set Verbosity Level Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Customizes the level of verbosity for the build process. Can be set with an integer or by repeating the `-v` flag. ```bash $ ansible-builder build --verbosity 2 ``` ```bash $ ansible-builder build -v 3 ``` ```bash $ ansible-builder build -vvv ``` ```bash $ ansible-builder build -v -v -v ``` -------------------------------- ### Exclude Specific Pip Requirements Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Use `--exclude-pip-reqs` with a file containing Python package names to exclude them from the final pip requirements output. This helps in filtering out unwanted dependencies. ```bash $ ansible-builder introspect --exclude-pip-reqs=exclude.txt --write-pip=filtered.txt /path/to/collections ``` -------------------------------- ### Include Ignored Python Packages Source: https://github.com/ansible/ansible-builder/blob/devel/docs/collection_metadata.md Use the `--user-pip` option with the `introspect` command to include Python packages that are normally ignored by Ansible Builder (e.g., test packages). These packages are added to a user requirements file and bypass the exclusion list. ```bash ansible-builder introspect --user-pip COLLECTION_PATH ``` -------------------------------- ### Prune Unused Images Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Removes unused images created after the build process. This flag removes all dangling images on the machine, whether they existed prior to the build or were created by `ansible-builder`. ```bash $ ansible-builder build --prune-images ``` -------------------------------- ### Set Required Galaxy Signature Count Source: https://github.com/ansible/ansible-builder/blob/devel/docs/usage.md Overrides the number of required valid collection signatures. This option is passed unmodified to `ansible-galaxy` calls and is valid only when `--galaxy-keyring` is also set. ```bash $ ansible-builder create --galaxy-keyring=/path/to/pubring.kbx --galaxy-required-valid-signature-count 3 $ ansible-builder build --galaxy-keyring=/path/to/pubring.kbx --galaxy-required-valid-signature-count 3 ``` -------------------------------- ### Exclude Dependencies in Ansible Builder Source: https://github.com/ansible/ansible-builder/blob/devel/docs/definition.md Use the 'exclude' option to prevent specific system, Python, or collection dependencies from being included. Requires ansible-builder version 3.1 or newer. ```yaml dependencies: exclude: python: - docker system: - python3-Cython all_from_collections: # Regular expression to exclude all from community collections - ~community\..+ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.