4.12. ansible-builder RPM 설치
절차
RHEL 시스템에서 ansible-builder RPM을 설치합니다. 이 작업은 여러 가지 방법 중 하나로 수행할 수 있습니다.
- 연결되지 않은 네트워크의 Satellite에 RHEL 박스를 서브스크립션합니다.
- Ansible Automation Platform 서브스크립션을 연결하고 AAP 리포지터리를 활성화합니다.
ansible-builder RPM을 설치합니다.
참고기본 빌드 호스트가 등록된 경우 EE 이미지가 Satellite의 RHEL 콘텐츠를 활용할 수 있기 때문에 Satellite가 존재하는 경우 선호됩니다.
- AAP 설정 번들의 압축을 해제합니다.
포함된 콘텐츠의 ansible-builder RPM 및 해당 종속 항목을 설치합니다.
$ tar -xzvf ansible-automation-platform-setup-bundle-2.3-1.2.tar.gz $ cd ansible-automation-platform-setup-bundle-2.3-1.2/bundle/el8/repos/ $ sudo yum install ansible-builder-1.2.0-1.el9ap.noarch.rpm python38-requirements-parser-0.2.0-4.el9ap.noarch.rpm
사용자 정의 EE 빌드 아티팩트용 디렉터리를 생성합니다.
$ mkdir custom-ee $ cd custom-ee/
https://ansible-builder.readthedocs.io/en/stable/definition/ 의 설명서에 따라 사용자 지정 EE에 대한 요구 사항을 정의하는 execution-environment.yml 파일을 생성합니다. 개인 자동화 허브에서 사용 가능한 EE를 가리키도록
EE_BASE_IMAGE및EE_BUILDER_IMAGE변수를 재정의합니다.$ cat execution-environment.yml --- version: 1 build_arg_defaults: EE_BASE_IMAGE: '<hub_fqdn>/ee-supported-rhel8:latest' EE_BUILDER_IMAGE: '<hub_fqdn>/ansible-builder-rhel8:latest' dependencies: python: requirements.txt galaxy: requirements.yml
개인 자동화 허브를 가리키는 ansible.cfg 파일을 만들고 admin 사용자 토큰과 같이 업로드할 수 있는 자격 증명이 포함되어 있습니다.
$ cat ansible.cfg [galaxy] server_list = private_hub [galaxy_server.private_hub] url=https://<hub_fqdn>/api/galaxy/ token=<admin_token>
연결이 끊긴 UBI 리포지터리 미러를 가리키는 ubi.repo 파일을 만듭니다( UBI 콘텐츠가 호스팅되는 경우 Satellite가 제공될 수 있음).
다음은
reposync가 UBI 리포지터리를 미러링하는 데 사용된 출력 예입니다.$ cat ubi.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/root.crt 파일 사본을 만들고 이름을 hub-root.crt 로 지정합니다.
- 개인 자동화 허브 웹 서버 인증서를 요청하고 서명하는 데 내부 인증 기관을 사용한 경우 hub-root.crt 라는 CA 인증서의 사본을 만듭니다.
- 사용자 지정 EE 이미지에 필요한 콘텐츠를 사용하여 python requirements.txt 및 ansible collection requirements.yml을 생성합니다. 필요한 모든 컬렉션은 이미 프라이빗 자동화 허브에 업로드되어야 합니다.
ansible-builder를 사용하여 EE 이미지를 빌드하는 데 사용되는 컨텍스트 디렉터리를 생성합니다.
$ ansible-builder create Complete! The build context can be found at: /home/cloud-user/custom-ee/context $ ls -1F ansible.cfg context/ execution-environment.yml hub-root.crt pip.conf requirements.txt requirements.yml ubi.repo
인터넷 관련 기본값을 컨텍스트 디렉터리로 덮어쓰는 데 사용되는 파일을 복사합니다.
$ cp ansible.cfg hub-root.crt pip.conf ubi.repo context/
파일 컨텍스트/Containerfile 을 편집하고 다음 수정 사항을 추가합니다.
-
첫 번째 EE_BASE_IMAGE 빌드 섹션에서 ansible.cfg 및 hub-root.crt 파일을 추가하고
update-ca-trust명령을 실행합니다. - EE_BUILDER_IMAGE 빌드 섹션에서 ubi.repo 및 pip.conf 파일을 추가합니다.
최종 EE_BASE_IMAGE 빌드 섹션에서 ubi.repo 및 pip.conf 파일을 추가합니다.
$ cat context/Containerfile ARG EE_BASE_IMAGE=<hub_fqdn>/ee-supported-rhel8:latest ARG EE_BUILDER_IMAGE=<hub_fqdn>/ansible-builder-rhel8:latest FROM $EE_BASE_IMAGE as galaxy ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS= USER root ADD _build /build WORKDIR /build # this section added ADD ansible.cfg /etc/ansible/ansible.cfg ADD hub-root.crt /etc/pki/ca-trust/source/anchors/hub-root.crt RUN update-ca-trust # end additions RUN ansible-galaxy role install -r requirements.yml \ --roles-path /usr/share/ansible/roles RUN ansible-galaxy collection install \ $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml \ --collections-path /usr/share/ansible/collections FROM $EE_BUILDER_IMAGE as builder COPY --from=galaxy /usr/share/ansible /usr/share/ansible ADD _build/requirements.txt requirements.txt RUN ansible-builder introspect --sanitize \ --user-pip=requirements.txt \ --write-bindep=/tmp/src/bindep.txt \ --write-pip=/tmp/src/requirements.txt # this section added ADD ubi.repo /etc/yum.repos.d/ubi.repo ADD pip.conf /etc/pip.conf # end additions RUN assemble FROM $EE_BASE_IMAGE USER root COPY --from=galaxy /usr/share/ansible /usr/share/ansible # this section added ADD ubi.repo /etc/yum.repos.d/ubi.repo ADD pip.conf /etc/pip.conf # end additions COPY --from=builder /output/ /output/ RUN /output/install-from-bindep && rm -rf /output/wheels
-
첫 번째 EE_BASE_IMAGE 빌드 섹션에서 ansible.cfg 및 hub-root.crt 파일을 추가하고
podman명령을 사용하여 로컬 podman 캐시에 EE 이미지를 만듭니다.$ podman build -f context/Containerfile \ -t <hub_fqdn>/custom-ee:latest사용자 지정 EE 이미지가 성공적으로 빌드되면 프라이빗 자동화 허브로 푸시합니다.
$ podman push <hub_fqdn>/custom-ee:latest
4.12.1. 마이너 AAP 릴리스 간 업그레이드를 위한 워크플로
AAP 2의 마이너 릴리스 간에 업그레이드하려면 이 일반 워크플로를 사용하십시오.
절차
- 최신 AAP 2 설정 번들을 다운로드하여 압축을 해제합니다.
- 기존 설치의 백업을 수행합니다.
- 기존 설치 인벤토리 파일을 새 설치 번들 디렉터리에 복사합니다.
-
./setup.sh를 실행하여 설치를 업그레이드합니다.
예를 들어 버전 2.2.0-7에서 2.3-1.2로 업그레이드하려면 설치가 발생한 초기 컨트롤러 노드에 두 설치 번들이 있는지 확인합니다.
$ ls -1F ansible-automation-platform-setup-bundle-2.2.0-7/ ansible-automation-platform-setup-bundle-2.2.0-7.tar.gz ansible-automation-platform-setup-bundle-2.3-1.2/ ansible-automation-platform-setup-bundle-2.3-1.2.tar.gz
2.2.0-7 설치를 백업하십시오.
$ cd ansible-automation-platform-setup-bundle-2.2.0-7 $ sudo ./setup.sh -b $ cd ..
2.2.0-7 인벤토리 파일을 2.3-1.2 번들 디렉터리에 복사합니다.
$ cd ansible-automation-platform-setup-bundle-2.2.0-7 $ cp inventory ../ansible-automation-platform-setup-bundle-2.3-1.2/ $ cd ..
setup.sh 스크립트를 사용하여 2.2.0-7에서 2.3-1.2로 업그레이드하십시오.
$ cd ansible-automation-platform-setup-bundle-2.3-1.2 $ sudo ./setup.sh