From ba233a0cbad76b4783a03893e7bf4716fbc0f0ec Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 26 Jun 2024 08:24:58 +0200 Subject: Merging upstream version 24.6.1. Signed-off-by: Daniel Baumann --- .../playbooks/var-naming/rule-var-naming-fail.yml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 examples/playbooks/var-naming/rule-var-naming-fail.yml (limited to 'examples/playbooks/var-naming/rule-var-naming-fail.yml') diff --git a/examples/playbooks/var-naming/rule-var-naming-fail.yml b/examples/playbooks/var-naming/rule-var-naming-fail.yml new file mode 100644 index 0000000..3861cd9 --- /dev/null +++ b/examples/playbooks/var-naming/rule-var-naming-fail.yml @@ -0,0 +1,44 @@ +--- +- 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 + + - name: This should not trigger due to role name being dynamic (jinja) + ansible.builtin.include_role: + name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + vars: + nginx_logrotate_conf_enable: true + + - name: This should not trigger due to containing a dot in role name + ansible.builtin.include_role: + name: "foo.bar" + vars: + bar_foo: true -- cgit v1.2.3