zaki work log

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

[Ansible / AAP] 古いバージョンのAAPインストールが「Unsupported parameters for (ansible.legacy.command) module: warn」で失敗

古いバージョンのAAPのインストールでエラーが発生したのでメモ。
ターゲットOSはRHEL8.8

access.redhat.com

状況

1年近く前からデモ用環境として使用時にAAP環境を都度構築していたのですが、先週は大丈夫だったAAP 2.1.2-1(かなり古い)のsetup.sh実行が今週になって以下のエラーで失敗するようになりました。

TASK [ansible.automation_platform_installer.packages_el : Disable required dnf modules] ***
failed: [aap.example.org] (item=php) => {"ansible_loop_var": "item", "changed": false, "item": "php", "msg": "Unsupported parameters for (ansible.legacy.command) module: warn. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends."}

結論から書くと、setup.sh実行に必要な依存でインストールされるAnsible(ansible-core)のバージョンが2.14になり、ansible.builtin.commandモジュールのwarnパラメタが削除されたため発生するエラーでした。

(deprecated) Enable or disable task warnings.
This feature is deprecated and will be removed in 2.14.

以下はsetup.shが失敗したあとの(setup.shによってインストールされる)Ansibleバージョン。

# ansible --version
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Feb 17 2023, 09:28:16) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

ちなみにBundle版で発生したので「バンドル版にインストールに必要なパッケージを含んでいてもインターネット接続でより新しいバージョンがあれば新しい方を優先」という動作の模様。(これは動作からの想像のため未確認)

対策

事前にAnsibleバージョン2.13以前をインストールしておくことでも回避できるみたいだけど、デモ環境のためバージョンを塩漬けにする必要は無かったのでおとなしく最新版へアップデート(状況からインストーラを新しいのにすればこの修正は対策済みであると期待した)。
どのバージョンから対策済みかは確認してないが、2023-05-22時点で最新のAnsible Automation Platform 2.3 Setup Bundle (ansible-automation-platform-setup-bundle-2.3-2.1.tar.gz)でセットアップすることで無事にインストールできました。

参考

stackoverflow.com