zaki work log

作業ログやら生活ログやらなんやら

[RHEL / Ansible] 最小構成でセットアップしたRHELにAAPをオフラインインストールするときの諸注意(備忘録)

注意!
現時点で、開発者アカウントの場合はサブスクリプション登録に必要なマニフェストのzipファイル作成がポータルでできなさげ(作成権限がない)。
(なので開発者アカウントの場合はオンラインでやりましょう)

商用アカウントなどでカスタマポータルへログインし、サブスクリプション登録割り当ての画面で「新規サブスクリプションの割り当て」のボタンがあれば大丈夫。のはず。

ちなみにAnsible Towerのドキュメントもサブスクリプション周りは同じなので、手順は同様のはず。

構成

  • RHEL: 8.6
  • AAP: 2.2.0-7

RHEL自体のオフラインインストールについては以下参照で、この記事通り、マウントしたDVDイメージのYumリポジトリがある前提。

zaki-hmkc.hatenablog.com

インストール

インストーラ

インストーラは、必要なパッケージが同梱されているBundle版(Ansible Automation Platform 2.2.0 Setup Bundle)を入手する。

インベントリ

インストール対象ホスト、AAPのadminパスワード、PostgreSQLのパスワードまでは通常通りで、オフライン用の設定としてregistry_urlを空に設定する。

access.redhat.com

ざっくりこんな感じ。(localインストールの場合)

--- inventory.org       2022-06-30 02:56:29.000000000 +0900
+++ inventory   2022-08-03 22:12:40.864176120 +0900
@@ -9,6 +9,7 @@
 # hybrid.example  node_type=hybrid
 # hybrid2.example <- this will default to hybrid
 [automationcontroller]
+rhel8-restricted  ansible_connection=local
 
 [automationcontroller:vars]
 peers=execution_nodes
@@ -39,20 +40,20 @@
 [sso]
 
 [all:vars]
-admin_password=''
+admin_password='p@ssword'
 
 pg_host=''
 pg_port=5432
 
 pg_database='awx'
 pg_username='awx'
-pg_password=''
+pg_password='p@ssword'
 pg_sslmode='prefer'  # set to 'verify-full' for client-side enforced SSL
 
 # Execution Environment Configuration
 # Credentials for container registry to pull execution environment images from,
 # registry_username and registry_password are required for registry.redhat.io
-registry_url='registry.redhat.io'
+registry_url=''
 registry_username=''
 registry_password=''

追加パッケージ

あとは普通にインストール…と行きたいところだけど、最小構成RHELの場合、依存するパッケージがBundle版でもちょっと足りず、そのままsetup.shを実行すると以下のエラーで失敗する。

TASK [ansible.automation_platform_installer.nginx : Open up permissions on nginx.] ***
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'semanage'
failed: [rhel8-restricted] (item=httpd_can_network_connect) => {"ansible_loop_var": "item", "changed": false, "item": "httpd_can_network_connect", "msg": "Failed to import the required Python library (libsemanage-python) on rhel8-restricted's Python /usr/libexec/platform-python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}

semanageが無いので以下のコマンドでインストールしておく。(インストーラで入れて欲しい気もするけど…)

sudo dnf install policycoreutils-python-utils

※ 以下はpolicycoreutils-python-utilsをインストールしない(不要な)場合

RHELが最小構成でなくpolicycoreutils-python-utilsが既にインストール済みの場合でも、dnfでパッケージインストールを一度も実行しておらずGPGキー未インポート状態だとなぜか(?)www.redhat.comリモートホストへの接続を試みようとして失敗するので、GPGキーのインポートを行っておく。

Curl error (28): Timeout was reached for https://www.redhat.com/security/data/fd431d51.txt [Connection timed out after 30000 milliseconds]
./setup.sh: 行 376: ansible-playbook: コマンドが見つかりません
[error] Oops!  An error occurred while running setup.
[warn] /var/log/tower does not exist. Setup log saved to setup.log.

GPGキーのインポートを行えばこのエラーは回避できた。(試行錯誤の結果なので詳細不明…)

sudo rpm --import /mnt/cdrom/RPM-GPG-KEY-redhat-release

もしくは、適当なパッケージをインストールする。

インストール

あとは普通に。

$ time sudo ./setup.sh 

サブスクリプション登録

インストール完了後のサブスクリプション登録は、オフラインだとRed Hatアカウントを入力した登録ができない。かわりに、サブスクリプションマニフェストをカスタマポータルで別途作成し、取得したマニフェスト(zipファイル)を登録することでサブスクリプション登録を行う。

マニフェストファイルの作成

access.redhat.com

カスタマポータルの「サブスクリプション割り当て」から。
これが開発者アカウントだと、以下の通り割り当て操作ができないようになっている。

商用アカウントだとこの画面から「新規サブスクリプションの割り当て」ボタンが表示されるので、以下のドキュメント通り操作すればOK

名前にシステムの名称などを入力、TypeにSatellite 6.8を選択、サブスクリプションへAAPの資格情報(Entitlements)を追加すれば、Detailsタブでマニフェストのエクスポートするボタンが表示されるので、これを押下してzipファイルをダウンロードする。

マニフェストのアップロード

取得したzipファイルをAAPのサブスクリプション画面でアップロードすれば完了。
(情報収集系のオプションはオフラインなので無効にしておく)