Ansible Tower 3.8.6 在 RHEL 9.1 上安装失败,出现错误:无法解析模块/操作“ini_file”

Ansible Tower 3.8.6 在 RHEL 9.1 上安装失败,出现错误:无法解析模块/操作“ini_file”

我尝试在虚拟机上安装 ansible tower,从官方 RH 存储库获取设置:https://releases.ansible.com/ansible-tower/setup/ansible-tower-setup-latest.tar.gz

一切都来自官方 RH Repos。我提取了内容,并使用密码设置了清单,然后运行sudo ./setup.sh并收到以下错误(尽管安装程序应该安装该ansible软件包):

[ansible@tower ansible-tower-setup-3.8.6-2]$ sudo ./setup.sh
Updating Subscription Management repositories.
Error: Unknown repo: 'ansible-tower-dependencies-temp'
[error] Unable to install ansible.
[error] Ansible is not installed on this machine.
You must install Ansible before you can install Tower.

For guidance on installing Ansible, consult
http://docs.ansible.com/intro_installation.html.

结果 RedHat 改变了软件包的可用性,我不得不安装ansible-core.但是,现在运行安装程序时,我收到错误ERROR! couldn't resolve module/action 'ini_file'. This often indicates a misspelling, missing collection, or incorrect module path.。我什至尝试更改模块名称以包含 FQCN commnity.general.ini_file,但没有成功!

不幸的是,我是 Ansible 的新手,不知道如何进一步安装 Ansible Tower。

以下是完整的错误日志(和平台详细信息):

Installed:
  ansible-core-2.14.2-4.el9.x86_64                    git-core-2.39.1-1.el9.x86_64            libnsl2-2.0.0-1.el9.x86_64                      mpdecimal-2.5.1-3.el9.x86_64           
  python3.11-3.11.2-2.el9.x86_64                      python3.11-cffi-1.15.1-1.el9.x86_64     python3.11-cryptography-37.0.2-5.el9.x86_64     python3.11-libs-3.11.2-2.el9.x86_64    
  python3.11-pip-wheel-22.3.1-2.el9.noarch            python3.11-ply-3.11-1.el9.noarch        python3.11-pycparser-2.20-1.el9.noarch          python3.11-pyyaml-6.0-1.el9.x86_64     
  python3.11-setuptools-wheel-65.5.1-2.el9.noarch     python3.11-six-1.16.0-1.el9.noarch      sshpass-1.09-4.el9.x86_64                      

Complete!

[ansible@tower ansible-tower-setup-3.8.6-2]$ ansible --version
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Feb 16 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

[ansible@tower ansible-tower-setup-3.8.6-2]$ sudo ./setup.sh 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.9/distutils/version.py", line 64, in __gt__
    c = self._cmp(other)
  File "/usr/lib64/python3.9/distutils/version.py", line 341, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
Updating Subscription Management repositories.
Error: Unknown repo: 'ansible-tower-dependencies-temp'
Using /etc/ansible/ansible.cfg as config file
[DEPRECATION WARNING]: "include" is deprecated, use include_tasks/import_tasks 
instead. See https://docs.ansible.com/ansible-
core/2.14/user_guide/playbooks_reuse_includes.html for details. This feature 
will be removed in version 2.16. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg.
ERROR! couldn't resolve module/action 'community.general.ini_file'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/ansible/ansible-tower-setup-3.8.6-2/roles/repos_el/tasks/main.yml': line 67, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


    - name: Enable AWS rhui repositories
      ^ here
[error] Oops!  An error occurred while running setup.
[warn] /var/log/tower does not exist. Setup log saved to setup.log.

[ansible@tower ansible-tower-setup-3.8.6-2]$ cat /etc/os-rel*
NAME="Red Hat Enterprise Linux"
VERSION="9.1 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.1 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/9/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.1
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"
[ansible@tower ansible-tower-setup-3.8.6-2]$ 

答案1

据我所知,Tower 3.8.6 只能使用 Ansible 2.9 进行安装。最好的选择是在 virtualenv 中安装 Ansible,如下所示:

python -m venv ansible29
ansible29/bin/pip install --upgrade pip
ansible29/bin/pip install 'cryptography<37' 'ansible<2.10'
export PATH=$PWD/ansible29/bin:$PATH
$ ansible --version
ansible 2.9.27

但是...我认为 RHEL9 不支持 Tower 3.8.6。可能会,但正式它仅适用于 RHEL7/8,并且您需要使用适用于 RHEL9 的 Automation Platform 2.x。

您还可以考虑./setup.sh -- --becomesudo ./setup.shroot 身份运行来缓解某些问题。

相关内容