Skip to content

Variable naming standards different for tasks and blocks #1895

@t-woerner

Description

@t-woerner
Summary

Using uppercase variables in tasks are reported as `var-naming: Task defines variables within 'vars' section that violates variable naming standards´. The same variables for blocks are not reported.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
$ ansible --version
ansible [core 2.12.2]

$ ansible-lint --version
ansible-lint 5.4.0 using ansible 2.12.2
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Fedora 35

STEPS TO REPRODUCE

Using ansible-lint on this playbook

---
- name: Test
  hosts: localhost

  tasks:
  - block:
      - name: foo1
        debug: msg="{{ FOO }}"
    vars:
      FOO: fooo1

  - name: foo2
    debug: msg="{{ FOO }}"
    vars:
      FOO: fooo2

results in

Failed to guess project directory using git: 
WARNING  Overriding detected file kind 'yaml' with 'playbook' for given positional argument: test.yml
WARNING  Listing 1 violation(s) that are fatal
var-naming: Task defines variables within 'vars' section that violates variable naming standards
test.yml:12 Task/Handler: foo2

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

Finished with 0 failure(s), 1 warning(s) on 1 files.
Desired Behavior

The issue needs to be reported for the task and the block.

Actual Behavior

The issue is only reported for the task, but not the block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueBugs ideal for the first time, good for newcomers contributorshelp wanted

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions