Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR! couldn't resolve module/action . This often indicates a misspelling, missing collection, or incorrect module path

Tags:

ansible

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?

like image 820
Snowcrash Avatar asked Nov 23 '25 10:11

Snowcrash


2 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 https://docs.ansible.com/ansible/latest/collections/ansible/posix/mount_module.html

like image 109
maow Avatar answered Nov 25 '25 09:11

maow


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:

  • Use Ansible Collections
  • collections are backwardcompatible

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/
like image 26
Booker B Avatar answered Nov 25 '25 10:11

Booker B