Copying arbitrary files to EE

Ansible Builder version 3 schema provides the option to copy files to an EE image. See the version 3 schema for more details.

In the example below, we will take a look at copying arbitrary files to an execution environment.

version: 3

    name:  # vanilla image

  # Use Python 3.9
    package_system: python39
    python_path: /usr/bin/python3.9
  # Collections to be installed
      - ansible.utils

  # copy arbitrary files next to this EE def into the build context - we can refer to them later...
  - src: files/rootCA.crt
    dest: configs

    # 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

In this example, the additional_build_files section allows you to add rootCA.crt to the build context directory. Once this file is copied to the build context directory, it can be used in the build process. In order to use, the file, we need to copy it from the build context directory using the COPY directive specified in the prepend_base step of additional_build_steps section.

Finally, you can perform any action based upon the copied file, such as in this example updating dynamic configuration of CA certificates by running RUN update-ca-trust.

See also

Execution Environment Definition version 3

The detailed documentation about EE definition version 3