找不到 freeipa.ansible_freeipa.ipaclient_test 的导入模块支持代码

找不到 freeipa.ansible_freeipa.ipaclient_test 的导入模块支持代码

我的 ansible 控制器在 Rocky 8.5 机器上运行,安装了 ansible-freeipa 版本 0.3.8-1.el8 rpm 包。

ansible 2.9.27
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.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Nov 9 2021, 14:44:26) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]

我将 ansible_freeipa 集合存储在 /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa 下。

我已更新我的 ansible.cfg“collections”参数以指向:/etc/ansible/community_collections。

我正在尝试将三台主机加入到新安装的 freeipa 服务器。当我运行我的剧本时,它开始应用 ipaclient 角色,但在 ipaclient/tasks/install.yml 文件中的“安装 - IPA 客户端测试”任务中失败。

似乎找不到“ansible_ipa_client.py”文件。但我可以看到它位于 /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/module_utils

以下是我运行该剧本时发生的情况:

ansible-playbook 2.9.27
  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.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Nov  9 2021, 14:44:26) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
Using /etc/ansible/ansible.cfg as config file
Skipping callback 'actionable', as we already have a stdout callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Skipping callback 'debug', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Skipping callback 'json', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'null', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Skipping callback 'selective', as we already have a stdout callback.
Skipping callback 'skippy', as we already have a stdout callback.
Skipping callback 'stderr', as we already have a stdout callback.
Skipping callback 'unixy', as we already have a stdout callback.
Skipping callback 'yaml', as we already have a stdout callback.

PLAYBOOK: bootstrap.yml ********************************************************************************************************************
1 plays in bootstrap.yml

PLAY [ipaclients] **************************************************************************************************************************
META: ran handlers
META: ran handlers
META: ran handlers
Thursday 28 April 2022  19:48:20 +0000 (0:00:00.233)       0:00:00.233 ******** 
Thursday 28 April 2022  19:48:20 +0000 (0:00:00.023)       0:00:00.256 ******** 
Thursday 28 April 2022  19:48:20 +0000 (0:00:00.050)       0:00:00.306 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Import variables specific to distribution] *******************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/main.yml:4
ok: [cm.mts.sys] => (item=/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml) => {"ansible_facts": {"ipaclient_packages": ["@idm:DL1/client"]}, "ansible_included_var_files": ["/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml"], "ansible_loop_var": "item", "changed": false, "item": "/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml"}
Thursday 28 April 2022  19:48:20 +0000 (0:00:00.164)       0:00:00.471 ******** 
ok: [inf-4.mts.sys] => (item=/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml) => {"ansible_facts": {"ipaclient_packages": ["@idm:DL1/client"]}, "ansible_included_var_files": ["/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml"], "ansible_loop_var": "item", "changed": false, "item": "/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml"}
Thursday 28 April 2022  19:48:20 +0000 (0:00:00.059)       0:00:00.531 ******** 
ok: [mitts-hst-5.mts.sys] => (item=/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml) => {"ansible_facts": {"ipaclient_packages": ["@idm:DL1/client"]}, "ansible_included_var_files": ["/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml"], "ansible_loop_var": "item", "changed": false, "item": "/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/vars/RedHat-8.yml"}
Thursday 28 April 2022  19:48:20 +0000 (0:00:00.108)       0:00:00.639 ******** 
included: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml for cm.mts.sys
Thursday 28 April 2022  19:48:21 +0000 (0:00:00.155)       0:00:00.795 ******** 
included: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml for inf-4.mts.sys, mitts-hst-5.mts.sys
Thursday 28 April 2022  19:48:21 +0000 (0:00:00.118)       0:00:00.914 ******** 
Thursday 28 April 2022  19:48:21 +0000 (0:00:00.048)       0:00:00.962 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Ensure that IPA client packages are installed] *****************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:4
ok: [cm.mts.sys] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []}
Thursday 28 April 2022  19:48:23 +0000 (0:00:02.024)       0:00:02.987 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Ensure that IPA client packages are installed] *****************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:4
ok: [inf-4.mts.sys] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.025)       0:00:03.013 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers] *****************************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:10
skipping: [cm.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.136)       0:00:03.150 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers] *****************************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:10
skipping: [inf-4.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.053)       0:00:03.204 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers from cluster inventory] ******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:15
skipping: [cm.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.135)       0:00:03.339 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers from cluster inventory] ******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:15
skipping: [inf-4.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.052)       0:00:03.392 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Check that either principal or keytab is set] ******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:21
skipping: [cm.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.078)       0:00:03.471 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Check that either principal or keytab is set] ******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:21
skipping: [inf-4.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.089)       0:00:03.560 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set default principal if no keytab is given] *******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:25
skipping: [cm.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.090)       0:00:03.651 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set default principal if no keytab is given] *******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:25
skipping: [inf-4.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:23 +0000 (0:00:00.080)       0:00:03.732 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - IPA client test] ***********************************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:30
fatal: [cm.mts.sys]: FAILED! => {"msg": "Could not find imported module support code for freeipa.ansible_freeipa.ipaclient_test.  Looked for either validate_domain_name.py or ansible_ipa_client.py"}

TASK [freeipa.ansible_freeipa.ipaclient : Install - IPA client test] ***********************************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:30
fatal: [inf-4.mts.sys]: FAILED! => {"msg": "Could not find imported module support code for freeipa.ansible_freeipa.ipaclient_test.  Looked for either validate_domain_name.py or ansible_ipa_client.py"}

TASK [freeipa.ansible_freeipa.ipaclient : Install - Ensure that IPA client packages are installed] *****************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:4
ok: [mitts-hst-5.mts.sys] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []}
Thursday 28 April 2022  19:48:24 +0000 (0:00:00.860)       0:00:04.592 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers] *****************************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:10
skipping: [mitts-hst-5.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:25 +0000 (0:00:00.222)       0:00:04.814 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers from cluster inventory] ******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:15
skipping: [mitts-hst-5.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:25 +0000 (0:00:00.220)       0:00:05.035 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Check that either principal or keytab is set] ******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:21
skipping: [mitts-hst-5.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:25 +0000 (0:00:00.208)       0:00:05.244 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - Set default principal if no keytab is given] *******************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:25
skipping: [mitts-hst-5.mts.sys] => {"changed": false, "skip_reason": "Conditional result was False"}
Thursday 28 April 2022  19:48:25 +0000 (0:00:00.213)       0:00:05.457 ******** 

TASK [freeipa.ansible_freeipa.ipaclient : Install - IPA client test] ***********************************************************************
task path: /etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:30
fatal: [mitts-hst-5.mts.sys]: FAILED! => {"msg": "Could not find imported module support code for freeipa.ansible_freeipa.ipaclient_test.  Looked for either validate_domain_name.py or ansible_ipa_client.py"}

PLAY RECAP *********************************************************************************************************************************
cm.mts.sys                 : ok=3    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   
inf-4.mts.sys              : ok=3    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   
mitts-hst-5.mts.sys        : ok=3    changed=0    unreachable=0    failed=1    skipped=4    rescued=0    ignored=0   

Thursday 28 April 2022  19:48:25 +0000 (0:00:00.211)       0:00:05.669 ******** 
=============================================================================== 
freeipa.ansible_freeipa.ipaclient : Install - Ensure that IPA client packages are installed ----------------------------------------- 2.02s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:4 ------------------------
freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers ----------------------------------------------------------------- 0.22s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:10 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers from cluster inventory ------------------------------------------ 0.22s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:15 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - Set default principal if no keytab is given ------------------------------------------- 0.21s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:25 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - IPA client test ----------------------------------------------------------------------- 0.21s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:30 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - Check that either principal or keytab is set ------------------------------------------ 0.21s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:21 -----------------------
freeipa.ansible_freeipa.ipaclient : Import variables specific to distribution ------------------------------------------------------- 0.16s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/main.yml:4 ---------------------------
freeipa.ansible_freeipa.ipaclient : Install IPA client ------------------------------------------------------------------------------ 0.16s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/main.yml:19 --------------------------
freeipa.ansible_freeipa.ipaclient : Install - Ensure that IPA client packages are installed ----------------------------------------- 0.12s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:4 ------------------------
freeipa.ansible_freeipa.ipaclient : Install - Set default principal if no keytab is given ------------------------------------------- 0.09s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:25 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - IPA client test ----------------------------------------------------------------------- 0.08s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:30 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers from cluster inventory ------------------------------------------ 0.05s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:15 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - Check that either principal or keytab is set ------------------------------------------ 0.05s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:21 -----------------------
freeipa.ansible_freeipa.ipaclient : Install - Set ipaclient_servers ----------------------------------------------------------------- 0.03s
/etc/ansible/community_collections/ansible_collections/freeipa/ansible_freeipa/roles/ipaclient/tasks/install.yml:10 -----------------------

答案1

为了解决这个问题,我不得不从 /etc/ansible/community_collections/ansible_collections 中删除 ansible_freeipa 社区集合的副本。这是我在 ansible.cfg 中指定的社区集合所在的位置。您的配置可能不同。然后,​​我必须通过从 ansible galaxy 下载新副本来重新安装社区集合:https://galaxy.ansible.com/freeipa/ansible_freeipa

我通过从 ansible-galaxy 下载 tar.gz 文件来手动安装。然后我使用以下命令来安装它。

ansible-galaxy 集合安装 -p /etc/ansible/community_collections ~/freeipa-ansible_freeipa-1.8.4.tar.gz

相关内容