ansible-lint
ansible-lint copied to clipboard
ansible-lint does not recognize the module ansible.posix.synchronize
Summary
I use [email protected]
and it seems that even this latest version does not recognize the module ansible.posix.synchronize
Issue Type
- Bug Report
OS / ENVIRONMENT
Ubuntu 22.04.3 LTS ansible-lint 24.2.0 using ansible-core:2.16.3
STEPS TO REPRODUCE
I use [email protected]
and it seems that it does not recognize the module ansible.posix.synchronize
so, when I define the below task:
- name: Synchronization of src on the control machine to dest on the remote hosts
ansible.posix.synchronize:
src: some/relative/path
dest: /some/absolute/path
It show error:
Error: couldn't resolve module/action 'ansible.posix.synchronize'. This often indicates a misspelling, missing collection, or incorrect module path.
deploy/ansible/roles/role_aurora_delivery_pst/tasks/nomad_delivery.yml:97:3
Rule Violation Summary
count tag profile rule associated tags
1 syntax-check[unknown-module] min core, unskippable
Failed: 1 failure(s), 0 warning(s) on 1491 files. Profile 'min' was required.
Error: Process completed with exit code 2.
instead, when I define the task as below, which is using the old module synchronize
, then it passes without any error or warnings:
- name: Synchronization of src on the control machine to dest on the remote hosts
synchronize:
src: some/relative/path
dest: /some/absolute/path
By the way, In my ansible server the collection ansible.posix
is installed/included so the task that is calling the new module ansible.posix.synchronize
is executed without any problem.
Hi, can you confirm if this is a bug?
I'm also seeing this, my pre-commit is:
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v24.2.1
hooks:
- id: ansible-lint
always_run: true
args: ["ansible/"]
pass_filenames: false
additional_dependencies:
- ansible-core
- yamllint
If I comment it out, I then get it for ini_file
as well. And it fails with either ansible.posix.synchronize or just synchronize.
The same goes for community.general.sudoers
I tried installing community.general in for lint playbook before launching linter, it is already installed
Run ansible-galaxy collection install community.general
ansible-galaxy collection install community.general
shell: /usr/bin/bash -e {0}
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
I'm also experiencing this issue.
You must declare dependencies suck posix collection inside requirements.yml
if you want the linter to find them. Linter will ignore manually installed dependencies as it wants to be sure you declared them.
Basically is more of a feature than a bug, but I do agree the the messaging can be improved to tell users what to do to address it, so keeping the issue open.
To resolve this, you must declare all the used collections inside a requirements.yml file, so the linter can install them when they are missing.
Please refer this documentation: https://ansible.readthedocs.io/projects/lint/rules/syntax-check/#syntax-checkunknown-module