最近AAPのインストーラーの新しいバージョンをダウンロードしようとしたら、見慣れない「Tech Preview: Ansible Automation Platform 2.4 Containerized Setup」というインストーラが(日付を見る限り1月の時点ですでに)あったので試してみた。
![](https://cdn-ak.f.st-hatena.com/images/fotolife/z/zaki-hmkc/20240609/20240609170528.png)
access.redhat.com
日本語ドキュメントを見ると「コンテナー化されたAnsible Automation Platform」とあるけど、インストール手順メインで具体的にどんな違いがあるかさらっと見た感じだとわからなかったので実際に試してみた。
いれただけレベルだけど、コンテナ環境で動くAAPかな?と思いつつ入れてみたら、だいたいそんな感じだった。
試したのはBundle版のインストーラ。(インストール時に追加パッケージをダウンロードせずに、インストーラが全部入りになってるタイプ)
ホストの準備
RHEL9.2ベースのホストと書かれてるけど、OSを更新すると9.4になるのでこれで進める。
[zaki@rhel9-dev2 ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.4 (Plow)
システム要件通り4CPU、16GBメモリ、ストレージはケチって20GBで構築。
ちなみにDBとControllerのみの構築で10GB弱になる。
BaseOS と appstream リポジトリーのみがホスト上でセットアップされていること。
[zaki@rhel9-dev2 ~]$ dnf repolist
Not root, Subscription Management repositories not updated
repo id repo name
rhel-9-for-x86_64-appstream-rpms Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
rhel-9-for-x86_64-baseos-rpms Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)
[zaki@rhel9-dev2 ~]$
DNSが設定しており、FQDNで名前解決できること。
zaki@cloud-dev2:~$ dig @192.168.0.4 rhel9-dev2.naru.jp-z.jp
...
;; ANSWER SECTION:
rhel9-dev2.naru.jp-z.jp. 0 IN A 192.168.0.80
ansible-coreのインストール
[zaki@rhel9-dev2 ~]$ sudo dnf install ansible-core wget git rsync
Updating Subscription Management repositories.
Last metadata expiration check: 2:17:01 ago on Sun Jun 9 09:53:56 2024.
Package rsync-3.2.3-19.el9.x86_64 is already installed.
Dependencies resolved.
===============================================================================================================
Package Arch Version Repository Size
===============================================================================================================
Installing:
ansible-core x86_64 1:2.14.14-1.el9 rhel-9-for-x86_64-appstream-rpms 2.6 M
git x86_64 2.43.0-1.el9 rhel-9-for-x86_64-appstream-rpms 54 k
wget x86_64 1.21.1-7.el9 rhel-9-for-x86_64-appstream-rpms 794 k
Installing dependencies:
emacs-filesystem noarch 1:27.2-9.el9 rhel-9-for-x86_64-appstream-rpms 9.6 k
git-core x86_64 2.43.0-1.el9 rhel-9-for-x86_64-appstream-rpms 4.4 M
git-core-doc noarch 2.43.0-1.el9 rhel-9-for-x86_64-appstream-rpms 2.9 M
perl-AutoLoader noarch 5.74-481.el9 rhel-9-for-x86_64-appstream-rpms 21 k
perl-B x86_64 1.80-481.el9 rhel-9-for-x86_64-appstream-rpms 184 k
perl-Carp noarch 1.50-460.el9 rhel-9-for-x86_64-appstream-rpms 31 k
perl-Class-Struct noarch 0.66-481.el9 rhel-9-for-x86_64-appstream-rpms 22 k
perl-Data-Dumper x86_64 2.174-462.el9 rhel-9-for-x86_64-appstream-rpms 59 k
perl-Digest noarch 1.19-4.el9 rhel-9-for-x86_64-appstream-rpms 29 k
perl-Digest-MD5 x86_64 2.58-4.el9 rhel-9-for-x86_64-appstream-rpms 39 k
perl-DynaLoader x86_64 1.47-481.el9 rhel-9-for-x86_64-appstream-rpms 26 k
perl-Encode x86_64 4:3.08-462.el9 rhel-9-for-x86_64-appstream-rpms 1.7 M
perl-Errno x86_64 1.30-481.el9 rhel-9-for-x86_64-appstream-rpms 15 k
perl-Error noarch 1:0.17029-7.el9 rhel-9-for-x86_64-appstream-rpms 46 k
perl-Exporter noarch 5.74-461.el9 rhel-9-for-x86_64-appstream-rpms 34 k
perl-Fcntl x86_64 1.13-481.el9 rhel-9-for-x86_64-appstream-rpms 22 k
perl-File-Basename noarch 2.85-481.el9 rhel-9-for-x86_64-appstream-rpms 17 k
perl-File-Find noarch 1.37-481.el9 rhel-9-for-x86_64-appstream-rpms 26 k
perl-File-Path noarch 2.18-4.el9 rhel-9-for-x86_64-appstream-rpms 38 k
perl-File-Temp noarch 1:0.231.100-4.el9 rhel-9-for-x86_64-appstream-rpms 63 k
perl-File-stat noarch 1.09-481.el9 rhel-9-for-x86_64-appstream-rpms 17 k
perl-FileHandle noarch 2.03-481.el9 rhel-9-for-x86_64-appstream-rpms 16 k
perl-Getopt-Long noarch 1:2.52-4.el9 rhel-9-for-x86_64-appstream-rpms 64 k
perl-Getopt-Std noarch 1.12-481.el9 rhel-9-for-x86_64-appstream-rpms 16 k
perl-Git noarch 2.43.0-1.el9 rhel-9-for-x86_64-appstream-rpms 39 k
perl-HTTP-Tiny noarch 0.076-462.el9 rhel-9-for-x86_64-appstream-rpms 57 k
perl-IO x86_64 1.43-481.el9 rhel-9-for-x86_64-appstream-rpms 92 k
perl-IO-Socket-IP noarch 0.41-5.el9 rhel-9-for-x86_64-appstream-rpms 45 k
perl-IO-Socket-SSL noarch 2.073-1.el9 rhel-9-for-x86_64-appstream-rpms 223 k
perl-IPC-Open3 noarch 1.21-481.el9 rhel-9-for-x86_64-appstream-rpms 24 k
perl-MIME-Base64 x86_64 3.16-4.el9 rhel-9-for-x86_64-appstream-rpms 34 k
perl-Mozilla-CA noarch 20200520-6.el9 rhel-9-for-x86_64-appstream-rpms 14 k
perl-Net-SSLeay x86_64 1.92-2.el9 rhel-9-for-x86_64-appstream-rpms 392 k
perl-POSIX x86_64 1.94-481.el9 rhel-9-for-x86_64-appstream-rpms 98 k
perl-PathTools x86_64 3.78-461.el9 rhel-9-for-x86_64-appstream-rpms 92 k
perl-Pod-Escapes noarch 1:1.07-460.el9 rhel-9-for-x86_64-appstream-rpms 22 k
perl-Pod-Perldoc noarch 3.28.01-461.el9 rhel-9-for-x86_64-appstream-rpms 92 k
perl-Pod-Simple noarch 1:3.42-4.el9 rhel-9-for-x86_64-appstream-rpms 229 k
perl-Pod-Usage noarch 4:2.01-4.el9 rhel-9-for-x86_64-appstream-rpms 43 k
perl-Scalar-List-Utils x86_64 4:1.56-461.el9 rhel-9-for-x86_64-appstream-rpms 77 k
perl-SelectSaver noarch 1.02-481.el9 rhel-9-for-x86_64-appstream-rpms 12 k
perl-Socket x86_64 4:2.031-4.el9 rhel-9-for-x86_64-appstream-rpms 58 k
perl-Storable x86_64 1:3.21-460.el9 rhel-9-for-x86_64-appstream-rpms 98 k
perl-Symbol noarch 1.08-481.el9 rhel-9-for-x86_64-appstream-rpms 14 k
perl-Term-ANSIColor noarch 5.01-461.el9 rhel-9-for-x86_64-appstream-rpms 51 k
perl-Term-Cap noarch 1.17-460.el9 rhel-9-for-x86_64-appstream-rpms 24 k
perl-TermReadKey x86_64 2.38-11.el9 rhel-9-for-x86_64-appstream-rpms 40 k
perl-Text-ParseWords noarch 3.30-460.el9 rhel-9-for-x86_64-appstream-rpms 18 k
perl-Text-Tabs+Wrap noarch 2013.0523-460.el9 rhel-9-for-x86_64-appstream-rpms 25 k
perl-Time-Local noarch 2:1.300-7.el9 rhel-9-for-x86_64-appstream-rpms 37 k
perl-URI noarch 5.09-3.el9 rhel-9-for-x86_64-appstream-rpms 125 k
perl-base noarch 2.27-481.el9 rhel-9-for-x86_64-appstream-rpms 16 k
perl-constant noarch 1.33-461.el9 rhel-9-for-x86_64-appstream-rpms 25 k
perl-if noarch 0.60.800-481.el9 rhel-9-for-x86_64-appstream-rpms 14 k
perl-interpreter x86_64 4:5.32.1-481.el9 rhel-9-for-x86_64-appstream-rpms 73 k
perl-lib x86_64 0.65-481.el9 rhel-9-for-x86_64-appstream-rpms 15 k
perl-libnet noarch 3.13-4.el9 rhel-9-for-x86_64-appstream-rpms 134 k
perl-libs x86_64 4:5.32.1-481.el9 rhel-9-for-x86_64-appstream-rpms 2.2 M
perl-mro x86_64 1.23-481.el9 rhel-9-for-x86_64-appstream-rpms 29 k
perl-overload noarch 1.31-481.el9 rhel-9-for-x86_64-appstream-rpms 46 k
perl-overloading noarch 0.02-481.el9 rhel-9-for-x86_64-appstream-rpms 13 k
perl-parent noarch 1:0.238-460.el9 rhel-9-for-x86_64-appstream-rpms 16 k
perl-podlators noarch 1:4.14-460.el9 rhel-9-for-x86_64-appstream-rpms 118 k
perl-subs noarch 1.03-481.el9 rhel-9-for-x86_64-appstream-rpms 12 k
perl-vars noarch 1.05-481.el9 rhel-9-for-x86_64-appstream-rpms 13 k
python3-cffi x86_64 1.14.5-5.el9 rhel-9-for-x86_64-appstream-rpms 257 k
python3-cryptography x86_64 36.0.1-4.el9 rhel-9-for-x86_64-baseos-rpms 1.2 M
python3-packaging noarch 20.9-5.el9 rhel-9-for-x86_64-appstream-rpms 81 k
python3-ply noarch 3.11-14.el9 rhel-9-for-x86_64-appstream-rpms 111 k
python3-pycparser noarch 2.20-6.el9 rhel-9-for-x86_64-appstream-rpms 139 k
python3-pyparsing noarch 2.4.7-9.el9 rhel-9-for-x86_64-baseos-rpms 154 k
python3-resolvelib noarch 0.5.4-5.el9 rhel-9-for-x86_64-appstream-rpms 38 k
sshpass x86_64 1.09-4.el9 rhel-9-for-x86_64-appstream-rpms 30 k
Installing weak dependencies:
perl-NDBM_File x86_64 1.15-481.el9 rhel-9-for-x86_64-appstream-rpms 23 k
Transaction Summary
===============================================================================================================
Install 77 Packages
Total download size: 20 M
Installed size: 84 M
Is this ok [y/N]: y
Downloading Packages:
(1/77): perl-Data-Dumper-2.174-462.el9.x86_64.rpm 95 kB/s | 59 kB 00:00
(2/77): perl-Digest-MD5-2.58-4.el9.x86_64.rpm 63 kB/s | 39 kB 00:00
(3/77): perl-Error-0.17029-7.el9.noarch.rpm 217 kB/s | 46 kB 00:00
[...]
ホスト名の設定がこのセクションにあるのは微妙な気もするけどとりあえず手順通りに。
[zaki@rhel9-dev2 ~]$ sudo hostnamectl set-hostname rhel9-dev2.naru.jp-z.jp
[zaki@rhel9-dev2 ~]$ hostname
rhel9-dev2.naru.jp-z.jp
[zaki@rhel9-dev2 ~]$ sha256sum /mnt/template/iso/ansible-automation-platform-containerized-setup-bundle-2.4-2-x
86_64.tar.gz
0781cab21cd21992a22bb8ed6f9b1018dff0d092d5882e1e9aafbd48337f6662 /mnt/template/iso/ansible-automation-platform-containerized-setup-bundle-2.4-2-x86_64.tar.gz
[zaki@rhel9-dev2 ~]$ tar xf /mnt/template/iso/ansible-automation-platform-containerized-setup-bundle-2.4-2-x86_64.tar.gz
[zaki@rhel9-dev2 ~]$
[zaki@rhel9-dev2 ~]$ cd ansible-automation-platform-containerized-setup-bundle-2.4-2-x86_64/
[zaki@rhel9-dev2 ansible-automation-platform-containerized-setup-bundle-2.4-2-x86_64]$ ls -F
README.md ansible.cfg bundle/ collections/ inventory
Containerized AAPのインストール
とりあえずお試しなのでAutomation Controllerのみの構成。
インベントリファイルの編集
「実験的なポストインストーラー機能」についての記載があるが、何が可能になってるのか詳細がよくわからないのと、ライセンスファイルが必要で個人の開発者サブスクリプションではたぶん用意できないのでスルー。
(containerized版でない従来のAAPインストーラーにはこのパラメタはなかった)
注意点として、既存のAAPは「特にさわらなければ推奨のPostgreSQLが自動でローカルにインストールされる」という動きになるが、コンテナ版はDBの設定が入っていない(コメントアウトされてる)ので、明確に記述の必要がある。
特に[database]
のコメントアウトを解除するのを忘れずに。(訳:見落としてハマった)
逆にAutomation HubやEvent-Driven Ansibleはホスト名を記入するような書式になってるので、使わないなら削除する。
また、Bundle版を使用する場合はbundle_install
の有効化とbundle_dir
アーカイブを展開した中にあるbundle
ディレクトリを指定する必要がある。
オリジナルのファイルからの変更点は手元の環境では以下の通り。
$ diff -U1 inventory.org i
nventory
--- inventory.org 2024-01-03 06:01:01.000000000 +0900
+++ inventory 2024-06-09 16:18:31.684723915 +0900
@@ -7,3 +7,3 @@
[automationcontroller]
-fqdn_of_your_rhel_host ansible_connection=local
+rhel9-dev2.naru.jp-z.jp ansible_connection=local
@@ -12,3 +12,2 @@
[automationhub]
-fqdn_of_your_rhel_host ansible_connection=local
@@ -17,3 +16,2 @@
[automationeda]
-fqdn_of_your_rhel_host ansible_connection=local
@@ -29,4 +27,4 @@
# see mandatory sections under each AAP component
-#[database]
-#fqdn_of_your_rhel_host ansible_connection=local
+[database]
+rhel9-dev2.naru.jp-z.jp ansible_connection=local
@@ -37,3 +35,3 @@
postgresql_admin_username=postgres
-postgresql_admin_password=<set your own>
+postgresql_admin_password=awx
# If using the online (non-bundled) installer, you need to set RHN registry credentials
@@ -42,5 +40,5 @@
# If using the bundled installer, you need to alter defaults by using:
-#bundle_install=true
+bundle_install=true
# The bundle directory must include /bundle in the path
-#bundle_dir=<full path to the bundle directory>
+bundle_dir=/home/zaki/ansible-automation-platform-containerized-setup-bundle-2.4-2-x86_64/bundle
# To add more decision environment images you need to set the de_extra_images variable
@@ -61,5 +59,5 @@
# --------------------------
-controller_admin_password=<set your own>
-controller_pg_host=fqdn_of_your_rhel_host
-controller_pg_password=<set your own>
+controller_admin_password=curry_tabetai
+controller_pg_host=rhel9-dev2.naru.jp-z.jp
+controller_pg_password=awx
インストール
通常のAAPと異なり、ansible-playbook
を直接実行する。
$ ansible-playbook -i inventory ansible.containerized_installer.install
手元の環境では5分半程度。速い。
PLAY RECAP ****************************************************************************************************
localhost : ok=12 changed=0 unreachable=0 failed=0 skipped=19 rescued=0 ignored=0
rhel9-dev2.naru.jp-z.jp : ok=190 changed=89 unreachable=0 failed=0 skipped=52 rescued=0 ignored=0
real 5m27.918s
user 1m59.802s
sys 0m45.173s
実行状態
Web UI
ブラウザで8443/TCPにアクセス(HTTPS)すれば見覚えのある画面が表示される。
![](https://cdn-ak.f.st-hatena.com/images/fotolife/z/zaki-hmkc/20240609/20240609170429.png)
初回起動時にサブスクリプションの設定があるなど、この辺は通常のAAPと同じ。
![](https://cdn-ak.f.st-hatena.com/images/fotolife/z/zaki-hmkc/20240609/20240609170503.png)
Podmanの状態
rootやawxユーザーでなく、インストールしたユーザー権限で動作している。(だから標準のポートが8443/tcpだったのかな)
[zaki@rhel9-dev2 ~]$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
335ccc25ca2b registry.redhat.io/rhel8/postgresql-13:latest run-postgresql 6 minutes ago Up 6 minutes postgresql
abaef3f6a02b registry.redhat.io/rhel8/redis-6:latest run-redis 6 minutes ago Up 6 minutes redis
ebecd1131288 registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel8:latest /usr/bin/receptor... 6 minutes ago Up 6 minutes receptor
9e7c3c01e270 registry.redhat.io/ansible-automation-platform-24/controller-rhel8:latest /usr/bin/launch_a... 6 minutes ago Up 4 minutes automation-controller-rsyslog
9e28a45ee416 registry.redhat.io/ansible-automation-platform-24/controller-rhel8:latest /usr/bin/launch_a... 5 minutes ago Up 4 minutes automation-controller-task
72656085363f registry.redhat.io/ansible-automation-platform-24/controller-rhel8:latest /usr/bin/launch_a... 5 minutes ago Up 3 minutes automation-controller-web
task/web/rsyslog/receptorと、雰囲気的にはAWXの構成に近付い模様。
ちなみに、ジョブ実行時のコンテナがどこで動いてるかはわからなかった。(podman ps
を連打してても、ジョブ実行用のコンテナが起動してる感じがしなかった)
ジョブ実行のコンテナは、receptorコンテナの中で実行されているのを(ジョブ実行のタイミングでpodman ps
を連打して)確認。いわゆるpodman in podman構成で、ホストOSからは直接コンテナは見えない。
[zaki@rhel9-dev2 ~]$ podman exec -it receptor bash
bash-4.4$
bash-4.4$ ansible --version
ansible [core 2.15.8]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.9)
jinja version = 3.1.2
libyaml = True
bash-4.4$
bash-4.4$
bash-4.4$ podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2994ea27cff0 registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest ansible-playbook ... Less than a second ago Up Less than a second ansible_runner_7
bash-4.4$
taskのコンテナのログを確認すれば、ジョブが起動していることを確認できる。
[zaki@rhel9-dev2 ~]$ podman logs automation-controller-task
[wait-for-migrations] Waiting for database migrations...
[wait-for-migrations] Attempt 1
2024-06-09 07:24:19,342 INFO RPC interface 'supervisor' initialized
2024-06-09 07:24:19,342 INFO RPC interface 'supervisor' initialized
2024-06-09 07:24:19,342 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-06-09 07:24:19,342 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-06-09 07:24:19,342 INFO supervisord started with pid 2
[...]
2024-06-09 07:33:28,644 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 controller node chosen
2024-06-09 07:33:28,644 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 execution node chosen
2024-06-09 07:33:28,673 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 waiting
2024-06-09 07:33:28,768 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 pre run
2024-06-09 07:33:28,807 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 preparing playbook
2024-06-09 07:33:28,857 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 running playbook
2024-06-09 07:33:28,866 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 work unit id received
2024-06-09 07:33:28,926 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 work unit id assigned
2024-06-09 07:33:31,436 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.main.commands.run_callback_receiver Starting EOF event processing for Job 5
2024-06-09 07:33:31,438 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 post run
2024-06-09 07:33:31,511 INFO [0e45219bc6404f0f8601e7f1da2d2fd7] awx.analytics.job_lifecycle job-5 finalize run
2024-06-09 07:33:32,046 INFO [-] awx.analytics.job_lifecycle job-5 stats wrapup finished
awxユーザーはホストOS上には存在せず、コンテナ内の実行ユーザーとして一応いる。
[zaki@rhel9-dev2 ~]$ podman exec -it automation-controller-task id
uid=1000(awx) gid=0(root) groups=0(root)
雑感
インストールしてみただけなので使い勝手とかはコメントしづらいけど多分従来のAAPと同様なのかな。
今までは様々なコンポーネントをインストールする必要があったけど、コンテナをデプロイする形式になったのでかなり高速化された印象。
インストール手順にAnsibleのインストールがあるけど、おそらくインストールに使用するためのAnsibleなので、AAP本体やジョブとは独立してると思われ。
まだ試してはないけど、Hubなど追加コンポーネントもインストールするのであれば、ホストグループに加えてHub用のPostgreSQLの情報を追加する。
# This section is for your AAP Automation Hub host(s)
# -----------------------------------------------------
[automationhub]
rhel9-dev2.naru.jp-z.jp ansible_connection=local
:
# AAP Automation Hub - mandatory
# ------------------------------
hub_admin_password=curry_tabetai
hub_pg_host=rhel9-dev2.naru.jp-z.jp
hub_pg_password=awx
あとインストール時の引数のansible.containerized_installer.install
、そんなplaybookファイルないけど何だろうと思って実行したら、ansible.containerized_installer
が内蔵のコレクション名っぽい。プラグイン名を指定してもansible-playbook
って実行できるんだね。
$ ansible-playbook -i inventory ansible.containerized_installer.install
[WARNING]: running playbook inside collection ansible.containerized_installer