summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/rules/deprecated_command_syntax.md
blob: f99ca9951b265836cf2e64e1ca6d389e34264c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# deprecated-command-syntax

This rule identifies the use of shorthand (free-form) syntax as this is highly
discouraged inside playbooks, mainly because it can easily lead to bugs that
are hard to identify.

While using the free-form from the command line is ok, it should never be used
inside playbooks.

## Problematic Code

```yaml
---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Perform chmod
      ansible.builtin.command: creates=B chmod 644 A # <-- do not use shorthand
```

## Correct Code

```yaml
---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Perform chmod
      ansible.builtin.command: chmod 644 A
      args:
        creates: B
```