3.5. 사용자 정의 실행 환경 정의 생성
Ansible Builder를 설치한 경우 다음 단계를 사용하여 사용자 지정 실행 환경을 생성합니다.
프로세스
사용자 정의 실행 환경 빌드 아티팩트를 저장할 디렉터리를 생성합니다. 다음 단계로 생성된 새 파일은 이 디렉터리에 생성됩니다.
$ mkdir $HOME/custom-ee $HOME/custom-ee/files $ cd $HOME/custom-ee/사용자 정의 실행 환경에 대한 요구 사항을 정의하는
execution-environment.yml파일을 생성합니다.참고실행 환경 정의 형식의 버전 3이 필요하므로 계속하기 전에
execution-environment.yml파일에버전 3이 명시적으로 포함되어 있는지 확인합니다.- 프라이빗 자동화 허브에서 사용할 수 있는 최소 실행 환경을 가리키도록 기본 이미지를 재정의합니다.
빌드 프로세스에서 사용할 연결이 끊긴 콘텐츠 소스를 가리키는 데 필요한 추가 빌드 파일을 정의합니다. 사용자 정의
execution-environment.yml파일은 다음 예와 유사해야 합니다.version: 3 images: base_image: name: private-hub.example.com/ee-minimal-rhel8:latest dependencies: python: requirements.txt galaxy: requirements.yml additional_build_files: - src: files/ansible.cfg dest: configs - src: files/pip.conf dest: configs - src: files/hub-ca.crt dest: configs # uncomment if custom RPM repositories are required #- src: files/custom.repo # dest: configs additional_build_steps: prepend_base: # copy a custom pip.conf to override the location of the PyPI content - ADD _build/configs/pip.conf /etc/pip.conf # remove the default UBI repository definition - RUN rm -f /etc/yum.repos.d/ubi.repo # copy the hub CA certificate and update the trust store - ADD _build/configs/hub-ca.crt /etc/pki/ca-trust/source/anchors - RUN update-ca-trust # if needed, uncomment to add a custom RPM repository configuration #- ADD _build/configs/custom.repo /etc/yum.repos.d/custom.repo prepend_galaxy: - ADD _build/configs/ansible.cfg ~/.ansible.cfg ...
개인 자동화 허브를 가리키는
files/하위 디렉터리에ansible.cfg파일을 생성합니다.$ cat files/ansible.cfg [galaxy] server_list = private_hub [galaxy_server.private_hub] url = /https://private-hub.example.com/api/galaxy/내부 PyPI 미러(웹 서버 또는 Nexus와 같은 항목)를 가리키는
files/하위 디렉터리에pip.conf파일을 생성합니다.$ cat files/pip.conf [global] index-url = https://<pypi_mirror_fqdn>/ trusted-host = <pypi_mirror_fqdn>선택 사항:
bindep.txt파일을 사용하여 RPM을 사용자 지정 실행 환경을 추가하는 경우, 연결이 끊긴 Satellite 또는 RPM 리포지토리를 호스팅하는 다른 위치를 가리키는files/하위 디렉터리에custom.repo파일을 만듭니다. 이 단계가 필요한 경우custom.repo파일에 해당하는execution-environment.yml파일의 단계 주석을 제거합니다.다음 예제는 UBI 리포지토리를 위한 것입니다. 다른 로컬 리포지토리도 이 파일에 추가할 수 있습니다. 웹 서버에 미러 콘텐츠가 있는 위치에 따라 URL 경로를 변경해야 할 수 있습니다.
$ cat files/custom.repo [ubi-8-baseos] name = Red Hat Universal Base Image 8 (RPMs) - BaseOS baseurl = http://<ubi_mirror_fqdn>/repos/ubi-8-baseos enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1 [ubi-8-appstream] name = Red Hat Universal Base Image 8 (RPMs) - AppStream baseurl = http://<ubi_mirror_fqdn>/repos/ubi-8-appstream enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1프라이빗 자동화 허브 웹 서버 인증서에 서명하는 데 사용되는 CA 인증서를 추가합니다. 프라이빗 자동화 허브에서 설치 프로그램에서 제공하는 자체 서명된 인증서를 사용하는 경우:
-
개인 자동화 허브에서
/etc/pulp/certs/pulp_webserver.crt파일을 복사하여 이름을hub-ca.crt로 지정합니다. -
hub-ca.crt파일을files/하위 디렉터리에 추가합니다.
-
개인 자동화 허브에서
프라이빗 자동화 허브에서 인증 기관에서 서명한 사용자 제공 인증서를 사용하는 경우:
-
해당 CA 인증서의 사본을 만들고 이름을
hub-ca.crt로 지정합니다. -
hub-ca.crt파일을files/'하위 디렉터리에 추가합니다.
-
해당 CA 인증서의 사본을 만들고 이름을
이전 단계를 완료하면 사용자 정의 실행 환경 이미지에 필요한 콘텐츠를 사용하여 python
requirements.txt및 ansible collectionrequirements.yml파일을 생성합니다.참고필요한 컬렉션은 이미 프라이빗 자동화 허브에 업로드해야 합니다.
다음 파일은
bindep.txt및files/custom.repo가 선택인custom-ee/디렉터리에 있어야 합니다.$ cd $HOME/custom-ee $ tree . . ├── bindep.txt ├── execution-environment.yml ├── files │ ├── ansible.cfg │ ├── custom.repo │ ├── hub-ca.crt │ └── pip.conf ├── requirements.txt └── requirements.yml 1 directory, 8 files