I've got an Ansible Collections in my Ansible playbook as follows:
- name: Create a profile for the user community.windows.win_user_profile: username: test name: test state: present and the collection is installed via
ansible-galaxy collection install ansible.windows so I can see it at ~/.ansible/collections.
However I keep getting:
ERROR! couldn't resolve module/action 'community.windows.win_user_profile'. This often indicates a misspelling, missing collection, or incorrect module path. I've also copied it alongside the playbook just in case but still get the same error message.
Any suggestions?
14 Answers
I got the same error with Ansible 2.9 on Ubuntu 20.04 after install community.general. The solution in this case was installing ansible.posix
ansible-galaxy collection install ansible.posix as this contains the mount module
ansible 2.9 uses collections different. One way is to add them to the top:
--- - hosts: all collections: - community.windows and then later use:
- name: Create a profile for the user win_user_profile: username: test name: test state: present for reference:
Dirty: dont do this, but it works.
ansible-config dump |grep DEFAULT_MODULE_PATH and copy them there (example replace path and name)...
cp -p ~/.ansible/collections/ansible_collections/community/general/plugins/modules/system/sudoers.py ./library/ There are two Windows collections: community and Supported. I know that's confusing :(
Looks like you've installed ansible.windows, though you are using community.windows
The fix is:
ansible-galaxy collection install community.windows
Adding below details to your question would be helpful
- Ansible host operating system
- Ansible version
I guess, this is error is specific to ansible version. I guess you are using ansible 2.9 version or lower version. whereas, Installing collections with ansible-galaxy is only supported in ansible 2.9+.
Reference link : ( look into 'Note' section )
You can upgrade your ansible version and give a try.