megalinter icon indicating copy to clipboard operation
megalinter copied to clipboard

Ansible lint false positive

Open fabricesemti80 opened this issue 3 years ago • 3 comments

Describe the bug Hi,

I think this linter error is a false positive.

   INFO     Executing syntax check on provision/ansible/playbooks/cluster-prepare.yml (2.52s)
  WARNING  Listing 1 violation(s) that are fatal
  syntax-check: couldn't resolve module/action 'community.general.timezone'. This often indicates a misspelling, missing collection, or incorrect module path.
  provision/ansible/playbooks/cluster-prepare.yml:15:11 ERROR! couldn't resolve module/action 'community.general.timezone'. This often indicates a misspelling, missing collection, or incorrect module path.
  
  The error appears to be in '/github/workspace/provision/ansible/playbooks/cluster-prepare.yml': line 15, column 11, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
        block:
          - name: Locale | Set timezone
            ^ here
  
  
  Error: syntax-check couldn't resolve module/action 'community.general.timezone'. This often indicates a misspelling, missing collection, or incorrect module path.

The config

- hosts:
    - master
    - worker
  become: true
  gather_facts: true
  any_errors_fatal: true
  pre_tasks:
    - name: Pausing for 5 seconds...
      ansible.builtin.pause:
        seconds: 5
  tasks:
    - name: Locale
      block:
        - name: Locale | Set timezone
          community.general.timezone:
            name: "{{ timezone | default('Etc/UTC') }}"

( https://github.com/fabricesemti80/home-stack/blob/c74f88196f26213f2be095b548a884351011aab8/provision/ansible/playbooks/cluster-prepare.yml#L16) seems to be in line with the example (https://docs.ansible.com/ansible/latest/collections/community/general/timezone_module.html) on the module's site.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior No error reported when config is correct..

Screenshots If applicable, add screenshots to help explain your problem.

Additional context (https://github.com/fabricesemti80/home-stack/runs/8168486344?check_suite_focus=true)

fabricesemti80 avatar Sep 03 '22 09:09 fabricesemti80

Did you mean to file this bug with the linter directly? In most cases, MegaLinter can't fix bugs in the linters we aggregate, because they are dependencies of this project, and their code doesn't live in this repository.

Kurt-von-Laven avatar Sep 03 '22 10:09 Kurt-von-Laven

Thanks Kurt for the quick response. Logged this on ansbiel-lint too.

fabricesemti80 avatar Sep 03 '22 10:09 fabricesemti80

Thank you! Are you able to reproduce the issue when running the linter directly rather than through MegaLinter?

Kurt-von-Laven avatar Sep 03 '22 10:09 Kurt-von-Laven

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Oct 04 '22 01:10 github-actions[bot]