2.3. 정의 파일 빌드
Ansible Builder를 설치한 후 Ansible Builder에서 자동화 실행 환경 이미지를 생성하는 데 사용하는 정의 파일을 생성할 수 있습니다. Ansible Builder는 정의 파일을 읽고 검증한 다음
을 생성한 다음, 마지막으로 컨테이너 파일을 Podman에 전달하여 자동화 실행 환경 이미지를 패키지하고 자동화 실행 환경 이미지를 생성하여 자동화 실행 환경 이미지를 만듭니다. 생성하는 정의 파일은 Containerfile
yaml
형식이어야 하며 다른 섹션이 포함되어 있어야 합니다. 기본 정의 파일 이름은 제공되지 않는 경우 execution-environment.yml
입니다. 정의 파일의 부분에 대한 자세한 내용은 정의 파일 콘텐츠 분리를 참조하십시오.
다음은 버전 3 정의 파일의 예입니다. 각 정의 파일은 사용하는 Ansible Builder 기능 세트의 주요 버전 번호를 지정해야 합니다. 지정하지 않는 경우 Ansible Builder는 기본적으로 버전 1로 설정되므로 대부분의 새로운 기능과 정의 키워드를 사용할 수 없습니다.
예 2.1. 정의 파일 예
version: 3 build_arg_defaults: ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre' dependencies: galaxy: requirements.yml python: - six - psutil system: bindep.txt images: base_image: name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest # Custom package manager path for the RHEL based images options: package_manager_path: /usr/bin/microdnf additional_build_steps: prepend_base: - RUN echo This is a prepend base command! 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 prepend_final: | RUN whoami RUN cat /etc/os-release append_final: - RUN echo This is a post-install command! - RUN ls -la /etc
version: 3
build_arg_defaults:
ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre'
dependencies:
galaxy: requirements.yml
python:
- six
- psutil
system: bindep.txt
images:
base_image:
name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel9:latest
# Custom package manager path for the RHEL based images
options:
package_manager_path: /usr/bin/microdnf
additional_build_steps:
prepend_base:
- RUN echo This is a prepend base command!
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
prepend_final: |
RUN whoami
RUN cat /etc/os-release
append_final:
- RUN echo This is a post-install command!
- RUN ls -la /etc
추가 리소스
- 정의 파일 콘텐츠에 대한 자세한 내용은 정의 파일 콘텐츠 분리를 참조하십시오.
- Ansible Builder 버전 2와 3의 차이점에 대한 자세한 내용은 Ansible 3 포트 지정 가이드를 참조하십시오.