Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

args[module] flags variables violation #2866

Closed
timo-fc opened this issue Jan 4, 2023 · 2 comments · Fixed by #2929
Closed

args[module] flags variables violation #2866

timo-fc opened this issue Jan 4, 2023 · 2 comments · Fixed by #2929
Assignees
Labels

Comments

@timo-fc
Copy link

timo-fc commented Jan 4, 2023

Summary

The args[module] flags variables violation

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 6.10.2 using ansible 2.14.1
STEPS TO REPRODUCE

Here one example:

- name: "Add or modify pam limits"
  community.general.pam_limits:
    domain: "{{ item.domain }}"
    limit_type: "{{ item.limit_type }}"
    limit_item: "{{ item.limit_item }}"
    value: "{{ item.value }}"
  with_items:
    - { domain: "root", limit_type: "soft", limit_item: "nofile", value: "4096" }
    - { domain: "root", limit_type: "hard", limit_item: "nofile", value: "1048576" }

The ansible-lint error:

WARNING  Listing 1 violation(s) that are fatal
args[module]: value of limit_type must be one of: soft, hard, -, got: {{ item.limit_type }} (warning)
test.yml:2 Task/Handler: Add or modify pam limits

You can skip specific rules or tags by adding them to your configuration file:
# .config/ansible-lint.yml
warn_list:  # or 'skip_list' to silence them completely
  - experimental  # all rules tagged as experimental

                  Rule Violation Summary                   
 count tag          profile rule associated tags           
     1 args[module]         syntax, experimental (warning) 

Desired Behavior

Variable should be either ignored or the content of them should be parsed (but this is impossible in some cases).

In the current stay the only solution is to blacklist the test globally.

@timo-fc timo-fc added bug new Triage required labels Jan 4, 2023
@in-in
Copy link

in-in commented Jan 19, 2023

In my case, I use the Default filter and expect the check to take the default value, but instead I get a warning.

args[module]: value of scope must be one of: file, local, global, system, got: {{ item.scope | default("global") }} (warning)
- name: 'Git config'
  community.general.git_config:
    name: '{{ item.name }}'
    value: '{{ item.value }}'
    scope: '{{ item.scope | default("global") }}'
    repo: '{{ item.repo | default(None) }}'
  loop: '{{ git_config_data }}'

For the moment I skipped this check for this task with the skip_ansible_lint tag.

@timo-fc
Copy link
Author

timo-fc commented Jan 20, 2023

This is a good point default values in the template could be checked and setting them is not a problem.

@ssbarnea ssbarnea self-assigned this Jan 20, 2023
@ssbarnea ssbarnea removed the new Triage required label Jan 20, 2023
klaus-tux added a commit to klaus-tux/ansible-lint that referenced this issue Jan 23, 2023
ssbarnea pushed a commit that referenced this issue Jan 24, 2023
* Ignore args rule finding if value for choice has jinja template

Fixes: #2866

* Add correctly failing example for value not in choice

* make cspell happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants