我的 Ansible 剧本中有一个 Ansible Collections,如下所示:
- name: Create a profile for the user
community.windows.win_user_profile:
username: test
name: test
state: present
Run Code Online (Sandbox Code Playgroud)
该集合是通过安装的
ansible-galaxy collection install ansible.windows
Run Code Online (Sandbox Code Playgroud)
所以我可以在 ~/.ansible/collections 中看到它。
然而我不断得到:
ERROR! couldn't resolve module/action 'community.windows.win_user_profile'. This often indicates a misspelling, missing collection, or incorrect module path.
Run Code Online (Sandbox Code Playgroud)
我还将它与剧本一起复制,以防万一,但仍然收到相同的错误消息。
有什么建议么?
mao*_*aow 11
安装后,我在 Ubuntu 20.04 上使用 Ansible 2.9 时遇到了同样的错误community.general。这种情况下的解决方案是安装ansible.posix
ansible-galaxy collection install ansible.posix
Run Code Online (Sandbox Code Playgroud)
因为这包含mount模块https://docs.ansible.com/ansible/latest/collections/ansible/posix/mount_module.html
在您的问题中添加以下详细信息将会有所帮助
我想,这是 ansible 版本特有的错误。我猜你使用的是ansible 2.9版本或更低版本。然而,仅在 ansible 2.9+ 中支持使用 ansible-galaxy 安装集合。
参考链接: https: //galaxy.ansible.com/ansible/windows(查看“注意”部分)
你可以升级你的ansible版本并尝试一下。