summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/rule-var-naming-fail.yml
blob: 888ed72c01325bbe9a2ea2ea8bd59d17eed63989 (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
---
- name: Fixture
  hosts: localhost
  vars:
    CamelCaseIsBad: false # invalid 1
    this_is_valid: # valid because content is a dict, not a variable
      CamelCase: ...
      ALL_CAPS: ...
    ALL_CAPS_ARE_BAD_TOO: ... # invalid 2
    CamelCaseButErrorIgnored: true # noqa: var-naming

  tasks:
    - name: Foo
      ansible.builtin.set_fact:
        "{{ 'test_' }}var": "value" # noqa: var-naming[no-jinja]
    - name: Bar
      ansible.builtin.set_fact:
        CamelCaseButErrorIgnored: true # noqa: var-naming
    - name: Test in a block
      vars:
        BAD: false # invalid 3
        MoreBad: ... # invalid 4
      block:
        - name: Foo
          vars:
            ALL_CAPS_ARE_BAD_TOO: "{{ MoreBad }}" # invalid 5
          ansible.builtin.set_fact:
            CamelCaseIsBad: "{{ BAD }}" # invalid 6
    - name: Test on register
      ansible.builtin.debug:
        var: test_var
      register: CamelCaseIsBad # invalid 7