3.2. 自動化実行環境を構築する際に Automation Hub 認証の詳細を使用する
以下の例を使用して、デフォルトの定義ファイルをカスタマイズし、Automation Hub 認証の詳細を、最終的な自動化実行環境イメージで公開することなく、自動化実行環境ビルドに渡します。
前提条件
-
Automation Hub API トークンを作成 し、セキュアな場所 (たとえば
token.txtという名前のファイル) に保存している。 - Automation Hub API トークンが入力されるビルド引数を定義している。
export ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN=$(cat <token.txt>)
additional_build_steps:
prepend_galaxy:
# 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 host env
- ARG ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN
- ENV ANSIBLE_GALAXY_SERVER_LIST=automation_hub
- ENV ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_URL=https://console.redhat.com/api/automation-hub/content/<yourhuburl>-synclist/
- ENV ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_AUTH_URL=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token