-
Notifications
You must be signed in to change notification settings - Fork 705
Open
Description
Bug: no-free-form
Rule Only Auto-fixes FQCN, Not Short Module Name
Summary
The no-free-form
rule in ansible-lint detects and auto-fixes free-form (key=value) usage for modules when the fully qualified collection name (FQCN) is used (e.g., ansible.builtin.file
), but does not auto-fix when the short module name (e.g., file
) is used. This is inconsistent, as most users write tasks using the short module name.
Steps to Reproduce
-
Create a playbook with a task using the short module name in free-form:
- name: Example with discouraged free-form syntax hosts: localhost tasks: - name: mkdir /var/DS file: path=/var/DS state=directory mode=0755 owner=svc group=Infra
-
Run:
ansible-lint test.yaml --fix
-
The violation is detected, but the file is not auto-fixed.
-
Change the task to use the FQCN:
- name: mkdir /var/DS ansible.builtin.file: path=/var/DS state=directory mode=0755 owner=svc group=Infra
-
Run:
ansible-lint test.yaml --fix
-
The violation is detected and the file is auto-fixed to YAML dictionary style.
Expected Behavior
- The
no-free-form
rule should auto-fix free-form usage for both FQCN and short module names, as most playbooks use the short form.
Actual Behavior
- Auto-fix only works for FQCN, not for short module names.
Environment
- ansible-lint version:
ansible-lint 25.8.2 using ansible-core:2.17.1 ansible-compat:25.8.1 ruamel-yaml:0.18.15 ruamel-yaml-clib:0.2.12
- Python version:
Python 3.10.12
- OS: Ubuntu
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status