Skip to content

Ansible-lint doesn't handle module_defaults #2953

Open
@Igorgro

Description

@Igorgro
Summary

Ansible-lint doesn't handle module_defaults and shows warning on every task, where this defaults are missing.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 6.11.1.dev0 using ansible 2.14.1
  • OS: Arch Linux
  • ansible installation method: OS package
  • ansible-lint installation method: OS package
STEPS TO REPRODUCE

Create playbook that uses module_defaults, for example:

- name: Configure mikrotik
  hosts: localhost
  module_defaults:
    community.routeros.api_modify:
      hostname: "10.10.10.1"
      username: "admin"
      password: "admin"
  tasks:
    - name: Get ip
      community.routeros.api: # the warning is showed here
        path: ip address
Desired Behavior

No warning is showed because all required arguments should be taken from module_defaults.

Actual Behavior

The following warning is showed:

WARNING  Listing 1 violation(s) that are fatal
args[module]: missing required arguments: hostname, password, username (warning)
playbook.yml:9 Task/Handler: Get ip

P.S. I think tis is common Ansible issue, because vscode extension and languge server do not handle this also. Should I also open similar issue there?

Metadata

Metadata

Assignees

Labels

bugfeedback-neededDivergent oppinions, additional feedback is desired in order to unblock it.

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions