I would like to use the ansible.posix collection in my projects. I have been reading ansible docs, searching these forums and searching the internet, but I cannot seem to figure out what is going wrong. I am using this as my ansible.cfg:
[defaults]
inventory = ./inventory.ini
library = ./modules
roles_path = ./roles
collections_path = ./collections
interpreter_python = auto_silent
gathering = smart
host_key_checking = False
stdout_callback = debug
callback_whitelist = timer, profile_roles
# SSH timeout
timeout = 10
log_path = ../../ansible.log
deprecation_warnings = True
retry_files_enabled = False
I have done the following to install the collection:
- Downloaded the tarball
- extracted to a temp dir
- created
./collections/ansible-collections/community
dir in my project dir (next to my playbook) - moved
ansible.posix
dir below thecommunity
dir. This dir holds thedocs
,meta
,plugins
dir (amongst the other content of course)
I create a playbook and call the collection as follows:
- name: Set authorized key taken from file
ansible.posix.authorized_key:
The error appears:
ERROR! couldn't resolve module/action 'ansible.posix.authorized_key'. This often indicates a misspelling, missing collection, or incorrect module path.
I moved the ansible.posix to:
- ./collections
- ./collections/ansible-collections/
But I keep getting this error. I tried different modules like ansible.posix.mount
, it’s another one I’d like to use but it throws the same error.
I’m sure it must be something silly, but I don’t see what I’m doing wrong here?
Any help please?
Thanks in advance!