From 2fe34b6444502079dc0b84365ce82dbc92de308e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:06:49 +0200 Subject: Adding upstream version 6.17.2. Signed-off-by: Daniel Baumann --- .../playbooks/.ansible-lint-only-builtins-allow | 13 + examples/playbooks/README.md | 2 + examples/playbooks/always-run-success.yml | 2 + examples/playbooks/become.transformed.yml | 15 + examples/playbooks/become.yml | 15 + examples/playbooks/block.yml | 26 + examples/playbooks/blockincludes.yml | 21 + examples/playbooks/blockincludes2.yml | 18 + examples/playbooks/bracketsmatchtest.yml | 4 + .../bug-core-warning-unique-filter-fallback.yml | 11 + examples/playbooks/capture-warning.yml | 8 + examples/playbooks/collections/.gitignore | 2 + examples/playbooks/command-check-failure.yml | 13 + examples/playbooks/command-check-success.yml | 63 ++ examples/playbooks/common-include-1.yml | 10 + examples/playbooks/common-include-2.yml | 7 + examples/playbooks/conflicting_action.yml | 12 + .../playbooks/contains_secrets.transformed.yml | 18 + examples/playbooks/contains_secrets.yml | 18 + examples/playbooks/custom_module.yml | 9 + examples/playbooks/deep/empty.yml | 4 + examples/playbooks/ematcher-rule.yml | 13 + examples/playbooks/empty_playbook.yml | 3 + examples/playbooks/example.yml | 49 + examples/playbooks/extra_vars.yml | 10 + examples/playbooks/find_children.yml | 10 + examples/playbooks/fqcn.transformed.yml | 16 + examples/playbooks/fqcn.yml | 16 + examples/playbooks/handlers/included-handlers.yml | 6 + examples/playbooks/handlers/y.yml | 3 + .../playbooks/include-import-tasks-in-role.yml | 5 + examples/playbooks/include-in-block.yml | 6 + examples/playbooks/include.yml | 18 + examples/playbooks/jinja-spacing.yml | 89 ++ examples/playbooks/json-schema-fail.yml | 4 + .../playbooks/lots_of_warnings.transformed.yml | 1000 ++++++++++++++++++++ examples/playbooks/lots_of_warnings.yml | 1000 ++++++++++++++++++++ examples/playbooks/mocked_dependency.yml | 10 + .../multiline-brackets-do-not-match-test.yml | 22 + examples/playbooks/multiline-bracketsmatchtest.yml | 22 + examples/playbooks/name-case.transformed.yml | 4 + examples/playbooks/name-case.yml | 4 + examples/playbooks/no_handler_fail.yml | 27 + examples/playbooks/no_handler_pass.yml | 84 ++ examples/playbooks/no_relative_paths_fail.yml | 23 + examples/playbooks/no_relative_paths_pass.yml | 14 + examples/playbooks/nomatches.yml | 9 + examples/playbooks/nomatchestest.transformed.yml | 9 + examples/playbooks/nomatchestest.yml | 9 + examples/playbooks/noqa-nested.yml | 9 + examples/playbooks/noqa.yml | 6 + examples/playbooks/norole.yml | 5 + examples/playbooks/norole2.yml | 5 + examples/playbooks/package-check-failure.yml | 21 + examples/playbooks/package-check-success.yml | 22 + examples/playbooks/pass-loop-var-prefix.yml | 18 + examples/playbooks/play-without-extension | 2 + examples/playbooks/play.yml | 6 + examples/playbooks/play_miss_include.yml | 5 + examples/playbooks/playbook-imported.yml | 11 + examples/playbooks/playbook-parent.yml | 9 + examples/playbooks/roles | 1 + examples/playbooks/rule-args-module-fail.yml | 37 + examples/playbooks/rule-args-module-pass.yml | 97 ++ examples/playbooks/rule-avoid-implicit-fail.yml | 9 + examples/playbooks/rule-avoid-implicit-pass.yml | 9 + .../rule-command-instead-of-module-fail.yml | 15 + .../rule-command-instead-of-module-pass.yml | 37 + .../rule-command-instead-of-shell-fail.yml | 25 + .../rule-command-instead-of-shell-pass.yml | 60 ++ .../playbooks/rule-deprecated-bare-vars-fail.yml | 97 ++ .../playbooks/rule-deprecated-bare-vars-pass.yml | 168 ++++ .../playbooks/rule-deprecated-command-syntax.yml | 7 + .../rule-deprecated-local-action-fail.yml | 7 + .../playbooks/rule-empty-string-compare-fail.yml | 16 + .../playbooks/rule-empty-string-compare-pass.yml | 16 + examples/playbooks/rule-fqcn-fail.yml | 14 + examples/playbooks/rule-fqcn-pass.yml | 13 + examples/playbooks/rule-jinja-fail.yml | 12 + examples/playbooks/rule-jinja-pass.yml | 83 ++ examples/playbooks/rule-key-order-fail.yml | 30 + examples/playbooks/rule-key-order-pass.yml | 16 + examples/playbooks/rule-name-casing.yml | 10 + examples/playbooks/rule-name-missing-fail.yml | 11 + examples/playbooks/rule-name-missing-pass.yml | 12 + examples/playbooks/rule-name-play-fail.yml | 3 + examples/playbooks/rule-name-templated-fail.yml | 13 + examples/playbooks/rule-no-changed-when-fail.yml | 15 + examples/playbooks/rule-no-changed-when-pass.yml | 23 + examples/playbooks/rule-no-free-form-fail.yml | 14 + examples/playbooks/rule-no-free-form-pass.yml | 19 + examples/playbooks/rule-no-handler-fail.yml | 15 + examples/playbooks/rule-no-handler-pass.yml | 15 + examples/playbooks/rule-no-jinja-when-fail.yml | 21 + examples/playbooks/rule-no-jinja-when-pass.yml | 17 + examples/playbooks/rule-no-prompting.yml | 27 + examples/playbooks/rule-no-tabs.yml | 20 + examples/playbooks/rule-only-builtins.yml | 12 + .../rule-partial-become-without-become-fail.yml | 28 + .../rule-partial-become-without-become-pass.yml | 35 + .../playbooks/rule-risky-file-permissions-fail.yml | 91 ++ .../playbooks/rule-risky-file-permissions-pass.yml | 77 ++ examples/playbooks/rule-risky-octal-fail.yml | 25 + examples/playbooks/rule-risky-octal-pass.yml | 42 + examples/playbooks/rule-risky-shell-pipe-fail.yml | 17 + examples/playbooks/rule-risky-shell-pipe-pass.yml | 70 ++ examples/playbooks/rule-role-name-path.yml | 10 + .../playbooks/rule-schema-become-method-fail.yml | 10 + .../playbooks/rule-schema-become-method-pass.yml | 5 + examples/playbooks/rule-syntax-moves.yml | 16 + .../rule-validate-module-options-pass-2.yml | 10 + examples/playbooks/rule-var-naming-fail.yml | 32 + examples/playbooks/rule-yaml-fail.yml | 18 + examples/playbooks/rule-yaml-pass.yml | 7 + examples/playbooks/rule_literal_compare_fail.yml | 19 + examples/playbooks/rule_literal_compare_pass.yml | 25 + examples/playbooks/rulebook.yml | 21 + examples/playbooks/run-once-fail.yml | 12 + examples/playbooks/run-once-pass.yml | 8 + examples/playbooks/schema-error-string.yml | 4 + examples/playbooks/skiptasks.yml | 64 ++ examples/playbooks/strict-mode.yml | 8 + examples/playbooks/syntax-error-string.yml | 7 + examples/playbooks/syntax-error.yml | 6 + examples/playbooks/task_in_list-0.yml | 28 + examples/playbooks/taskimports.yml | 16 + examples/playbooks/taskincludes.yml | 11 + examples/playbooks/tasks/bug-2875.yml | 9 + .../tasks/conflicting-action-statements.yml | 3 + .../playbooks/tasks/directory with spaces/main.yml | 4 + examples/playbooks/tasks/empty_blocks.yml | 17 + .../playbooks/tasks/include-in-block-inner.yml | 5 + .../playbooks/tasks/included-task-with-vars.yml | 4 + examples/playbooks/tasks/included-with-lint.yml | 4 + examples/playbooks/tasks/malformed.yml | 3 + examples/playbooks/tasks/nestedincludes.yml | 3 + examples/playbooks/tasks/passing_task.yml | 4 + examples/playbooks/tasks/rule-name-prefix-fail.yml | 13 + examples/playbooks/tasks/simple_task.yml | 4 + examples/playbooks/tasks/vars/bug-3289.yml | 2 + examples/playbooks/tasks/varset.yml | 4 + examples/playbooks/tasks/varunset.yml | 2 + examples/playbooks/tasks/x.yml | 7 + examples/playbooks/templates/not-valid.yaml | 2 + ...t_import_with_conflicting_action_statements.yml | 4 + examples/playbooks/test_import_with_malformed.yml | 4 + examples/playbooks/test_include_inplace.yml | 5 + examples/playbooks/test_include_relative.yml | 6 + examples/playbooks/test_skip_inside_yaml.yml | 64 ++ examples/playbooks/unicode.transformed.yml | 8 + examples/playbooks/unicode.yml | 8 + examples/playbooks/valid.yml | 4 + examples/playbooks/valid_with_alt_extension.yaml | 7 + examples/playbooks/vars/empty.transformed.yml | 3 + examples/playbooks/vars/empty.yml | 3 + examples/playbooks/vars/empty_vars.transformed.yml | 2 + examples/playbooks/vars/empty_vars.yml | 2 + examples/playbooks/vars/invalid_vars_schema.yml | 2 + examples/playbooks/vars/jinja-spacing.yml | 41 + examples/playbooks/vars/other.yml | 2 + examples/playbooks/vars/rule_jinja_vars.yml | 5 + examples/playbooks/vars/rule_var_naming_fail.yml | 14 + examples/playbooks/vars/strings.transformed.yml | 39 + examples/playbooks/vars/strings.yml | 45 + examples/playbooks/vars/subfolder/settings.yml | 2 + examples/playbooks/vars/vault_full.yml | 11 + examples/playbooks/vars/vault_partial.yml | 8 + examples/playbooks/warning-from-module.yml | 11 + examples/playbooks/with-skip-tag-id.yml | 7 + "examples/playbooks/with-umlaut-\303\244.yml" | 5 + 170 files changed, 5035 insertions(+) create mode 100644 examples/playbooks/.ansible-lint-only-builtins-allow create mode 100644 examples/playbooks/README.md create mode 100644 examples/playbooks/always-run-success.yml create mode 100644 examples/playbooks/become.transformed.yml create mode 100644 examples/playbooks/become.yml create mode 100644 examples/playbooks/block.yml create mode 100644 examples/playbooks/blockincludes.yml create mode 100644 examples/playbooks/blockincludes2.yml create mode 100644 examples/playbooks/bracketsmatchtest.yml create mode 100644 examples/playbooks/bug-core-warning-unique-filter-fallback.yml create mode 100644 examples/playbooks/capture-warning.yml create mode 100644 examples/playbooks/collections/.gitignore create mode 100644 examples/playbooks/command-check-failure.yml create mode 100644 examples/playbooks/command-check-success.yml create mode 100644 examples/playbooks/common-include-1.yml create mode 100644 examples/playbooks/common-include-2.yml create mode 100644 examples/playbooks/conflicting_action.yml create mode 100644 examples/playbooks/contains_secrets.transformed.yml create mode 100644 examples/playbooks/contains_secrets.yml create mode 100644 examples/playbooks/custom_module.yml create mode 100644 examples/playbooks/deep/empty.yml create mode 100644 examples/playbooks/ematcher-rule.yml create mode 100644 examples/playbooks/empty_playbook.yml create mode 100644 examples/playbooks/example.yml create mode 100644 examples/playbooks/extra_vars.yml create mode 100644 examples/playbooks/find_children.yml create mode 100644 examples/playbooks/fqcn.transformed.yml create mode 100644 examples/playbooks/fqcn.yml create mode 100644 examples/playbooks/handlers/included-handlers.yml create mode 100644 examples/playbooks/handlers/y.yml create mode 100644 examples/playbooks/include-import-tasks-in-role.yml create mode 100644 examples/playbooks/include-in-block.yml create mode 100644 examples/playbooks/include.yml create mode 100644 examples/playbooks/jinja-spacing.yml create mode 100644 examples/playbooks/json-schema-fail.yml create mode 100644 examples/playbooks/lots_of_warnings.transformed.yml create mode 100644 examples/playbooks/lots_of_warnings.yml create mode 100644 examples/playbooks/mocked_dependency.yml create mode 100644 examples/playbooks/multiline-brackets-do-not-match-test.yml create mode 100644 examples/playbooks/multiline-bracketsmatchtest.yml create mode 100644 examples/playbooks/name-case.transformed.yml create mode 100644 examples/playbooks/name-case.yml create mode 100644 examples/playbooks/no_handler_fail.yml create mode 100644 examples/playbooks/no_handler_pass.yml create mode 100644 examples/playbooks/no_relative_paths_fail.yml create mode 100644 examples/playbooks/no_relative_paths_pass.yml create mode 100644 examples/playbooks/nomatches.yml create mode 100644 examples/playbooks/nomatchestest.transformed.yml create mode 100644 examples/playbooks/nomatchestest.yml create mode 100644 examples/playbooks/noqa-nested.yml create mode 100644 examples/playbooks/noqa.yml create mode 100644 examples/playbooks/norole.yml create mode 100644 examples/playbooks/norole2.yml create mode 100644 examples/playbooks/package-check-failure.yml create mode 100644 examples/playbooks/package-check-success.yml create mode 100644 examples/playbooks/pass-loop-var-prefix.yml create mode 100644 examples/playbooks/play-without-extension create mode 100644 examples/playbooks/play.yml create mode 100644 examples/playbooks/play_miss_include.yml create mode 100644 examples/playbooks/playbook-imported.yml create mode 100644 examples/playbooks/playbook-parent.yml create mode 120000 examples/playbooks/roles create mode 100644 examples/playbooks/rule-args-module-fail.yml create mode 100644 examples/playbooks/rule-args-module-pass.yml create mode 100644 examples/playbooks/rule-avoid-implicit-fail.yml create mode 100644 examples/playbooks/rule-avoid-implicit-pass.yml create mode 100644 examples/playbooks/rule-command-instead-of-module-fail.yml create mode 100644 examples/playbooks/rule-command-instead-of-module-pass.yml create mode 100644 examples/playbooks/rule-command-instead-of-shell-fail.yml create mode 100644 examples/playbooks/rule-command-instead-of-shell-pass.yml create mode 100644 examples/playbooks/rule-deprecated-bare-vars-fail.yml create mode 100644 examples/playbooks/rule-deprecated-bare-vars-pass.yml create mode 100644 examples/playbooks/rule-deprecated-command-syntax.yml create mode 100644 examples/playbooks/rule-deprecated-local-action-fail.yml create mode 100644 examples/playbooks/rule-empty-string-compare-fail.yml create mode 100644 examples/playbooks/rule-empty-string-compare-pass.yml create mode 100644 examples/playbooks/rule-fqcn-fail.yml create mode 100644 examples/playbooks/rule-fqcn-pass.yml create mode 100644 examples/playbooks/rule-jinja-fail.yml create mode 100644 examples/playbooks/rule-jinja-pass.yml create mode 100644 examples/playbooks/rule-key-order-fail.yml create mode 100644 examples/playbooks/rule-key-order-pass.yml create mode 100644 examples/playbooks/rule-name-casing.yml create mode 100644 examples/playbooks/rule-name-missing-fail.yml create mode 100644 examples/playbooks/rule-name-missing-pass.yml create mode 100644 examples/playbooks/rule-name-play-fail.yml create mode 100644 examples/playbooks/rule-name-templated-fail.yml create mode 100644 examples/playbooks/rule-no-changed-when-fail.yml create mode 100644 examples/playbooks/rule-no-changed-when-pass.yml create mode 100644 examples/playbooks/rule-no-free-form-fail.yml create mode 100644 examples/playbooks/rule-no-free-form-pass.yml create mode 100644 examples/playbooks/rule-no-handler-fail.yml create mode 100644 examples/playbooks/rule-no-handler-pass.yml create mode 100644 examples/playbooks/rule-no-jinja-when-fail.yml create mode 100644 examples/playbooks/rule-no-jinja-when-pass.yml create mode 100644 examples/playbooks/rule-no-prompting.yml create mode 100644 examples/playbooks/rule-no-tabs.yml create mode 100644 examples/playbooks/rule-only-builtins.yml create mode 100644 examples/playbooks/rule-partial-become-without-become-fail.yml create mode 100644 examples/playbooks/rule-partial-become-without-become-pass.yml create mode 100644 examples/playbooks/rule-risky-file-permissions-fail.yml create mode 100644 examples/playbooks/rule-risky-file-permissions-pass.yml create mode 100644 examples/playbooks/rule-risky-octal-fail.yml create mode 100644 examples/playbooks/rule-risky-octal-pass.yml create mode 100644 examples/playbooks/rule-risky-shell-pipe-fail.yml create mode 100644 examples/playbooks/rule-risky-shell-pipe-pass.yml create mode 100644 examples/playbooks/rule-role-name-path.yml create mode 100644 examples/playbooks/rule-schema-become-method-fail.yml create mode 100644 examples/playbooks/rule-schema-become-method-pass.yml create mode 100644 examples/playbooks/rule-syntax-moves.yml create mode 100644 examples/playbooks/rule-validate-module-options-pass-2.yml create mode 100644 examples/playbooks/rule-var-naming-fail.yml create mode 100644 examples/playbooks/rule-yaml-fail.yml create mode 100644 examples/playbooks/rule-yaml-pass.yml create mode 100644 examples/playbooks/rule_literal_compare_fail.yml create mode 100644 examples/playbooks/rule_literal_compare_pass.yml create mode 100644 examples/playbooks/rulebook.yml create mode 100644 examples/playbooks/run-once-fail.yml create mode 100644 examples/playbooks/run-once-pass.yml create mode 100644 examples/playbooks/schema-error-string.yml create mode 100644 examples/playbooks/skiptasks.yml create mode 100644 examples/playbooks/strict-mode.yml create mode 100644 examples/playbooks/syntax-error-string.yml create mode 100644 examples/playbooks/syntax-error.yml create mode 100644 examples/playbooks/task_in_list-0.yml create mode 100644 examples/playbooks/taskimports.yml create mode 100644 examples/playbooks/taskincludes.yml create mode 100644 examples/playbooks/tasks/bug-2875.yml create mode 100644 examples/playbooks/tasks/conflicting-action-statements.yml create mode 100644 examples/playbooks/tasks/directory with spaces/main.yml create mode 100644 examples/playbooks/tasks/empty_blocks.yml create mode 100644 examples/playbooks/tasks/include-in-block-inner.yml create mode 100644 examples/playbooks/tasks/included-task-with-vars.yml create mode 100644 examples/playbooks/tasks/included-with-lint.yml create mode 100644 examples/playbooks/tasks/malformed.yml create mode 100644 examples/playbooks/tasks/nestedincludes.yml create mode 100644 examples/playbooks/tasks/passing_task.yml create mode 100644 examples/playbooks/tasks/rule-name-prefix-fail.yml create mode 100644 examples/playbooks/tasks/simple_task.yml create mode 100644 examples/playbooks/tasks/vars/bug-3289.yml create mode 100644 examples/playbooks/tasks/varset.yml create mode 100644 examples/playbooks/tasks/varunset.yml create mode 100644 examples/playbooks/tasks/x.yml create mode 100644 examples/playbooks/templates/not-valid.yaml create mode 100644 examples/playbooks/test_import_with_conflicting_action_statements.yml create mode 100644 examples/playbooks/test_import_with_malformed.yml create mode 100644 examples/playbooks/test_include_inplace.yml create mode 100644 examples/playbooks/test_include_relative.yml create mode 100644 examples/playbooks/test_skip_inside_yaml.yml create mode 100644 examples/playbooks/unicode.transformed.yml create mode 100644 examples/playbooks/unicode.yml create mode 100644 examples/playbooks/valid.yml create mode 100644 examples/playbooks/valid_with_alt_extension.yaml create mode 100644 examples/playbooks/vars/empty.transformed.yml create mode 100644 examples/playbooks/vars/empty.yml create mode 100644 examples/playbooks/vars/empty_vars.transformed.yml create mode 100644 examples/playbooks/vars/empty_vars.yml create mode 100644 examples/playbooks/vars/invalid_vars_schema.yml create mode 100644 examples/playbooks/vars/jinja-spacing.yml create mode 100644 examples/playbooks/vars/other.yml create mode 100644 examples/playbooks/vars/rule_jinja_vars.yml create mode 100644 examples/playbooks/vars/rule_var_naming_fail.yml create mode 100644 examples/playbooks/vars/strings.transformed.yml create mode 100644 examples/playbooks/vars/strings.yml create mode 100644 examples/playbooks/vars/subfolder/settings.yml create mode 100644 examples/playbooks/vars/vault_full.yml create mode 100644 examples/playbooks/vars/vault_partial.yml create mode 100644 examples/playbooks/warning-from-module.yml create mode 100644 examples/playbooks/with-skip-tag-id.yml create mode 100644 "examples/playbooks/with-umlaut-\303\244.yml" (limited to 'examples/playbooks') diff --git a/examples/playbooks/.ansible-lint-only-builtins-allow b/examples/playbooks/.ansible-lint-only-builtins-allow new file mode 100644 index 0000000..ddcbe6c --- /dev/null +++ b/examples/playbooks/.ansible-lint-only-builtins-allow @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json +# Mock modules or roles in order to pass ansible-playbook --syntax-check +mock_modules: + - fake_namespace.fake_collection.fake_module + +only_builtins_allow_collections: + - fake_namespace.fake_collection +only_builtins_allow_modules: + - zuul_return + +# skip rule to test builtin rule +skip_list: + - args[module] diff --git a/examples/playbooks/README.md b/examples/playbooks/README.md new file mode 100644 index 0000000..48965c2 --- /dev/null +++ b/examples/playbooks/README.md @@ -0,0 +1,2 @@ +The `./roles` symlink helps Ansible find local roles used by files from +current directory. diff --git a/examples/playbooks/always-run-success.yml b/examples/playbooks/always-run-success.yml new file mode 100644 index 0000000..43d1fea --- /dev/null +++ b/examples/playbooks/always-run-success.yml @@ -0,0 +1,2 @@ +--- +- hosts: localhost diff --git a/examples/playbooks/become.transformed.yml b/examples/playbooks/become.transformed.yml new file mode 100644 index 0000000..ce53f56 --- /dev/null +++ b/examples/playbooks/become.transformed.yml @@ -0,0 +1,15 @@ +--- +- name: Fixture + hosts: all + tasks: + - name: Clone content repository + ansible.builtin.git: + repo: "{{ archive_services_repo_url }}" + dest: /home/www + accept_hostkey: true + version: master + update: false + become: true + become_user: nobody + notify: + - restart apache2 diff --git a/examples/playbooks/become.yml b/examples/playbooks/become.yml new file mode 100644 index 0000000..ce53f56 --- /dev/null +++ b/examples/playbooks/become.yml @@ -0,0 +1,15 @@ +--- +- name: Fixture + hosts: all + tasks: + - name: Clone content repository + ansible.builtin.git: + repo: "{{ archive_services_repo_url }}" + dest: /home/www + accept_hostkey: true + version: master + update: false + become: true + become_user: nobody + notify: + - restart apache2 diff --git a/examples/playbooks/block.yml b/examples/playbooks/block.yml new file mode 100644 index 0000000..6194cc6 --- /dev/null +++ b/examples/playbooks/block.yml @@ -0,0 +1,26 @@ +--- +- hosts: all + + pre_tasks: + - { import_tasks: does-not-exist.yml } + + tasks: + - block: + - name: Successful debug message + debug: msg='i execute normally' + - name: Failure command + ansible.builtin.command: /bin/false + changed_when: false + - name: Never reached debug message + debug: msg='i never execute, cause ERROR!' + rescue: + - name: Exception debug message + ansible.builtin.debug: msg='I caught an error' + - name: Another failure command + ansible.builtin.command: /bin/false + changed_when: false + - name: Another missed debug message + debug: msg='I also never execute :-(' + always: + - name: Always reached debug message + ansible.builtin.debug: msg="this always executes" diff --git a/examples/playbooks/blockincludes.yml b/examples/playbooks/blockincludes.yml new file mode 100644 index 0000000..b8387a8 --- /dev/null +++ b/examples/playbooks/blockincludes.yml @@ -0,0 +1,21 @@ +--- +- name: Fixture + hosts: localhost + vars: + varset: varset + tasks: + - name: Block level 1 + block: + - name: Include under block level 1 # noqa: fqcn + include_tasks: tasks/nestedincludes.yml + - name: Block level 2 + block: + # - include_tasks: "{{ varnotset }}.yml" + - name: Block level 3 + block: + - name: Include under block level 3 # noqa: deprecated-module + ansible.builtin.include: "{{ varset }}.yml" + - name: Block level 4 + block: + - name: INCLUDE under block level 4 + ansible.builtin.include_tasks: tasks/directory with spaces/main.yml diff --git a/examples/playbooks/blockincludes2.yml b/examples/playbooks/blockincludes2.yml new file mode 100644 index 0000000..f11667b --- /dev/null +++ b/examples/playbooks/blockincludes2.yml @@ -0,0 +1,18 @@ +--- +- name: Fixture + hosts: webservers + vars: + varset: varset + tasks: + - name: I am a block + block: + - name: Include under block + ansible.builtin.include_tasks: tasks/nestedincludes.yml + # - block: + # - include_tasks: "{{ varnotset }}.yml" + rescue: + - name: Include under rescue + ansible.builtin.include_tasks: "{{ varset }}.yml" + always: + - name: Include under always + ansible.builtin.include_tasks: tasks/directory with spaces/main.yml diff --git a/examples/playbooks/bracketsmatchtest.yml b/examples/playbooks/bracketsmatchtest.yml new file mode 100644 index 0000000..3b335ff --- /dev/null +++ b/examples/playbooks/bracketsmatchtest.yml @@ -0,0 +1,4 @@ +--- +val1: "{{dest}}" +val2: worry +val3: "{{victory}}" diff --git a/examples/playbooks/bug-core-warning-unique-filter-fallback.yml b/examples/playbooks/bug-core-warning-unique-filter-fallback.yml new file mode 100644 index 0000000..5639668 --- /dev/null +++ b/examples/playbooks/bug-core-warning-unique-filter-fallback.yml @@ -0,0 +1,11 @@ +--- +- name: Fixture for test_bug_3216 + hosts: localhost + gather_facts: false + tasks: + - name: Set fact + ansible.builtin.set_fact: + qq: ["qq", "ww"] + - name: Print it + ansible.builtin.debug: + msg: "{{ qq | unique }}" diff --git a/examples/playbooks/capture-warning.yml b/examples/playbooks/capture-warning.yml new file mode 100644 index 0000000..ee20690 --- /dev/null +++ b/examples/playbooks/capture-warning.yml @@ -0,0 +1,8 @@ +--- +- name: Fixture to generate a warning + hosts: localhost + tasks: + - name: Generate a warning + ansible.builtin.debug: + msg: "This is a warning" + when: "{{ false }}" # noqa: 102 jinja[spacing] diff --git a/examples/playbooks/collections/.gitignore b/examples/playbooks/collections/.gitignore new file mode 100644 index 0000000..3cd6e1c --- /dev/null +++ b/examples/playbooks/collections/.gitignore @@ -0,0 +1,2 @@ +ansible_collections +requirements.yml diff --git a/examples/playbooks/command-check-failure.yml b/examples/playbooks/command-check-failure.yml new file mode 100644 index 0000000..f249ddd --- /dev/null +++ b/examples/playbooks/command-check-failure.yml @@ -0,0 +1,13 @@ +--- +- hosts: localhost + tasks: + - name: Command without checks + ansible.builtin.command: echo blah + args: + chdir: X + + - name: Shell without checks + ansible.builtin.shell: echo blah + args: + chdir: X + become_method: xx diff --git a/examples/playbooks/command-check-success.yml b/examples/playbooks/command-check-success.yml new file mode 100644 index 0000000..2a8e43d --- /dev/null +++ b/examples/playbooks/command-check-success.yml @@ -0,0 +1,63 @@ +--- +- name: Fixture for no-changed-when + hosts: localhost + tasks: + - name: Command with creates check + ansible.builtin.command: echo blah + args: + creates: Z + + - name: Command with removes check + ansible.builtin.command: echo blah + args: + removes: Z + + - name: Command with changed_when + ansible.builtin.command: echo blah + changed_when: false + + - name: Command with inline creates # noqa: no-free-form + ansible.builtin.command: creates=Z echo blah + + - name: Command with inline removes # noqa: no-free-form + ansible.builtin.command: removes=Z echo blah + + - name: Command with cmd # noqa: fqcn[action-core] + command: + cmd: echo blah + args: + creates: Z + + - name: Use shell with creates check # noqa: fqcn[action-core] command-instead-of-shell + shell: echo blah + args: + creates: Z + + - name: Use shell with removes check # noqa: fqcn[action-core] command-instead-of-shell + shell: echo blah + args: + removes: Z + + - name: Use shell with changed_when # noqa: fqcn[action-core] command-instead-of-shell + shell: echo blah + changed_when: false + + - name: Use shell with inline creates # noqa: fqcn[action-core] no-free-form command-instead-of-shell + shell: creates=Z echo blah + + - name: Use shell with inline removes # noqa: fqcn[action-core] no-free-form command-instead-of-shell + shell: removes=Z echo blah + + - name: Use shell with cmd # noqa: fqcn[action-core] command-instead-of-shell + shell: + cmd: echo blah + args: + creates: Z + +- name: Fixture + hosts: localhost + handlers: + - name: Restart something # noqa: fqcn[action-core] no-changed-when + command: do something + - name: Foo # noqa: fqcn[action-core] deprecated-module + include: handlers/included-handlers.yml diff --git a/examples/playbooks/common-include-1.yml b/examples/playbooks/common-include-1.yml new file mode 100644 index 0000000..3a4691f --- /dev/null +++ b/examples/playbooks/common-include-1.yml @@ -0,0 +1,10 @@ +--- +- name: Fixture for test_files_not_scanned_twice + hosts: localhost + gather_facts: false + tasks: + - name: Some include + ansible.builtin.import_tasks: tasks/included-with-lint.yml + - name: Some include_tasks with file and jinja2 + ansible.builtin.include_tasks: + file: "{{ 'tasks/included-with-lint.yml' }}" diff --git a/examples/playbooks/common-include-2.yml b/examples/playbooks/common-include-2.yml new file mode 100644 index 0000000..b3a942b --- /dev/null +++ b/examples/playbooks/common-include-2.yml @@ -0,0 +1,7 @@ +--- +- name: Fixture + hosts: localhost + gather_facts: false + tasks: + - name: Some include + ansible.builtin.include_tasks: tasks/included-with-lint.yml diff --git a/examples/playbooks/conflicting_action.yml b/examples/playbooks/conflicting_action.yml new file mode 100644 index 0000000..5355323 --- /dev/null +++ b/examples/playbooks/conflicting_action.yml @@ -0,0 +1,12 @@ +--- +- hosts: localhost + tasks: + - name: Foo + ansible.builtin.debug: + msg: bar + ansible.builtin.command: echo +# On this file ansible-playbook --syntax-check reports: +# ERROR! conflicting action statements: debug, command +# +# The error appears to be in 'test/conflicting_action.yml': line 3, column 7, but may +# be elsewhere in the file depending on the exact syntax problem. diff --git a/examples/playbooks/contains_secrets.transformed.yml b/examples/playbooks/contains_secrets.transformed.yml new file mode 100644 index 0000000..cf5388c --- /dev/null +++ b/examples/playbooks/contains_secrets.transformed.yml @@ -0,0 +1,18 @@ +--- +- name: Fixture + hosts: localhost + vars: + plain: hello123 + # spell-checker: disable-next-line + # just 'hello123' encrypted with 'letmein' for test purposes + secret: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 63346434613163653866303630313238626164313961613935373137323639636333393338386232 + 3735313061316666343839343665383036623237353263310a623639336530383433343833653138 + 30393032393534316164613834393864616566646164363830316664623636643731383164376163 + 3736653037356435310a303533383533353739323834343637366438633766666163656330343631 + 3066 + tasks: + - name: Just a debug task + ansible.builtin.debug: + msg: hello world diff --git a/examples/playbooks/contains_secrets.yml b/examples/playbooks/contains_secrets.yml new file mode 100644 index 0000000..cf5388c --- /dev/null +++ b/examples/playbooks/contains_secrets.yml @@ -0,0 +1,18 @@ +--- +- name: Fixture + hosts: localhost + vars: + plain: hello123 + # spell-checker: disable-next-line + # just 'hello123' encrypted with 'letmein' for test purposes + secret: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 63346434613163653866303630313238626164313961613935373137323639636333393338386232 + 3735313061316666343839343665383036623237353263310a623639336530383433343833653138 + 30393032393534316164613834393864616566646164363830316664623636643731383164376163 + 3736653037356435310a303533383533353739323834343637366438633766666163656330343631 + 3066 + tasks: + - name: Just a debug task + ansible.builtin.debug: + msg: hello world diff --git a/examples/playbooks/custom_module.yml b/examples/playbooks/custom_module.yml new file mode 100644 index 0000000..05c4a87 --- /dev/null +++ b/examples/playbooks/custom_module.yml @@ -0,0 +1,9 @@ +--- +- name: Fixture + hosts: localhost + gather_facts: false + tags: + - "{{ foo }}" + tasks: + - name: Run custom module # noqa: fqcn[action] + fake_module: {} diff --git a/examples/playbooks/deep/empty.yml b/examples/playbooks/deep/empty.yml new file mode 100644 index 0000000..722df73 --- /dev/null +++ b/examples/playbooks/deep/empty.yml @@ -0,0 +1,4 @@ +--- +- name: some playbook with incorrect name # <- should raise name[casing] + hosts: localhost + tasks: [] diff --git a/examples/playbooks/ematcher-rule.yml b/examples/playbooks/ematcher-rule.yml new file mode 100644 index 0000000..7d64127 --- /dev/null +++ b/examples/playbooks/ematcher-rule.yml @@ -0,0 +1,13 @@ +--- +- hosts: localhost + name: BANNED +- hosts: localhost + name: Another BANNED line + tasks: + - name: Foo + debug: + msg: A 3rd BANNED line + + - name: Bar + ansible.builtin.command: echo something + changed_when: false diff --git a/examples/playbooks/empty_playbook.yml b/examples/playbooks/empty_playbook.yml new file mode 100644 index 0000000..271de72 --- /dev/null +++ b/examples/playbooks/empty_playbook.yml @@ -0,0 +1,3 @@ +# an empty playbook which makes ansible-playbook --syntax-check report +# ERROR! Empty playbook, nothing to do +# with exit code 4 diff --git a/examples/playbooks/example.yml b/examples/playbooks/example.yml new file mode 100644 index 0000000..fa1a635 --- /dev/null +++ b/examples/playbooks/example.yml @@ -0,0 +1,49 @@ +--- +- name: Fixture for test_example + hosts: webservers + vars: + old_school: 1.2.3 + bracket: and close bracket + + tasks: + - name: Unset variable + action: ansible.builtin.command echo {{this_variable}} is not set in this playbook + + - name: Trailing whitespace + action: ansible.builtin.command echo do nothing + + - name: Run git check + action: ansible.builtin.git a=b c=d + + - name: Run git check 2 + action: ansible.builtin.git version=HEAD c=d + + - name: Run git check 3 + ansible.builtin.git: version=a1b2c3d4 repo=xyz bobbins=d + + - name: Executing git through command + action: ansible.builtin.command git clone blah + + - name: Executing git through command + action: ansible.builtin.command chdir=bobbins creates=whatever /usr/bin/git clone blah + + - name: Using git module + action: ansible.builtin.git repo=blah + + - name: Passing git as an argument to another task + action: ansible.builtin.debug msg="{{item}}" + with_items: + - git # yamllint wrong indentation + - bobbins + + - name: Yum latest + ansible.builtin.yum: state=latest name=httpd + + - ansible.builtin.debug: msg="debug task without a name" + + - name: Run apt latest + ansible.builtin.apt: state=latest name=apache2 + + - ansible.builtin.meta: flush_handlers + # empty task is currently accepted by ansible as valid code but not our schemas: + - diff --git a/examples/playbooks/extra_vars.yml b/examples/playbooks/extra_vars.yml new file mode 100644 index 0000000..3cb9f43 --- /dev/null +++ b/examples/playbooks/extra_vars.yml @@ -0,0 +1,10 @@ +--- +- name: Fixture for test_extra_vars_passed_to_command test + hosts: all + tags: + - baz + - "{{ foo }}" + tasks: + - name: Show `complex_variable` value loaded from `extra_vars` + ansible.builtin.debug: + msg: "{{ complex_variable }}" diff --git a/examples/playbooks/find_children.yml b/examples/playbooks/find_children.yml new file mode 100644 index 0000000..9e7a6df --- /dev/null +++ b/examples/playbooks/find_children.yml @@ -0,0 +1,10 @@ +--- +# Bug reproducer https://github.com/ansible/ansible-lint/issues/2846 +- name: Play + hosts: localhost + gather_facts: false + connection: local + roles: + - role: acme.sample4 + vars: + date_ko_1: "{{ lookup('pipe', 'date') }}" diff --git a/examples/playbooks/fqcn.transformed.yml b/examples/playbooks/fqcn.transformed.yml new file mode 100644 index 0000000..2b758bc --- /dev/null +++ b/examples/playbooks/fqcn.transformed.yml @@ -0,0 +1,16 @@ +--- +- name: FQCN transform test file + hosts: localhost + tasks: + - name: Rewrite shell to ansible.builtin.shell via the fqcn[action-core] transform # noqa: command-instead-of-shell + ansible.builtin.shell: echo This rule should get matched by the fqcn[action-core] rule + changed_when: false + - name: Rewrite openssh_keypair to community.crypto.openssh_keypair via the fqcn[action] transform + community.crypto.openssh_keypair: + path: /tmp/supersecret + - name: Rewrite ansible.builtin.synchronize to ansible.posix.synchronize via the fqcn[canonical] transform + ansible.posix.synchronize: + src: dummy + dest: dummy2 + owner: false + group: false diff --git a/examples/playbooks/fqcn.yml b/examples/playbooks/fqcn.yml new file mode 100644 index 0000000..0e64a83 --- /dev/null +++ b/examples/playbooks/fqcn.yml @@ -0,0 +1,16 @@ +--- +- name: FQCN transform test file + hosts: localhost + tasks: + - name: Rewrite shell to ansible.builtin.shell via the fqcn[action-core] transform # noqa: command-instead-of-shell + shell: echo This rule should get matched by the fqcn[action-core] rule + changed_when: false + - name: Rewrite openssh_keypair to community.crypto.openssh_keypair via the fqcn[action] transform + openssh_keypair: + path: /tmp/supersecret + - name: Rewrite ansible.builtin.synchronize to ansible.posix.synchronize via the fqcn[canonical] transform + ansible.builtin.synchronize: + src: dummy + dest: dummy2 + owner: false + group: false diff --git a/examples/playbooks/handlers/included-handlers.yml b/examples/playbooks/handlers/included-handlers.yml new file mode 100644 index 0000000..6dec22d --- /dev/null +++ b/examples/playbooks/handlers/included-handlers.yml @@ -0,0 +1,6 @@ +--- +- name: Restart xyz # noqa: no-free-form fqcn[action-core] + service: name=xyz state=restarted +# see Issue #165 +- name: Command handler issue 165 # noqa: fqcn[action-core] no-changed-when + command: do something diff --git a/examples/playbooks/handlers/y.yml b/examples/playbooks/handlers/y.yml new file mode 100644 index 0000000..cd984f8 --- /dev/null +++ b/examples/playbooks/handlers/y.yml @@ -0,0 +1,3 @@ +--- +- name: Funny handler + action: service name=funny state=started force=true diff --git a/examples/playbooks/include-import-tasks-in-role.yml b/examples/playbooks/include-import-tasks-in-role.yml new file mode 100644 index 0000000..26a658a --- /dev/null +++ b/examples/playbooks/include-import-tasks-in-role.yml @@ -0,0 +1,5 @@ +--- +- name: Fixture + hosts: all + roles: + - role_with_task_inclusions diff --git a/examples/playbooks/include-in-block.yml b/examples/playbooks/include-in-block.yml new file mode 100644 index 0000000..9f3a8fe --- /dev/null +++ b/examples/playbooks/include-in-block.yml @@ -0,0 +1,6 @@ +--- +- name: Fixture + hosts: all + tasks: + - name: Include + ansible.builtin.include_tasks: tasks/include-in-block-inner.yml diff --git a/examples/playbooks/include.yml b/examples/playbooks/include.yml new file mode 100644 index 0000000..5596728 --- /dev/null +++ b/examples/playbooks/include.yml @@ -0,0 +1,18 @@ +--- +- hosts: bobbins + + pre_tasks: + - ansible.builtin.include_tasks: tasks/x.yml + + roles: + - hello + - { role: more_complex, t: z } + + tasks: + - ansible.builtin.include_tasks: tasks/x.yml + - ansible.builtin.include_tasks: tasks/x.yml y=z + + handlers: + - ansible.builtin.include_tasks: handlers/y.yml + +- ansible.builtin.include_tasks: play.yml diff --git a/examples/playbooks/jinja-spacing.yml b/examples/playbooks/jinja-spacing.yml new file mode 100644 index 0000000..b6824c2 --- /dev/null +++ b/examples/playbooks/jinja-spacing.yml @@ -0,0 +1,89 @@ +--- +# Should raise jinja[spacing] at tasks line 23, 26, 29, 54, 65 +- name: Fixture for testing jinja2[spacing] + hosts: all + tasks: + - name: Good variable format + ansible.builtin.debug: + msg: "{{ good_format }}" + - name: Good variable format + ansible.builtin.debug: + msg: "Value: {{ good_format }}" + - name: Good variable filter format + ansible.builtin.debug: + msg: "{{ good_format | filter }}" + - name: Good variable filter format + ansible.builtin.debug: + msg: "Value: {{ good_format | filter }}" + - name: Jinja escaping allowed + ansible.builtin.debug: + msg: "{{ '{{' }}" + - name: Jinja escaping allowed + # noqa: risky-shell-pipe + ansible.builtin.shell: docker info --format '{{ '{{' }}json .Swarm.LocalNodeState{{ '}}' }}' | tr -d '"' + changed_when: false + - name: Jinja whitespace control allowed + ansible.builtin.debug: + msg: | + {{ good_format }}/ + {{- good_format }} + {{- good_format -}} + - name: Bad variable format + ansible.builtin.debug: + msg: "{{bad_format}}" # <-- 1 + - name: Bad variable format + ansible.builtin.debug: + msg: "Value: {{ bad_format}}" # <-- 2 + - name: Bad variable format + ansible.builtin.debug: + msg: "{{bad_format }}" # <-- 3 + - name: Bad variable filter format + ansible.builtin.debug: + msg: "{{ bad_format|filter }}" # <-- 4 + - name: Bad variable filter format + ansible.builtin.debug: + msg: "Value: {{ bad_format |filter }}" # <-- 5 + - name: Bad variable filter format + ansible.builtin.debug: + msg: "{{ bad_format| filter }}" # <-- 6 + - name: Not a jinja variable # noqa: jinja[spacing] + ansible.builtin.debug: + # spell-checker: disable-next-line + msg: data = ${lookup{$local_part}lsearch{/etc/aliases}} + - name: JSON inside jinja is valid + ansible.builtin.debug: + msg: "{{ {'test': {'subtest': variable}} }}" + - name: Avoid false positive on multiline + vars: + cases: + case1: >- + http://foo.com/{{ + case1 }} + case2: >- + http://bar.com/{{ + case2 }} + ansible.builtin.debug: + var: cases + + - name: Valid single line nested JSON false positive + ansible.builtin.debug: + msg: "{{ {'dummy_2': {'nested_dummy_1': 'value_1', 'nested_dummy_2': value_2}} | combine(dummy_1) }}" + + - name: Invalid single line nested JSON + ansible.builtin.debug: + msg: "{{ {'dummy_2': {'nested_dummy_1': 'value_1', 'nested_dummy_2': value_2}} | combine(dummy_1)}}" # <-- 7 + + - name: Valid multiline nested JSON false positive + ansible.builtin.debug: + msg: >- + {{ {'dummy_2': {'nested_dummy_1': value_1, + 'nested_dummy_2': value_2}} | + combine(dummy_1) }} + + - name: Invalid multiline nested JSON + ansible.builtin.debug: + # not an error currently because current implementation skips multiline expressions + msg: >- + {{ {'dummy_2': {'nested_dummy_1': value_1, + 'nested_dummy_2': value_2}} | + combine(dummy_1)}} diff --git a/examples/playbooks/json-schema-fail.yml b/examples/playbooks/json-schema-fail.yml new file mode 100644 index 0000000..5760632 --- /dev/null +++ b/examples/playbooks/json-schema-fail.yml @@ -0,0 +1,4 @@ +--- +- name: This should raise json-schema error, due to hosts missing the last letter + host: localhost + tasks: [] diff --git a/examples/playbooks/lots_of_warnings.transformed.yml b/examples/playbooks/lots_of_warnings.transformed.yml new file mode 100644 index 0000000..1bca9da --- /dev/null +++ b/examples/playbooks/lots_of_warnings.transformed.yml @@ -0,0 +1,1000 @@ +--- +# This playbook causes ansible-lint to output tons of warnings +# Enough to exceed typical stdout buffering size and thus to show the need for +# catching IOError (EPIPE) errors. + +- name: Fixture + hosts: webservers + tasks: + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah diff --git a/examples/playbooks/lots_of_warnings.yml b/examples/playbooks/lots_of_warnings.yml new file mode 100644 index 0000000..1bca9da --- /dev/null +++ b/examples/playbooks/lots_of_warnings.yml @@ -0,0 +1,1000 @@ +--- +# This playbook causes ansible-lint to output tons of warnings +# Enough to exceed typical stdout buffering size and thus to show the need for +# catching IOError (EPIPE) errors. + +- name: Fixture + hosts: webservers + tasks: + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah + - name: Executing git through command + action: ansible.builtin.command git clone blah diff --git a/examples/playbooks/mocked_dependency.yml b/examples/playbooks/mocked_dependency.yml new file mode 100644 index 0000000..531e0c1 --- /dev/null +++ b/examples/playbooks/mocked_dependency.yml @@ -0,0 +1,10 @@ +--- +- hosts: localhost + roles: + - mocked_role + - fake_namespace.fake_collection.fake_role + tasks: + - name: Some task + zuul_return: {} + - name: Mocked module from collection + fake_namespace.fake_collection.fake_module: {} diff --git a/examples/playbooks/multiline-brackets-do-not-match-test.yml b/examples/playbooks/multiline-brackets-do-not-match-test.yml new file mode 100644 index 0000000..f13315e --- /dev/null +++ b/examples/playbooks/multiline-brackets-do-not-match-test.yml @@ -0,0 +1,22 @@ +--- +- hosts: foo + roles: + - ../../../roles/base_os + - ../../../roles/repos + - { + role: ../../../roles/openshift_master, + oo_minion_ips: "{ hostvars['localhost'].oo_minion_ips | default(['']) }}", + oo_bind_ip: "{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address | default(['']) }}" + } + - ../../../roles/pods + +- name: Set Origin specific facts on localhost (for later use) + hosts: localhost + gather_facts: false + tasks: + - name: Setting oo_minion_ips fact on localhost + ansible.builtin.set_fact: + oo_minion_ips: "{{ hostvars + | oo_select_keys(groups['tag_env-host-type-' + oo_env + '-openshift-minion']) + | oo_collect(attribute='ansible_eth0.ipv4.address') }" + when: groups['tag_env-host-type-' + oo_env + '-openshift-minion'] is defined diff --git a/examples/playbooks/multiline-bracketsmatchtest.yml b/examples/playbooks/multiline-bracketsmatchtest.yml new file mode 100644 index 0000000..86a19f7 --- /dev/null +++ b/examples/playbooks/multiline-bracketsmatchtest.yml @@ -0,0 +1,22 @@ +--- +- hosts: foo + roles: + - ../../../roles/base_os + - ../../../roles/repos + - { + role: ../../../roles/openshift_master, + oo_minion_ips: "{{ hostvars['localhost'].oo_minion_ips | default(['']) }}", + oo_bind_ip: "{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address | default(['']) }}" + } + - ../../../roles/pods + +- name: Set Origin specific facts on localhost (for later use) + hosts: localhost + gather_facts: false + tasks: + - name: Setting oo_minion_ips fact on localhost + ansible.builtin.set_fact: + oo_minion_ips: "{{ hostvars + | oo_select_keys(groups['tag_env-host-type-' + oo_env + '-openshift-minion']) + | oo_collect(attribute='ansible_eth0.ipv4.address') }}" + when: groups['tag_env-host-type-' + oo_env + '-openshift-minion'] is defined diff --git a/examples/playbooks/name-case.transformed.yml b/examples/playbooks/name-case.transformed.yml new file mode 100644 index 0000000..03b8c46 --- /dev/null +++ b/examples/playbooks/name-case.transformed.yml @@ -0,0 +1,4 @@ +--- +- name: This lacks a capitalization + hosts: localhost + tasks: [] diff --git a/examples/playbooks/name-case.yml b/examples/playbooks/name-case.yml new file mode 100644 index 0000000..5480d2c --- /dev/null +++ b/examples/playbooks/name-case.yml @@ -0,0 +1,4 @@ +--- +- name: this lacks a capitalization + hosts: localhost + tasks: [] diff --git a/examples/playbooks/no_handler_fail.yml b/examples/playbooks/no_handler_fail.yml new file mode 100644 index 0000000..28840ce --- /dev/null +++ b/examples/playbooks/no_handler_fail.yml @@ -0,0 +1,27 @@ +--- +- name: Fixture for no-handler rule + hosts: all + tasks: + - name: This should trigger no-handler rule # noqa: no-changed-when + ansible.builtin.command: echo could be done better + when: result is changed + + - name: Do anything # noqa: no-changed-when + ansible.builtin.command: echo 123 + when: + - something.changed + + - name: This should be a handler + ansible.builtin.debug: + msg: why isn't this a handler + when: result.changed + + - name: This should be a handler 3 # noqa: literal-compare + ansible.builtin.debug: + msg: why isn't this a handler + when: result.changed == true + + - name: This should be a handler 4 # noqa: literal-compare + ansible.builtin.debug: + msg: why isn't this a handler + when: result['changed'] == true diff --git a/examples/playbooks/no_handler_pass.yml b/examples/playbooks/no_handler_pass.yml new file mode 100644 index 0000000..5c44891 --- /dev/null +++ b/examples/playbooks/no_handler_pass.yml @@ -0,0 +1,84 @@ +--- +- name: Fixture for no-handler-pass + hosts: all + tasks: + - name: Execute something + ansible.builtin.command: echo 123 + register: result + changed_when: true + + - name: Print helpful error message + ansible.builtin.debug: + var: result + when: result.failed + + - name: Do something when hello is output + ansible.builtin.debug: + msg: why isn't this a handler + when: result.stdout == "hello" + + - name: Never actually debug + ansible.builtin.debug: + var: result + when: false + + - name: "Don't execute this step" + ansible.builtin.debug: + msg: "debug message" + when: + - false + + - name: Check when with a list + ansible.builtin.debug: + var: result + when: + - conditionA + - conditionB + + - name: Check when with a list of size 1 + ansible.builtin.debug: + var: result + when: + - conditionA + + - name: Registering task 1 + ansible.builtin.command: echo Hello + register: r1 + changed_when: true + + - name: Registering task 2 + ansible.builtin.command: echo Hello + register: r2 + changed_when: true + + - name: Use when task # noqa: no-changed-when + ansible.builtin.command: echo Hello + when: r1.changed and r2.changed + + - name: Use when with or # noqa: no-changed-when + ansible.builtin.command: echo Hello + when: r1.changed or conditionA + + - name: Use when with list of conditions # noqa: no-changed-when + ansible.builtin.command: echo Hello + when: + - r1.changed + - conditionA + + - name: Registering task + ansible.builtin.command: echo Hello + register: r + changed_when: true + + - name: When task not changed # noqa: no-changed-when + ansible.builtin.command: echo Not changed + when: not r.changed + + - name: Execute command # noqa: no-changed-when + ansible.builtin.command: echo hello + register: result + + - name: This should be a handler 2 + ansible.builtin.debug: + msg: why isn't this a handler + when: result | changed diff --git a/examples/playbooks/no_relative_paths_fail.yml b/examples/playbooks/no_relative_paths_fail.yml new file mode 100644 index 0000000..1f97c3c --- /dev/null +++ b/examples/playbooks/no_relative_paths_fail.yml @@ -0,0 +1,23 @@ +--- +- name: Fixture for no-relative-paths + hosts: localhost + tasks: + - name: Template example # <-- 1st + ansible.builtin.template: + src: ../templates/foo.j2 + dest: /etc/file.conf + mode: "0644" + - name: Copy example # <-- 2nd + ansible.builtin.copy: + src: ../files/foo.conf + dest: /etc/foo.conf + mode: "0644" + # Removed from test suite as module is no longer part of core + # - name: Some win_template example + # win_template: + # src: ../win_templates/file.conf.j2 + # dest: file.conf + # - name: Some win_copy example + # win_copy: + # src: ../files/foo.conf + # dest: renamed-foo.conf diff --git a/examples/playbooks/no_relative_paths_pass.yml b/examples/playbooks/no_relative_paths_pass.yml new file mode 100644 index 0000000..7c5a98a --- /dev/null +++ b/examples/playbooks/no_relative_paths_pass.yml @@ -0,0 +1,14 @@ +--- +- name: Fixture for no-relative-paths + hosts: localhost + tasks: + - name: Content example with no src + ansible.builtin.copy: + content: "# This file was moved to /etc/other.conf" + dest: /etc/mine.conf + mode: "0644" + - name: Copy example + ansible.builtin.copy: + src: /home/example/files/foo.conf + dest: /etc/foo.conf + mode: "0644" diff --git a/examples/playbooks/nomatches.yml b/examples/playbooks/nomatches.yml new file mode 100644 index 0000000..a3fac5d --- /dev/null +++ b/examples/playbooks/nomatches.yml @@ -0,0 +1,9 @@ +--- +- hosts: whatever + + tasks: + - name: Hello world + ansible.builtin.action: debug msg="Hello!" + + - name: This should be fine too + ansible.builtin.action: file state=touch mode=0644 dest=./wherever diff --git a/examples/playbooks/nomatchestest.transformed.yml b/examples/playbooks/nomatchestest.transformed.yml new file mode 100644 index 0000000..4fba8ef --- /dev/null +++ b/examples/playbooks/nomatchestest.transformed.yml @@ -0,0 +1,9 @@ +--- +- name: Fixture + hosts: whatever + tasks: + - name: Hello world + action: debug msg="Hello!" # noqa: fqcn[action-core] + + - name: This should be fine too + action: file state=touch dest=./wherever mode=0600 # noqa: fqcn[action-core] diff --git a/examples/playbooks/nomatchestest.yml b/examples/playbooks/nomatchestest.yml new file mode 100644 index 0000000..4fba8ef --- /dev/null +++ b/examples/playbooks/nomatchestest.yml @@ -0,0 +1,9 @@ +--- +- name: Fixture + hosts: whatever + tasks: + - name: Hello world + action: debug msg="Hello!" # noqa: fqcn[action-core] + + - name: This should be fine too + action: file state=touch dest=./wherever mode=0600 # noqa: fqcn[action-core] diff --git a/examples/playbooks/noqa-nested.yml b/examples/playbooks/noqa-nested.yml new file mode 100644 index 0000000..0659d48 --- /dev/null +++ b/examples/playbooks/noqa-nested.yml @@ -0,0 +1,9 @@ +--- +- hosts: localhost + tasks: + - name: Example of multi-level block + block: + - name: 2nd level + block: + - ansible.builtin.debug: # noqa: name[missing] + msg: "test unnamed task in block" diff --git a/examples/playbooks/noqa.yml b/examples/playbooks/noqa.yml new file mode 100644 index 0000000..a69c263 --- /dev/null +++ b/examples/playbooks/noqa.yml @@ -0,0 +1,6 @@ +--- +- hosts: localhost + tasks: + - name: This would typically fire latest[git] and partial-become + become_user: alice # noqa: latest[git] partial-become + git: src=/path/to/git/repo dest=checkout diff --git a/examples/playbooks/norole.yml b/examples/playbooks/norole.yml new file mode 100644 index 0000000..2ee7a83 --- /dev/null +++ b/examples/playbooks/norole.yml @@ -0,0 +1,5 @@ +--- +- hosts: + - localhost + roles: + - name: node diff --git a/examples/playbooks/norole2.yml b/examples/playbooks/norole2.yml new file mode 100644 index 0000000..2ee7a83 --- /dev/null +++ b/examples/playbooks/norole2.yml @@ -0,0 +1,5 @@ +--- +- hosts: + - localhost + roles: + - name: node diff --git a/examples/playbooks/package-check-failure.yml b/examples/playbooks/package-check-failure.yml new file mode 100644 index 0000000..393b52b --- /dev/null +++ b/examples/playbooks/package-check-failure.yml @@ -0,0 +1,21 @@ +--- +- hosts: localhost + tasks: + - name: Install ansible + ansible.builtin.yum: name=ansible state=latest + + - name: Install ansible-lint + ansible.builtin.pip: name=ansible-lint + args: + state: latest + + - name: Install some-package + ansible.builtin.package: + name: some-package + state: latest + + - name: Install ansible with update_only to false + ansible.builtin.yum: + name: sudo + state: latest + update_only: false diff --git a/examples/playbooks/package-check-success.yml b/examples/playbooks/package-check-success.yml new file mode 100644 index 0000000..a513d5d --- /dev/null +++ b/examples/playbooks/package-check-success.yml @@ -0,0 +1,22 @@ +--- +- hosts: localhost + tasks: + - name: Install ansible + ansible.builtin.yum: name=ansible-2.1.0.0 state=present + + - name: Install ansible-lint + ansible.builtin.pip: name=ansible-lint + args: + state: present + version: 3.1.2 + + - name: Install some-package + ansible.builtin.package: + name: Some-package + state: present + + - name: Update ansible + ansible.builtin.yum: + name: sudo + state: latest + update_only: true diff --git a/examples/playbooks/pass-loop-var-prefix.yml b/examples/playbooks/pass-loop-var-prefix.yml new file mode 100644 index 0000000..8f33399 --- /dev/null +++ b/examples/playbooks/pass-loop-var-prefix.yml @@ -0,0 +1,18 @@ +--- +- hosts: localhost + tasks: + # validate that we did not trigger loop-var-prefix on playbooks + - name: That should pass + ansible.builtin.debug: + var: item + loop: + - foo + - bar + - name: A block + block: + - name: That should also pass + ansible.builtin.debug: + var: item + loop: + - apples + - oranges diff --git a/examples/playbooks/play-without-extension b/examples/playbooks/play-without-extension new file mode 100644 index 0000000..e056ab5 --- /dev/null +++ b/examples/playbooks/play-without-extension @@ -0,0 +1,2 @@ +- name: A playbook without expected yml or yaml extension + hosts: localhost diff --git a/examples/playbooks/play.yml b/examples/playbooks/play.yml new file mode 100644 index 0000000..40f387f --- /dev/null +++ b/examples/playbooks/play.yml @@ -0,0 +1,6 @@ +--- +- hosts: bobbins + + tasks: + - name: A bad play + action: ansible.builtin.command service blah restart diff --git a/examples/playbooks/play_miss_include.yml b/examples/playbooks/play_miss_include.yml new file mode 100644 index 0000000..f402c41 --- /dev/null +++ b/examples/playbooks/play_miss_include.yml @@ -0,0 +1,5 @@ +--- +- name: Fixture + hosts: all + roles: + - include_miss diff --git a/examples/playbooks/playbook-imported.yml b/examples/playbooks/playbook-imported.yml new file mode 100644 index 0000000..fd4dd91 --- /dev/null +++ b/examples/playbooks/playbook-imported.yml @@ -0,0 +1,11 @@ +--- +- name: Fixture + hosts: localhost + connection: local + gather_facts: false + tasks: + - ansible.builtin.command: + cmd: echo "no name" # should generate name[missing] + - name: Another task + ansible.builtin.debug: + msg: debug message diff --git a/examples/playbooks/playbook-parent.yml b/examples/playbooks/playbook-parent.yml new file mode 100644 index 0000000..b7d0edd --- /dev/null +++ b/examples/playbooks/playbook-parent.yml @@ -0,0 +1,9 @@ +--- +- name: Importing another playbook + ansible.builtin.import_playbook: playbook-imported.yml + +- name: Importing playbook from collection + import_playbook: community.molecule.validate # noqa: fqcn + +- name: Importing playbook using jinja2 + import_playbook: "{{ 'community.molecule.validate' }}" # noqa: fqcn diff --git a/examples/playbooks/roles b/examples/playbooks/roles new file mode 120000 index 0000000..d8c4472 --- /dev/null +++ b/examples/playbooks/roles @@ -0,0 +1 @@ +../roles \ No newline at end of file diff --git a/examples/playbooks/rule-args-module-fail.yml b/examples/playbooks/rule-args-module-fail.yml new file mode 100644 index 0000000..25371fb --- /dev/null +++ b/examples/playbooks/rule-args-module-fail.yml @@ -0,0 +1,37 @@ +--- +- name: Fixture to validate module options failure scenarios + hosts: localhost + tasks: + - name: Clone content repository + # module should produce: 'missing required arguments: repo' + ansible.builtin.git: + dest: /home/www + accept_hostkey: true + version: master + update: false + + - name: Enable service httpd and ensure it is not masked + # module should produce: 'missing parameter(s) required by 'enabled': name' + ansible.builtin.systemd: + enabled: true + masked: false + + - name: Enable service httpd and ensure it is not masked + # module should produce: 'Unsupported parameters for ansible.builtin.systemd module" + ansible.builtin.systemd: + foo: true + + - name: An invalid call of setup module + # setup module in ansible is the only module that has a .. relative + # import that used to cause problems + ansible.builtin.setup: + foo: # this is a nested object which will have the __ injections + # that we later need to clean + bar: true + + - name: Remove deployment dir + # module should produce: 'value of state must be one of: absent, directory, file, hard, link, touch, got: away' + ansible.builtin.file: + path: /opt/software/deployment + state: away + mode: "0600" diff --git a/examples/playbooks/rule-args-module-pass.yml b/examples/playbooks/rule-args-module-pass.yml new file mode 100644 index 0000000..995e4fe --- /dev/null +++ b/examples/playbooks/rule-args-module-pass.yml @@ -0,0 +1,97 @@ +--- +- name: Fixture to validate module options pass scenario + hosts: localhost + tasks: + - name: Clone content repository + ansible.builtin.git: + repo: "{{ archive_services_repo_url }}" + dest: /home/www + accept_hostkey: true + version: master + update: false + + - name: Enable service httpd and ensure it is not masked + ansible.builtin.systemd: + name: httpd + enabled: false + masked: false + + - name: Clear deployment dir + ansible.builtin.file: + path: /opt/software/deployment + state: "{{ item }}" + mode: "0755" + with_items: + - absent + - directory + + - name: Bug https://github.com/ansible/ansible-lint/issues/2962 + become: true + ansible.builtin.apt_key: + url: "{{ zj_item['url'] | default(omit) }}" + data: "{{ zj_item['data'] | default(omit) }}" + loop: "{{ repositories_keys }}" + loop_control: + loop_var: zj_item + + - name: Bug 2428 daemon_reload should be allowed + ansible.builtin.systemd: + name: foo + state: restarted + daemon_reload: true + + - name: Bug 2424 async_status + ansible.builtin.async_status: + jid: "{{ 999 }}" + + - name: Bug https://github.com/VSChina/vscode-ansible/issues/261 + ansible.builtin.set_fact: + dns_nameservers: "{{ var1 }}" + + - name: Bug cmd should be allowed + ansible.builtin.command: + cmd: echo "foo" + changed_when: false + + - name: Bag another allowed form of command + ansible.builtin.command: "/etc/test.sh" + changed_when: false + + - name: Bug 3090 + community.docker.docker_container_exec: + container: foo + argv: + - /bin/bash + - "-c" + - "ls -lah > /dev/stderr" + chdir: /root + register: result + + - name: "Bug 3138" + become: true + ansible.builtin.service: + name: "jenkins" + state: started + # 'use' is dropped by preprocessing ... + use: "{{ ansible_service_mgr }}" + changed_when: false + + - name: "Bug 3152" + ansible.posix.synchronize: + src: . + dest: . + owner: false + group: false + use_ssh_args: true + + - name: Create software directory (Windows module - Bug 3200) + ansible.windows.win_file: + path: "c:\\test_dir" + state: directory + + - name: Ansible-lint for args rule should succeed (Bug - 3199) + vars: + copy_vars: + src: "args.json" + action: ansible.builtin.copy + args: "{{ copy_vars }}" # since, we're unable to analyze jinja, we skip this kind of checks diff --git a/examples/playbooks/rule-avoid-implicit-fail.yml b/examples/playbooks/rule-avoid-implicit-fail.yml new file mode 100644 index 0000000..ceaaeb4 --- /dev/null +++ b/examples/playbooks/rule-avoid-implicit-fail.yml @@ -0,0 +1,9 @@ +--- +- name: Example playbook + hosts: localhost + tasks: + - name: Write file content + ansible.builtin.copy: + content: { "foo": "bar" } # <-- avoid-implicit[copy-content] + dest: /tmp/foo.txt + mode: "0600" diff --git a/examples/playbooks/rule-avoid-implicit-pass.yml b/examples/playbooks/rule-avoid-implicit-pass.yml new file mode 100644 index 0000000..248fc8c --- /dev/null +++ b/examples/playbooks/rule-avoid-implicit-pass.yml @@ -0,0 +1,9 @@ +--- +- name: Example playbook + hosts: localhost + tasks: + - name: Write file content + ansible.builtin.copy: + content: "Some {{ foo }}" + dest: /tmp/foo.txt + mode: "0600" diff --git a/examples/playbooks/rule-command-instead-of-module-fail.yml b/examples/playbooks/rule-command-instead-of-module-fail.yml new file mode 100644 index 0000000..38d7a29 --- /dev/null +++ b/examples/playbooks/rule-command-instead-of-module-fail.yml @@ -0,0 +1,15 @@ +--- +- name: Test fixture for command-instead-of-module + hosts: localhost + tasks: + - name: Run apt-get update # <-- 1 + ansible.builtin.command: apt-get update + changed_when: false + + - name: Restart sshd # <-- 2 + ansible.builtin.command: systemctl restart sshd + changed_when: false + + - name: Run yum update # <-- 3 + ansible.builtin.command: yum update + changed_when: false diff --git a/examples/playbooks/rule-command-instead-of-module-pass.yml b/examples/playbooks/rule-command-instead-of-module-pass.yml new file mode 100644 index 0000000..c0a26e9 --- /dev/null +++ b/examples/playbooks/rule-command-instead-of-module-pass.yml @@ -0,0 +1,37 @@ +--- +- name: Test fixture for command-instead-of-module + hosts: localhost + tasks: + - name: Print current git branch + ansible.builtin.command: git branch + changed_when: false + - name: Print git log + ansible.builtin.command: git log + changed_when: false + - name: Install git lfs support + ansible.builtin.command: git lfs install + changed_when: false + + - name: Show systemctl service status + ansible.builtin.command: systemctl status systemd-timesyncd + changed_when: false + + - name: Show systemd environment + ansible.builtin.command: systemctl show-environment + changed_when: false + + - name: Set systemd runlevel + ansible.builtin.command: systemctl set-default multi-user.target + changed_when: false + + - name: Kill service using SIGUSR1 + ansible.builtin.command: systemctl kill --signal=SIGUSR1 sshd + changed_when: false + + - name: Clear yum cache + ansible.builtin.command: yum clean all + changed_when: false + + - name: Clear yum cache + ansible.builtin.command: "" + changed_when: false diff --git a/examples/playbooks/rule-command-instead-of-shell-fail.yml b/examples/playbooks/rule-command-instead-of-shell-fail.yml new file mode 100644 index 0000000..278f5d7 --- /dev/null +++ b/examples/playbooks/rule-command-instead-of-shell-fail.yml @@ -0,0 +1,25 @@ +--- +- name: Fixture + hosts: localhost + tasks: + - name: Shell no pipe + ansible.builtin.shell: + cmd: echo hello + changed_when: false + + - name: Shell with jinja filter + ansible.builtin.shell: + cmd: echo {{ "hello" | upper }} + changed_when: false + + - name: Shell with jinja filter (fqcn) + ansible.builtin.shell: + cmd: echo {{ "hello" | upper }} + changed_when: false + + - name: Command with executable parameter + ansible.builtin.shell: + cmd: clear + args: + executable: /bin/bash + changed_when: false diff --git a/examples/playbooks/rule-command-instead-of-shell-pass.yml b/examples/playbooks/rule-command-instead-of-shell-pass.yml new file mode 100644 index 0000000..8bbaef3 --- /dev/null +++ b/examples/playbooks/rule-command-instead-of-shell-pass.yml @@ -0,0 +1,60 @@ +--- +- name: Fixture + hosts: localhost + tasks: + - name: Shell with pipe + ansible.builtin.shell: + cmd: echo hello | true # noqa: risky-shell-pipe + changed_when: false + + - name: Shell with redirect + ansible.builtin.shell: + cmd: echo hello > /tmp/hello + changed_when: false + + - name: Chain two shell commands + ansible.builtin.shell: + cmd: echo hello && echo goodbye + changed_when: false + + - name: Run commands in succession + ansible.builtin.shell: + cmd: echo hello ; echo goodbye + changed_when: false + + - name: Use variables + ansible.builtin.shell: + cmd: echo $HOME $USER + changed_when: false + + - name: Use * for globbing + ansible.builtin.shell: + cmd: ls foo* + changed_when: false + + - name: Use ? for globbing + ansible.builtin.shell: + cmd: ls foo? + changed_when: false + + - name: Use [] for globbing + ansible.builtin.shell: + cmd: ls foo[1,2,3] + changed_when: false + + - name: Use shell generator + ansible.builtin.shell: + cmd: ls foo{.txt,.xml} + changed_when: false + + - name: Use backticks + ansible.builtin.shell: + cmd: ls `ls foo*` + changed_when: false + + - name: Use shell with cmd + ansible.builtin.shell: + cmd: | + set -x + ls foo? + changed_when: false diff --git a/examples/playbooks/rule-deprecated-bare-vars-fail.yml b/examples/playbooks/rule-deprecated-bare-vars-fail.yml new file mode 100644 index 0000000..7091f46 --- /dev/null +++ b/examples/playbooks/rule-deprecated-bare-vars-fail.yml @@ -0,0 +1,97 @@ +--- +- name: Fixture for deprecated-bare-vars rule + hosts: localhost + become: false + vars: + my_list: + - foo + - bar + + my_list2: + - 1 + - 2 + + my_list_of_dicts: + - foo: 1 + bar: 2 + - foo: 3 + bar: 4 + + my_list_of_lists: + - "{{ my_list }}" + - "{{ my_list2 }}" + + my_filenames: + - foo.txt + - bar.txt + + my_dict: + foo: bar + + tasks: + - name: Use with_items loop using bare variable + ansible.builtin.debug: + msg: "{{ item }}" + with_items: my_list + + - name: Use with_dict loop using bare variable + ansible.builtin.debug: + msg: "{{ item }}" + with_dict: my_dict + + ### Testing with_dict with a default empty dictionary + - name: Use with_dict loop using variable and default + ansible.builtin.debug: + msg: "{{ item.key }} - {{ item.value }}" + with_dict: uwsgi_ini | default({}) + + - name: Use with_nested loop using bare variable + ansible.builtin.debug: + msg: "{{ item.0 }} {{ item.1 }}" + with_nested: + - my_list + - "{{ my_list2 }}" + + - name: Use with_nested loop using bare variable + ansible.builtin.debug: + msg: "{{ item.0 }} {{ item.1 }}" + with_nested: "my_list2" + + - name: Use with_file loop using bare variable + ansible.builtin.debug: + msg: "{{ item }}" + with_file: my_list + + - name: Use with_fileglob loop using bare variable + ansible.builtin.debug: + msg: "{{ item }}" + with_fileglob: my_list + + - name: Use with_together loop using bare variable + ansible.builtin.debug: + msg: "{{ item.0 }} {{ item.1 }}" + with_together: + - my_list + - "{{ my_list2 }}" + + - name: Use with_subelements loop using bare variable + ansible.builtin.debug: + msg: "{{ item.0 }}" + with_subelements: + - my_list_of_dicts + - bar + + - name: Use with_random_choice loop using bare variable + ansible.builtin.debug: + msg: "{{ item }}" + with_random_choice: my_list + + - name: Use with_first_found loop using bare variable + ansible.builtin.debug: + msg: "{{ item }}" + with_first_found: my_filenames + + - name: Use with_indexed_items loop + ansible.builtin.debug: + msg: "{{ item.0 }} {{ item.1 }}" + with_indexed_items: my_list diff --git a/examples/playbooks/rule-deprecated-bare-vars-pass.yml b/examples/playbooks/rule-deprecated-bare-vars-pass.yml new file mode 100644 index 0000000..c7e6521 --- /dev/null +++ b/examples/playbooks/rule-deprecated-bare-vars-pass.yml @@ -0,0 +1,168 @@ +--- +- name: Using bare variables success + hosts: localhost + become: false + vars: + my_list: + - foo + - bar + + my_list2: + - 1 + - 2 + + my_list_of_dicts: + - foo: 1 + bar: 2 + - foo: 3 + bar: 4 + + my_list_of_lists: + - "{{ my_list }}" + - "{{ my_list2 }}" + + my_filenames: + - foo.txt + - bar.txt + + my_dict: + foo: bar + + tasks: + ### Testing with_items loops + - name: Use with_items loop using static list + ansible.builtin.debug: + msg: "{{ item }}" + with_items: + - foo + - bar + + - name: Use with_items using a static hash + ansible.builtin.debug: + msg: "{{ item.key }} - {{ item.value }}" + with_items: + - { key: foo, value: 1 } + - { key: bar, value: 2 } + + - name: Use with_items loop using variable + ansible.builtin.debug: + msg: "{{ item }}" + with_items: "{{ my_list }}" + + ### Testing with_nested loops + - name: Use with_nested loop using static lists + ansible.builtin.debug: + msg: "{{ item[0] }} - {{ item[1] }}" + with_nested: + - [foo, bar] + - ["1", "2", "3"] + + - name: Use with_nested loop using variable list and static + ansible.builtin.debug: + msg: "{{ item[0] }} - {{ item[1] }}" + with_nested: + - "{{ my_list }}" + - ["1", "2", "3"] + + ### Testing with_dict + - name: Use with_dict loop using variable + ansible.builtin.debug: + msg: "{{ item.key }} - {{ item.value }}" + with_dict: "{{ my_dict }}" + + ### Testing with_dict with a default empty dictionary + - name: Use with_dict loop using variable and default + ansible.builtin.debug: + msg: "{{ item.key }} - {{ item.value }}" + with_dict: "{{ uwsgi_ini | default({}) }}" + + ### Testing with_file + - name: Use with_file loop using static files list + ansible.builtin.debug: + msg: "{{ item }}" + with_file: + - foo.txt + - bar.txt + + - name: Use with_file loop using list of filenames + ansible.builtin.debug: + msg: "{{ item }}" + with_file: "{{ my_filenames }}" + + ### Testing with_fileglob + - name: Use with_fileglob loop using list of *.txt + ansible.builtin.debug: + msg: "{{ item }}" + with_fileglob: + - "*.txt" + + ### Testing non-list form of with_fileglob + - name: Use with_fileglob loop using single value *.txt + ansible.builtin.debug: + msg: "{{ item }}" + with_fileglob: "*.txt" + + ### Testing non-list form of with_fileglob with trailing templated pattern + - name: Use with_fileglob loop using templated pattern + ansible.builtin.debug: + msg: "{{ item }}" + with_fileglob: foo{{ glob }} + + ### Testing with_together + - name: Use with_together loop using variable lists + ansible.builtin.debug: + msg: "{{ item.0 }} - {{ item.1 }}" + with_together: + - "{{ my_list }}" + - "{{ my_list2 }}" + + - name: Use with_subelements loop + ansible.builtin.debug: + msg: "{{ item }}" + with_subelements: + - "{{ my_list_of_dicts }}" + - bar + + - name: Use with_sequence loop + ansible.builtin.debug: + msg: "{{ item }}" + with_sequence: count=2 + + - name: Use with_random_choice loop + ansible.builtin.debug: + msg: "{{ item }}" + with_random_choice: "{{ my_list }}" + + - name: Use with_first_found loop with static files list + ansible.builtin.debug: + msg: "{{ item }}" + with_first_found: + - foo.txt + - bar.txt + + - name: Use with_first_found loop with list of filenames + ansible.builtin.debug: + msg: "{{ item }}" + with_first_found: "{{ my_filenames }}" + + - name: Use with_indexed_items loop + ansible.builtin.debug: + msg: "{{ item.0 }} {{ item.1 }}" + with_indexed_items: "{{ my_list }}" + + - name: Use with_ini loop + ansible.builtin.debug: + msg: "{{ item }}" + with_ini: value[1-2] section=section1 file=foo.ini re=true + + - name: Use with_inventory_hostnames loop + ansible.builtin.debug: + msg: "{{ item }}" + with_inventory_hostnames: all + + - name: Test more complex jinja is also allowed + ansible.builtin.debug: + msg: "{{ item }}" + with_items: >- + {%- set ns = [1, 1, 2] -%} + {{- ns.keys | unique -}} diff --git a/examples/playbooks/rule-deprecated-command-syntax.yml b/examples/playbooks/rule-deprecated-command-syntax.yml new file mode 100644 index 0000000..a7b9807 --- /dev/null +++ b/examples/playbooks/rule-deprecated-command-syntax.yml @@ -0,0 +1,7 @@ +--- +- name: Fixture + hosts: localhost + tasks: + - name: Shell with pipe + ansible.builtin.command: creates=/tmp/foo touch /tmp/foo + changed_when: false diff --git a/examples/playbooks/rule-deprecated-local-action-fail.yml b/examples/playbooks/rule-deprecated-local-action-fail.yml new file mode 100644 index 0000000..c8eeb11 --- /dev/null +++ b/examples/playbooks/rule-deprecated-local-action-fail.yml @@ -0,0 +1,7 @@ +--- +- name: Fixture for deprecated-local-action + hosts: localhost + tasks: + - name: Task example + local_action: + module: ansible.builtin.debug diff --git a/examples/playbooks/rule-empty-string-compare-fail.yml b/examples/playbooks/rule-empty-string-compare-fail.yml new file mode 100644 index 0000000..7b4be85 --- /dev/null +++ b/examples/playbooks/rule-empty-string-compare-fail.yml @@ -0,0 +1,16 @@ +--- +- name: Empty String Compare Fail + hosts: all + tasks: + - name: Shut down # noqa no-changed-when + ansible.builtin.command: /sbin/shutdown -t now + when: ansible_os_family == "" + - name: Shut down # noqa no-changed-when + ansible.builtin.command: /sbin/shutdown -t now + when: ansible_os_family !="" + - name: Shut down # noqa no-changed-when + ansible.builtin.command: /sbin/shutdown -t now + when: false + - name: Shut down # noqa no-changed-when + ansible.builtin.command: /sbin/shutdown -t now + when: [ansible_os_family == ""] diff --git a/examples/playbooks/rule-empty-string-compare-pass.yml b/examples/playbooks/rule-empty-string-compare-pass.yml new file mode 100644 index 0000000..aa335de --- /dev/null +++ b/examples/playbooks/rule-empty-string-compare-pass.yml @@ -0,0 +1,16 @@ +--- +- name: Empty string compare success + hosts: all + tasks: + - name: Shut down + ansible.builtin.shell: | + /sbin/shutdown -t now + echo $var == "" + changed_when: false + when: ansible_os_family + - name: Shut down + ansible.builtin.shell: | + /sbin/shutdown -t now + echo $var == "" + changed_when: false + when: [ansible_os_family] diff --git a/examples/playbooks/rule-fqcn-fail.yml b/examples/playbooks/rule-fqcn-fail.yml new file mode 100644 index 0000000..8015cc2 --- /dev/null +++ b/examples/playbooks/rule-fqcn-fail.yml @@ -0,0 +1,14 @@ +--- +- name: Fixture + hosts: localhost + collections: + - community.general + tasks: + - name: Shell (fqcn[action-core]) # noqa: command-instead-of-shell + shell: echo This rule should get matched by the fqcn rule + changed_when: false + - name: Shell (fqcn[action]) + ini_file: + section: foo + path: /tmp/test.ini + mode: "0644" diff --git a/examples/playbooks/rule-fqcn-pass.yml b/examples/playbooks/rule-fqcn-pass.yml new file mode 100644 index 0000000..eafd653 --- /dev/null +++ b/examples/playbooks/rule-fqcn-pass.yml @@ -0,0 +1,13 @@ +--- +- name: Fixture + hosts: localhost + tasks: + - name: Shell (fqcn) # noqa: command-instead-of-shell + changed_when: false + ansible.builtin.shell: echo This rule should not get matched by the fqcn rule + - name: Use FQCN with more than 3 parts + community.general.system.sudoers: + name: should-not-be-here + state: absent + - name: Command with legacy FQCN + ansible.legacy.command: echo This rule should not get matched by the fqcn rule diff --git a/examples/playbooks/rule-jinja-fail.yml b/examples/playbooks/rule-jinja-fail.yml new file mode 100644 index 0000000..c7bf5ba --- /dev/null +++ b/examples/playbooks/rule-jinja-fail.yml @@ -0,0 +1,12 @@ +--- +- name: Fixture + hosts: localhost + tasks: + - name: A block used to check that we do not identify error at correct level + block: + - name: Foo # <-- this is valid jinja2 + ansible.builtin.debug: + foo: "{{ 1 }}" # <-- jinja2[spacing] + msg: "{{ 'a' b }}" # <-- jinja2[invalid] +# It should be noted that even ansible --syntax-check fails to spot the jinja +# error above, but ansible will throw a runtime error when running diff --git a/examples/playbooks/rule-jinja-pass.yml b/examples/playbooks/rule-jinja-pass.yml new file mode 100644 index 0000000..cbdfee6 --- /dev/null +++ b/examples/playbooks/rule-jinja-pass.yml @@ -0,0 +1,83 @@ +--- +# https://github.com/ansible/ansible-lint/issues/2464 +# https://github.com/ansible/ansible-lint/issues/2462 +# https://github.com/ansible/ansible-lint/issues/2459 +- name: Fixture to test various jinja parsing bugs that we should ignore + hosts: localhost + tasks: + - name: Foo {{ buildset_registry.host | ipwrap }} + ansible.builtin.debug: + msg: "{{ lookup('template', 'lookup/redis_server__env_ports.j2') | from_yaml }}" + loop: "{{ github_release_query.results | subelements('json.assets', {'skip_missing': True}) }}" + - name: Zoo + ansible.builtin.debug: + msg: "{{ lookup('ansible.builtin.ini', 'SOME_VAR', type='properties', file='/tmp/some-file') }}" + + - name: Generate Dovecot main configuration file + ansible.builtin.template: + src: '{{ lookup("template_src", "etc/dovecot/dovecot.conf.j2") }}' + dest: "/etc/dovecot/dovecot.conf" + owner: "root" + group: "dovecot" + mode: "0640" + - name: Bug https://github.com/ansible/ansible-lint/issues/2569 + ansible.builtin.include_tasks: + file: /dev/null + vars: + ns_vars: {} + x: "{{ lookup('ansible.builtin.template', 'namespace.yaml.j2', template_vars=ns_vars) | from_yaml }}" + - name: Bug https://github.com/ansible/ansible-lint/issues/3048 + ansible.builtin.set_fact: + x: "{{ y.json | community.general.json_query(edition.version) }}" + +# https://github.com/ansible/ansible-lint/issues/2697 +- name: Test linter + hosts: localhost + gather_facts: false + tasks: + - name: Passed linter + ansible.builtin.debug: + msg: "{{ test | to_json }}" + vars: + test: + one: two + param: "{{ ansible_host }}" + - name: Failed linter + ansible.builtin.debug: + msg: "{{ test | to_json }}" + vars: + test: + one: two + param: no jinja + +- name: Bug https://github.com/ansible/ansible-lint/issues/3048 + hosts: localhost + tasks: + - name: "Test for bug #3048" + ansible.builtin.debug: + msg: "{{ __my_var | mandatory }}" + loop: "{{ a_var }}" + loop_control: + loop_var: __my_var + vars: + a_var: + - one + +- name: Bugs + hosts: localhost + tasks: + - name: Bug https://github.com/ansible/ansible-lint/issues/3082 + ansible.builtin.copy: + content: "{{ item.cfg | to_nice_yaml(indent=2, width=9999) }}" + dest: "/tmp/{{ item.name }}.yaml" + mode: "0640" + with_items: + - name: file2 + + - name: Bug https://github.com/ansible/ansible-lint/issues/3136 + ansible.builtin.debug: + msg: "IP is {{ foo | ansible.utils.ipaddr('address') }}" + + - name: "Bug https://github.com/ansible/ansible-lint/issues/3155" + ansible.builtin.debug: + msg: "Is changed:{{ date_cmd is changed }}" diff --git a/examples/playbooks/rule-key-order-fail.yml b/examples/playbooks/rule-key-order-fail.yml new file mode 100644 index 0000000..a83514a --- /dev/null +++ b/examples/playbooks/rule-key-order-fail.yml @@ -0,0 +1,30 @@ +--- +- name: Fixture + hosts: localhost + tasks: + - no_log: true + ansible.builtin.command: echo hello + name: Task with no_log on top + changed_when: false + - when: true + name: Task with when on top + ansible.builtin.command: echo hello + changed_when: false + - delegate_to: localhost + name: Delegate_to on top + ansible.builtin.command: echo hello + changed_when: false + - loop: + - 1 + - 2 + name: Loopy + ansible.builtin.command: echo {{ item }} + changed_when: false + - become: true + name: Become first + ansible.builtin.command: echo hello + changed_when: false + - register: test + ansible.builtin.command: echo hello + name: Register first + changed_when: false diff --git a/examples/playbooks/rule-key-order-pass.yml b/examples/playbooks/rule-key-order-pass.yml new file mode 100644 index 0000000..eb141e5 --- /dev/null +++ b/examples/playbooks/rule-key-order-pass.yml @@ -0,0 +1,16 @@ +--- +- name: Fixture for key-order rule + hosts: localhost + tasks: + - name: Test + ansible.builtin.command: echo "test" + changed_when: false + - name: Test2 + ansible.builtin.debug: + msg: "Debug without a name" + - name: Flush handlers + ansible.builtin.meta: flush_handlers + - no_log: true # noqa: key-order[task] command-instead-of-shell + ansible.builtin.shell: echo hello + name: Task with no_log on top + changed_when: false diff --git a/examples/playbooks/rule-name-casing.yml b/examples/playbooks/rule-name-casing.yml new file mode 100644 index 0000000..1b2efb8 --- /dev/null +++ b/examples/playbooks/rule-name-casing.yml @@ -0,0 +1,10 @@ +--- +- name: Fixture for src/ansiblelint/rules/name.py::test_rule_name_lowercase + hosts: all + tasks: + - name: this task has a name is not correctly capitalized + ansible.builtin.command: echo "Hello World" + changed_when: false + - name: 测试 should not trigger name[case] rule! + ansible.builtin.command: echo "Hello World" + changed_when: false diff --git a/examples/playbooks/rule-name-missing-fail.yml b/examples/playbooks/rule-name-missing-fail.yml new file mode 100644 index 0000000..4ea543e --- /dev/null +++ b/examples/playbooks/rule-name-missing-fail.yml @@ -0,0 +1,11 @@ +--- +- hosts: all # <-- name[missing] + tasks: + - ansible.builtin.command: echo "no name" # <-- name[missing] + changed_when: false + - name: "" # <-- name[missing] + ansible.builtin.command: echo "empty name" + changed_when: false + - ansible.builtin.debug: # <-- name[missing] + msg: Debug without a name + - ansible.builtin.meta: flush_handlers # <-- name[missing] diff --git a/examples/playbooks/rule-name-missing-pass.yml b/examples/playbooks/rule-name-missing-pass.yml new file mode 100644 index 0000000..965a80a --- /dev/null +++ b/examples/playbooks/rule-name-missing-pass.yml @@ -0,0 +1,12 @@ +--- +- name: Play for testing name[missing] rule + hosts: all + tasks: + - name: This task has a name + ansible.builtin.command: echo "Hello World" # noqa: no-free-form + changed_when: false + - name: Debug task with name + ansible.builtin.debug: msg="Hello World" # noqa: no-free-form + - name: Flush handler with name + ansible.builtin.meta: flush_handlers + changed_when: false diff --git a/examples/playbooks/rule-name-play-fail.yml b/examples/playbooks/rule-name-play-fail.yml new file mode 100644 index 0000000..5e42fa0 --- /dev/null +++ b/examples/playbooks/rule-name-play-fail.yml @@ -0,0 +1,3 @@ +--- +- hosts: localhost # <-- name[missing] + tasks: [] diff --git a/examples/playbooks/rule-name-templated-fail.yml b/examples/playbooks/rule-name-templated-fail.yml new file mode 100644 index 0000000..8a4f156 --- /dev/null +++ b/examples/playbooks/rule-name-templated-fail.yml @@ -0,0 +1,13 @@ +--- +- name: Fixture for src/ansiblelint/rules/name.py::test_name_template( + hosts: all + tasks: + - name: This task {{ sampleService }} name is not correctly templated + ansible.builtin.command: echo "Hello World" + changed_when: false + - name: This task is correctly templated {{ sampleService }} + ansible.builtin.command: echo "Hello World" + changed_when: false + - name: This task is correctly templated '{{ sampleService }}' + ansible.builtin.command: echo "Hello World" + changed_when: false diff --git a/examples/playbooks/rule-no-changed-when-fail.yml b/examples/playbooks/rule-no-changed-when-fail.yml new file mode 100644 index 0000000..1f994b8 --- /dev/null +++ b/examples/playbooks/rule-no-changed-when-fail.yml @@ -0,0 +1,15 @@ +--- +- name: Fixture for no-changed-when (fail with 3 occurrences) + hosts: all + tasks: + - name: Register command output, but cat still does not change anything + ansible.builtin.command: cat {{ my_file | quote }} + register: my_output + - name: Block level 1 + block: + - name: Block level 2 + block: + - name: Basic command task, should fail + ansible.builtin.command: cat my_file + - name: Basic shell task, should fail + shell: cat my_file # noqa: fqcn command-instead-of-shell diff --git a/examples/playbooks/rule-no-changed-when-pass.yml b/examples/playbooks/rule-no-changed-when-pass.yml new file mode 100644 index 0000000..9681e06 --- /dev/null +++ b/examples/playbooks/rule-no-changed-when-pass.yml @@ -0,0 +1,23 @@ +--- +- name: Fixture for no-changed-when (pass) + hosts: all + tasks: + - name: Handle command output with return code # noqa: command-instead-of-shell + ansible.builtin.command: cat {{ my_file | quote }} + register: my_output + changed_when: my_output.rc != 0 + + - name: Handle shell output with return code # noqa: command-instead-of-shell + ansible.builtin.shell: cat {{ my_file | quote }} + register: my_output + changed_when: my_output.rc != 0 + + - name: Handle shell output with false changed_when # noqa: command-instead-of-shell + ansible.builtin.shell: cat {{ my_file | quote }} + register: my_output + changed_when: false + + - name: Command with argument + command: createfile.sh # noqa: fqcn + args: + creates: /tmp/????unknown_files???? diff --git a/examples/playbooks/rule-no-free-form-fail.yml b/examples/playbooks/rule-no-free-form-fail.yml new file mode 100644 index 0000000..8360608 --- /dev/null +++ b/examples/playbooks/rule-no-free-form-fail.yml @@ -0,0 +1,14 @@ +--- +- name: Example with discouraged free-form syntax + hosts: localhost + tasks: + - name: Create a placefolder file + ansible.builtin.command: chdir=/tmp touch foo # <-- don't use shorthand + changed_when: false + - name: Use raw to echo + ansible.builtin.raw: executable=/bin/bash echo foo # <-- don't use executable= + changed_when: false + - name: Testing anything else passed to raw except for string + ansible.builtin.raw: + args: "123" + changed_when: false diff --git a/examples/playbooks/rule-no-free-form-pass.yml b/examples/playbooks/rule-no-free-form-pass.yml new file mode 100644 index 0000000..36d359d --- /dev/null +++ b/examples/playbooks/rule-no-free-form-pass.yml @@ -0,0 +1,19 @@ +--- +- name: Example with discouraged free-form syntax + hosts: localhost + tasks: + - name: Create a placefolder file + ansible.builtin.command: + cmd: touch foo + chdir: /tmp + changed_when: false + - name: Use raw to echo + ansible.builtin.raw: echo foo + args: + executable: /bin/bash + changed_when: false + - name: Configure locale + # https://github.com/ansible/ansible-lint/issues/2573 + ansible.builtin.command: localectl set-locale LANG=en_GB.UTF-8 + when: not ansible_check_mode + changed_when: false diff --git a/examples/playbooks/rule-no-handler-fail.yml b/examples/playbooks/rule-no-handler-fail.yml new file mode 100644 index 0000000..3bc23a3 --- /dev/null +++ b/examples/playbooks/rule-no-handler-fail.yml @@ -0,0 +1,15 @@ +--- +- name: Example of no-handler rule + hosts: localhost + tasks: + - name: Register result of a task + ansible.builtin.copy: + dest: "/tmp/placeholder" + content: "Ansible made this!" + mode: "0600" + register: result # <-- we register the result of the task + + - name: Second command to run + ansible.builtin.debug: + msg: The placeholder file was modified! + when: result.changed # <-- this triggers no-handler rule diff --git a/examples/playbooks/rule-no-handler-pass.yml b/examples/playbooks/rule-no-handler-pass.yml new file mode 100644 index 0000000..af6a726 --- /dev/null +++ b/examples/playbooks/rule-no-handler-pass.yml @@ -0,0 +1,15 @@ +--- +- name: Example of no-handler rule + hosts: localhost + tasks: + - name: Register result of a task + ansible.builtin.copy: + dest: "/tmp/placeholder" + content: "Ansible made this!" + mode: "0600" + notify: + - Second command to run # <-- handler will run only when file is changed + handlers: + - name: Second command to run + ansible.builtin.debug: + msg: The placeholder file was modified! diff --git a/examples/playbooks/rule-no-jinja-when-fail.yml b/examples/playbooks/rule-no-jinja-when-fail.yml new file mode 100644 index 0000000..15778ea --- /dev/null +++ b/examples/playbooks/rule-no-jinja-when-fail.yml @@ -0,0 +1,21 @@ +--- +- name: One + hosts: all + tasks: + - name: Test when with jinja2 # noqa: jinja[spacing] + ansible.builtin.debug: + msg: text + when: "{{ false }}" + +- name: Two + hosts: all + roles: + - role: test + when: "{{ '1' = '1' }}" + +- name: Three + hosts: all + roles: + - role: test + when: + - "{{ '1' = '1' }}" diff --git a/examples/playbooks/rule-no-jinja-when-pass.yml b/examples/playbooks/rule-no-jinja-when-pass.yml new file mode 100644 index 0000000..b9d02f5 --- /dev/null +++ b/examples/playbooks/rule-no-jinja-when-pass.yml @@ -0,0 +1,17 @@ +--- +- name: Test fixture for no-jinja-when + hosts: all + tasks: + - name: Test when + ansible.builtin.debug: + msg: text + when: true + - name: Test when 2 + ansible.builtin.debug: + msg: text2 + when: 1 = 1 + - name: Three + ansible.builtin.debug: + msg: text2 + when: + - "false" diff --git a/examples/playbooks/rule-no-prompting.yml b/examples/playbooks/rule-no-prompting.yml new file mode 100644 index 0000000..5f74303 --- /dev/null +++ b/examples/playbooks/rule-no-prompting.yml @@ -0,0 +1,27 @@ +--- +- name: Fixture for testing no-prompting rule, lines 5,17 + hosts: all + vars_prompt: + - name: username + prompt: What is your username? + private: false + + - name: password + prompt: What is your password? + + tasks: + - name: Pause for 5 minutes to build app cache + ansible.builtin.pause: + minutes: 5 # should not trigger because minutes is mentioned + + - name: A helpful reminder of what to look out for post-update + ansible.builtin.pause: + # should trigger no-prompting as neither seconds/minutes are mentioned + prompt: "Make sure org.foo.FooOverload exception is not present" + +- name: Fixture for testing if no vars_prompt is provided, lines 34-36 + hosts: all + tasks: + - name: Pause for 5 minutes to build app cache + ansible.builtin.pause: + minutes: 5 # should not trigger because minutes is mentioned diff --git a/examples/playbooks/rule-no-tabs.yml b/examples/playbooks/rule-no-tabs.yml new file mode 100644 index 0000000..4621096 --- /dev/null +++ b/examples/playbooks/rule-no-tabs.yml @@ -0,0 +1,20 @@ +--- +- name: Fixture for no-tabs rule + hosts: localhost + tasks: + - name: Should not trigger no-tabs rules + ansible.builtin.lineinfile: + path: some.txt + regexp: ^\t$ + line: string with \t inside + - name: Foo + ansible.builtin.debug: + msg: "Presence of \t should trigger no-tabs here." + - name: Key has a tab + ansible.builtin.debug: + "ms\tg": "The associated key has \t and should trigger no-tabs here." + - name: Should not trigger no-tabs rules # noqa fqcn + lineinfile: + path: some.txt + regexp: ^\t$ + line: string with \t inside diff --git a/examples/playbooks/rule-only-builtins.yml b/examples/playbooks/rule-only-builtins.yml new file mode 100644 index 0000000..18f0f04 --- /dev/null +++ b/examples/playbooks/rule-only-builtins.yml @@ -0,0 +1,12 @@ +--- +- name: Fixture for examples/playbooks/rule-only-builtins.yml + hosts: localhost + tasks: + - name: Sysctl # noqa: args[module] + # while next module is mocked in our config, we still want to see that + # only-builtins rules gets matched + fake_namespace.fake_collection.fake_module: + name: vm.swappiness + value: "5" + - name: Some task # noqa: args[module] + zuul_return: {} diff --git a/examples/playbooks/rule-partial-become-without-become-fail.yml b/examples/playbooks/rule-partial-become-without-become-fail.yml new file mode 100644 index 0000000..da48b2f --- /dev/null +++ b/examples/playbooks/rule-partial-become-without-become-fail.yml @@ -0,0 +1,28 @@ +--- +- hosts: localhost + name: Use of become_user without become play + become_user: root + + tasks: + - ansible.builtin.debug: + msg: hello + +- hosts: localhost + + tasks: + - name: Use of become_user without become task + ansible.builtin.command: whoami + become_user: postgres + changed_when: false + +- hosts: localhost + + tasks: + - name: A block with become and become_user on different tasks + block: + - name: Sample become + become: true + ansible.builtin.command: whoami + - name: Sample become_user + become_user: postgres + ansible.builtin.command: whoami diff --git a/examples/playbooks/rule-partial-become-without-become-pass.yml b/examples/playbooks/rule-partial-become-without-become-pass.yml new file mode 100644 index 0000000..e1ae189 --- /dev/null +++ b/examples/playbooks/rule-partial-become-without-become-pass.yml @@ -0,0 +1,35 @@ +--- +- hosts: localhost + become_user: root + become: true + + tasks: + - ansible.builtin.debug: + msg: hello + +- hosts: localhost + + tasks: + - name: Foo + ansible.builtin.command: whoami + become_user: postgres + become: true + changed_when: false + +- hosts: localhost + become: true + + tasks: + - name: Accepts a become from higher scope + ansible.builtin.command: whoami + become_user: postgres + changed_when: false + +- hosts: localhost + become_user: postgres + + tasks: + - name: Accepts a become from a lower scope + ansible.builtin.command: whoami + become: true + changed_when: false diff --git a/examples/playbooks/rule-risky-file-permissions-fail.yml b/examples/playbooks/rule-risky-file-permissions-fail.yml new file mode 100644 index 0000000..643f598 --- /dev/null +++ b/examples/playbooks/rule-risky-file-permissions-fail.yml @@ -0,0 +1,91 @@ +# Fixture for RiskyFilePermissionsRule should return 11 occurrences +--- +- name: FAIL_INI_PRESERVE + hosts: all + tasks: + - name: Ini_file does not accept preserve mode + community.general.ini_file: + path: foo + create: true + mode: preserve + section: bar + +- name: FAIL_INI_PERMISSION + hosts: all + tasks: + - name: Permissions needed if create is used + community.general.ini_file: + path: foo + create: true + section: bar + +- name: FAIL_PRESERVE_MODE + hosts: all + tasks: + - name: File does not allow preserve value for mode + ansible.builtin.file: + path: foo + mode: preserve + +- name: FAIL_MISSING_PERMISSIONS_TOUCH + hosts: all + tasks: + - name: Permissions missing and might create file # noqa: fqcn[action-core] + file: + path: foo + state: touch + - name: Permissions missing and might create file (fqcn) + ansible.builtin.file: + path: foo + state: touch + +- name: FAIL_MISSING_PERMISSIONS_DIRECTORY + hosts: all + tasks: + - name: Permissions missing and might create directory # noqa: fqcn[action-core] + file: + path: foo + state: directory + - name: Lineinfile when create is true (fqcn) + ansible.builtin.lineinfile: + path: foo + create: true + line: some content here + +- name: FAIL_MISSING_PERMISSIONS_GET_URL + hosts: all + tasks: + - name: Permissions missing + # noqa: fqcn[action-core] + get_url: + url: http://foo + dest: foo + +- name: FAIL_LINEINFILE_CREATE + hosts: all + tasks: + - name: Lineinfile when create is true + ansible.builtin.lineinfile: + path: foo + create: true + line: some content here + +- name: FAIL_REPLACE_PRESERVE + hosts: all + tasks: + - name: Replace does not allow preserve mode # noqa: fqcn[action-core] + replace: + path: foo + mode: preserve + regexp: foo + +- name: FAIL_PERMISSION_COMMENT + hosts: all + tasks: + - name: Permissions is only a comment # noqa: fqcn[action-core] + file: + path: foo + owner: root + group: root + state: directory + # mode: 0755 diff --git a/examples/playbooks/rule-risky-file-permissions-pass.yml b/examples/playbooks/rule-risky-file-permissions-pass.yml new file mode 100644 index 0000000..7611708 --- /dev/null +++ b/examples/playbooks/rule-risky-file-permissions-pass.yml @@ -0,0 +1,77 @@ +# Fixture for RiskyFilePermissionsRule should pass +--- +- name: SUCCESS_PERMISSIONS_PRESENT + hosts: all + tasks: + - name: Permissions not missing and numeric + ansible.builtin.file: + path: foo + mode: "0600" + +- name: SUCCESS_PERMISSIONS_PRESENT_GET_URL + hosts: all + tasks: + - name: Permissions not missing and numeric + ansible.builtin.get_url: + url: http://foo + dest: foo + mode: "0600" + +- name: SUCCESS_ABSENT_STATE + hosts: all + tasks: + - name: Permissions missing while state is absent is fine + ansible.builtin.file: + path: foo + state: absent + +- name: SUCCESS_DEFAULT_STATE + hosts: all + tasks: + - name: Permissions missing while state is file (default) is fine + ansible.builtin.file: + path: foo + +- name: SUCCESS_LINK_STATE + hosts: all + tasks: + - name: Permissions missing while state is link is fine + ansible.builtin.file: + path: foo2 + src: foo + state: link + +- name: SUCCESS_CREATE_FALSE + hosts: all + tasks: + - name: File edit when create is false + ansible.builtin.lineinfile: + path: foo + create: false + line: some content here + +- name: SUCCESS_REPLACE + hosts: all + tasks: + - name: Replace should not require mode + ansible.builtin.replace: + path: foo + regexp: foo + +- name: SUCCESS_RECURSE + hosts: all + tasks: + - name: File with recursive does not require mode + ansible.builtin.file: + state: directory + recurse: true + path: foo + - name: Permissions not missing and numeric (fqcn) + ansible.builtin.file: + path: bar + mode: "755" # noqa: risky-octal + - name: File edit when create is false (fqcn) + ansible.builtin.lineinfile: + path: foo + create: false + line: some content here diff --git a/examples/playbooks/rule-risky-octal-fail.yml b/examples/playbooks/rule-risky-octal-fail.yml new file mode 100644 index 0000000..9e4a3bf --- /dev/null +++ b/examples/playbooks/rule-risky-octal-fail.yml @@ -0,0 +1,25 @@ +--- +- name: Fixture for testing risky-octal rule + hosts: hosts + vars: + varset: varset + tasks: + - name: Octal permissions test fail (600) + ansible.builtin.file: + path: foo + mode: 600 + + - name: Octal permissions test fail (710) + ansible.builtin.file: + path: foo + mode: 710 + + - name: Octal permissions test fail (123) + ansible.builtin.file: + path: foo + mode: 123 + + - name: Octal permissions test fail (2000) + ansible.builtin.file: + path: bar + mode: 2000 diff --git a/examples/playbooks/rule-risky-octal-pass.yml b/examples/playbooks/rule-risky-octal-pass.yml new file mode 100644 index 0000000..b900990 --- /dev/null +++ b/examples/playbooks/rule-risky-octal-pass.yml @@ -0,0 +1,42 @@ +--- +- name: Fixture for testing risky-octal rule + hosts: hosts + vars: + varset: varset + tags: + - no-free-form + tasks: + - name: Octal permissions test success (0600) + ansible.builtin.file: + path: foo + mode: "0600" + + - name: Octal permissions test success (0000) + ansible.builtin.file: + path: foo + mode: "0000" + + - name: Octal permissions test success (02000) + ansible.builtin.file: + path: bar + mode: "02000" + + - name: Octal permissions test success (02751) + ansible.builtin.file: + path: bar + mode: "02751" + + - name: Octal permissions test success (0777) + ansible.builtin.file: path=baz mode=0777 # noqa: no-free-form + + - name: Octal permissions test success (0711) + ansible.builtin.file: path=baz mode=0711 # noqa: no-free-form + + - name: Permissions test success (0777) + ansible.builtin.file: path=baz mode=u+rwx # noqa: no-free-form + + - name: Octal permissions test success (777) + ansible.builtin.file: path=baz mode=777 # noqa: no-free-form + + - name: Octal permissions test success (733) + ansible.builtin.file: path=baz mode=733 # noqa: no-free-form diff --git a/examples/playbooks/rule-risky-shell-pipe-fail.yml b/examples/playbooks/rule-risky-shell-pipe-fail.yml new file mode 100644 index 0000000..d727bc4 --- /dev/null +++ b/examples/playbooks/rule-risky-shell-pipe-fail.yml @@ -0,0 +1,17 @@ +--- +- name: Test fixture for risky-shell-pipe + hosts: localhost + become: false + tasks: + - name: Pipeline without pipefail + ansible.builtin.shell: false | cat + changed_when: false + + - name: Pipeline with or and pipe, no pipefail + ansible.builtin.shell: false || true | cat + changed_when: false + + - name: Another one + ansible.builtin.shell: | + df | grep '/dev' + changed_when: false diff --git a/examples/playbooks/rule-risky-shell-pipe-pass.yml b/examples/playbooks/rule-risky-shell-pipe-pass.yml new file mode 100644 index 0000000..386e8e8 --- /dev/null +++ b/examples/playbooks/rule-risky-shell-pipe-pass.yml @@ -0,0 +1,70 @@ +--- +- name: Test fixture for risky-shell-pipe + hosts: localhost + become: false + tasks: + - name: Pipeline with pipefail + ansible.builtin.shell: set -o pipefail && false | cat + changed_when: false + + - name: Pipeline with pipefail, multi-line + ansible.builtin.shell: | + set -o pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail, complex set + ansible.builtin.shell: | + set -e -x -o pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail, complex set + ansible.builtin.shell: | + set -e -x -o pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail, complex set + ansible.builtin.shell: | + set -eo pipefail + false | cat + changed_when: false + + - name: Pipeline with pipefail not at first line + ansible.builtin.shell: | + echo foo + set -eo pipefail + false | cat + changed_when: false + + - name: Pipeline without pipefail, ignoring errors # noqa: risky-shell-pipe + ansible.builtin.shell: false | cat + failed_when: false + changed_when: false + + - name: Non-pipeline without pipefail # noqa: command-instead-of-shell + ansible.builtin.shell: "true" + changed_when: false + + - name: Command without pipefail + ansible.builtin.command: "true" + changed_when: false + + - name: Shell with or + ansible.builtin.shell: false || true + changed_when: false + + - name: Another one + ansible.builtin.shell: | + set -o pipefail + df | grep '/dev' + changed_when: false + + - name: "PowerShell with pipefail should be ok, bug #3161" + # https://github.com/ansible/ansible-lint/issues/3161 + ansible.builtin.shell: + executable: /bin/pwsh + cmd: | + $ProgressPreference = 'this | that' + changed_when: false diff --git a/examples/playbooks/rule-role-name-path.yml b/examples/playbooks/rule-role-name-path.yml new file mode 100644 index 0000000..5fedae8 --- /dev/null +++ b/examples/playbooks/rule-role-name-path.yml @@ -0,0 +1,10 @@ +--- +- name: Fixture for role-name[path] rule + hosts: localhost + roles: + - subfolder/1st_role # 1st + - role: subfolder/2nd_role # 2nd + tasks: + - name: Another + ansible.builtin.import_role: + name: subfolder/3rd_role # 3rd diff --git a/examples/playbooks/rule-schema-become-method-fail.yml b/examples/playbooks/rule-schema-become-method-fail.yml new file mode 100644 index 0000000..555e14e --- /dev/null +++ b/examples/playbooks/rule-schema-become-method-fail.yml @@ -0,0 +1,10 @@ +--- +- name: Test 'become_method' plugin validity + hosts: localhost + become: true + become_method: this_is_not_an_installed_plugin + tasks: + - name: Another example + ansible.builtin.debug: + msg: "This should not be reached" + become_method: this_is_not_an_installed_plugin diff --git a/examples/playbooks/rule-schema-become-method-pass.yml b/examples/playbooks/rule-schema-become-method-pass.yml new file mode 100644 index 0000000..23eca31 --- /dev/null +++ b/examples/playbooks/rule-schema-become-method-pass.yml @@ -0,0 +1,5 @@ +--- +- name: Test 'become_method' plugin validity + hosts: localhost + become: true + become_method: ansible.builtin.sudo diff --git a/examples/playbooks/rule-syntax-moves.yml b/examples/playbooks/rule-syntax-moves.yml new file mode 100644 index 0000000..7cba53b --- /dev/null +++ b/examples/playbooks/rule-syntax-moves.yml @@ -0,0 +1,16 @@ +--- +- name: Fixture for syntax[moves] + hosts: localhost + tasks: + - name: 1st + ansible.builtin.debug: + msg: "{{ item }}" + with_flattened: [] # moved to community.general in 2.10 + - name: 2nd + ansible.builtin.debug: + msg: "{{ item }}" + with_cartesian: [] # moved to community.general in 2.10 + - name: 3rd + ansible.builtin.debug: + msg: "{{ item }}" + with_filetree: [] # moved to community.general in 2.10 diff --git a/examples/playbooks/rule-validate-module-options-pass-2.yml b/examples/playbooks/rule-validate-module-options-pass-2.yml new file mode 100644 index 0000000..90b88b3 --- /dev/null +++ b/examples/playbooks/rule-validate-module-options-pass-2.yml @@ -0,0 +1,10 @@ +--- +- name: Fixture to validate module options action pass scenarios + hosts: localhost + tasks: + - name: Copy a new "ntp.conf" file into place with backup + ansible.builtin.copy: + src: /mine/ntp.conf + dest: /etc/ntp.conf + backup: true + mode: "0600" diff --git a/examples/playbooks/rule-var-naming-fail.yml b/examples/playbooks/rule-var-naming-fail.yml new file mode 100644 index 0000000..888ed72 --- /dev/null +++ b/examples/playbooks/rule-var-naming-fail.yml @@ -0,0 +1,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 diff --git a/examples/playbooks/rule-yaml-fail.yml b/examples/playbooks/rule-yaml-fail.yml new file mode 100644 index 0000000..05fb572 --- /dev/null +++ b/examples/playbooks/rule-yaml-fail.yml @@ -0,0 +1,18 @@ +--- +- name: Fixture for yaml rule that should generate 3 errors + # https://github.com/ansible/ansible-lint/issues/3139 + hosts: localhost + tasks: + - name: "1" + ansible.builtin.debug: + msg: yes + + - name: "2" + ansible.builtin.debug: + msg: yes + tags: + - skip_ansible_lint # this has no effect for yamllint rule + + - name: "3" + ansible.builtin.debug: + msg: yes diff --git a/examples/playbooks/rule-yaml-pass.yml b/examples/playbooks/rule-yaml-pass.yml new file mode 100644 index 0000000..497471a --- /dev/null +++ b/examples/playbooks/rule-yaml-pass.yml @@ -0,0 +1,7 @@ +--- +# yamllint disable rule:truthy +- name: Fixture for yaml rule testing ability to use disable comments + hosts: localhost + tasks: [] + become: yes # <-- allowed only due to comment above +# yamllint enable rule:truthy diff --git a/examples/playbooks/rule_literal_compare_fail.yml b/examples/playbooks/rule_literal_compare_fail.yml new file mode 100644 index 0000000..6448d70 --- /dev/null +++ b/examples/playbooks/rule_literal_compare_fail.yml @@ -0,0 +1,19 @@ +--- +- name: Fixture for literal-compare + hosts: localhost + tasks: + - name: Example task # <-- 1st + ansible.builtin.debug: + msg: test + when: my_var == True + + - name: Example task # <-- 2nd + ansible.builtin.debug: + msg: test + when: my_var == false + + - name: Another example task # <-- 3rd + ansible.builtin.debug: + msg: test + when: + - my_var == false diff --git a/examples/playbooks/rule_literal_compare_pass.yml b/examples/playbooks/rule_literal_compare_pass.yml new file mode 100644 index 0000000..56737cb --- /dev/null +++ b/examples/playbooks/rule_literal_compare_pass.yml @@ -0,0 +1,25 @@ +--- +- name: Fixture for literal-compare + hosts: localhost + tasks: + - name: Example task + ansible.builtin.debug: + msg: test + when: my_var + + - name: Another example task + ansible.builtin.debug: + msg: test + when: + - 1 + 1 == 2 + - true + + - name: Example task + ansible.builtin.debug: + msg: test + when: not my_var + + - name: Example task + ansible.builtin.debug: + msg: test + when: my_var not None diff --git a/examples/playbooks/rulebook.yml b/examples/playbooks/rulebook.yml new file mode 100644 index 0000000..3eaf308 --- /dev/null +++ b/examples/playbooks/rulebook.yml @@ -0,0 +1,21 @@ +--- +# That file is not a valid playbook but it is a valid rulebook that was +# mistakenly put under a playbook directory. +- name: Demo rules with kafka as source + hosts: localhost + sources: + - name: kafka + kafka: + topic: eda + host: localhost + port: 9092 + group_id: testing + rules: + - name: + condition: event.i is defined + action: + debug: + - name: + condition: event.stop == true + action: + shutdown: diff --git a/examples/playbooks/run-once-fail.yml b/examples/playbooks/run-once-fail.yml new file mode 100644 index 0000000..8963196 --- /dev/null +++ b/examples/playbooks/run-once-fail.yml @@ -0,0 +1,12 @@ +--- +- name: "Example with run_once" + hosts: all + # strategy: free # noqa: run-once[play] (Corrected code example) + strategy: free + gather_facts: false + tasks: + # - name: Task with run_once # noqa: run-once[task] (Corrected code example) + - name: Task with run_once + ansible.builtin.debug: + msg: "Test" + run_once: true # <-- avoid use of strategy as free at play level when using run_once at task level diff --git a/examples/playbooks/run-once-pass.yml b/examples/playbooks/run-once-pass.yml new file mode 100644 index 0000000..030a2a0 --- /dev/null +++ b/examples/playbooks/run-once-pass.yml @@ -0,0 +1,8 @@ +--- +- name: "Example without run_once" + hosts: all + gather_facts: false + tasks: + - name: Task without run_once + ansible.builtin.debug: + msg: "Test" diff --git a/examples/playbooks/schema-error-string.yml b/examples/playbooks/schema-error-string.yml new file mode 100644 index 0000000..00e5e40 --- /dev/null +++ b/examples/playbooks/schema-error-string.yml @@ -0,0 +1,4 @@ +--- +foo +# This file is valid YAML but from our point of view is an error, as is +# neither a Sequence or a Mapping. diff --git a/examples/playbooks/skiptasks.yml b/examples/playbooks/skiptasks.yml new file mode 100644 index 0000000..e105ed3 --- /dev/null +++ b/examples/playbooks/skiptasks.yml @@ -0,0 +1,64 @@ +--- +- hosts: all + + tasks: + - name: Test latest[git] + action: ansible.builtin.git + + - name: Test latest[hg] + action: ansible.builtin.hg + + - name: Test command-instead-of-module + ansible.builtin.command: git log + changed_when: false + + - name: Test no-free-form + ansible.builtin.command: creates=B chmod 644 A + + - name: Test latest[git] (skip) + action: ansible.builtin.git + tags: + - skip_ansible_lint + + - name: Test latest[hg] (skip) + action: ansible.builtin.hg + tags: + - skip_ansible_lint + + - name: Test command-instead-of-module (skip) + ansible.builtin.command: git log + tags: + - skip_ansible_lint + + - name: Test no-free-form (skip) + ansible.builtin.command: chmod 644 A + tags: + - skip_ansible_lint + + - name: Test latest[git] (don't warn) + ansible.builtin.command: git log + args: + warn: false + changed_when: false + + - name: Test latest[hg] (don't warn) + ansible.builtin.command: chmod 644 A + args: + warn: false + creates: B + + - name: Test latest[hg] (warn) + ansible.builtin.command: chmod 644 A + args: + warn: true + creates: B + + - name: Test latest[git] (don't warn single line) + ansible.builtin.command: warn=False chdir=/tmp/blah git log + changed_when: false + + - name: Test latest[hg] (don't warn single line) + ansible.builtin.command: warn=no creates=B chmod 644 A + + - name: Test latest[hg] (warn single line) + ansible.builtin.command: warn=yes creates=B chmod 644 A diff --git a/examples/playbooks/strict-mode.yml b/examples/playbooks/strict-mode.yml new file mode 100644 index 0000000..a69c428 --- /dev/null +++ b/examples/playbooks/strict-mode.yml @@ -0,0 +1,8 @@ +--- +- name: Fixture for test_strict + hosts: localhost + tasks: + - name: Display debug information + ansible.builtin.stat: + path2: echo "Hello World" # <-- args[module] due to invalid use of path2 instead of path + changed_when: false diff --git a/examples/playbooks/syntax-error-string.yml b/examples/playbooks/syntax-error-string.yml new file mode 100644 index 0000000..e158ea8 --- /dev/null +++ b/examples/playbooks/syntax-error-string.yml @@ -0,0 +1,7 @@ +# This file is valid YAML and passed JSON Schema validation but not ansible +# own syntax check. + +- hosts: localhost + tasks: + - name: Invalid syntax + x.y.z.w: {} diff --git a/examples/playbooks/syntax-error.yml b/examples/playbooks/syntax-error.yml new file mode 100644 index 0000000..8657633 --- /dev/null +++ b/examples/playbooks/syntax-error.yml @@ -0,0 +1,6 @@ +--- +- name: This should raise syntax-error + hosts: localhost + tasks: + ansible.builtin.debug: + msg: Note that `tasks` is not entered as a list. diff --git a/examples/playbooks/task_in_list-0.yml b/examples/playbooks/task_in_list-0.yml new file mode 100644 index 0000000..7956dbb --- /dev/null +++ b/examples/playbooks/task_in_list-0.yml @@ -0,0 +1,28 @@ +--- +- name: Fixture for task_in_list + hosts: localhost + tasks: + - name: A + ansible.builtin.debug: + msg: "A" + - name: B + ansible.builtin.debug: + msg: "C" + pre_tasks: + - name: C + ansible.builtin.debug: + msg: "C" + post_tasks: + - name: D + block: + - name: E + ansible.builtin.debug: + msg: "E" + rescue: + - name: F + ansible.builtin.debug: + msg: "F" + always: + - name: G + ansible.builtin.debug: + msg: "G" diff --git a/examples/playbooks/taskimports.yml b/examples/playbooks/taskimports.yml new file mode 100644 index 0000000..4e5b5f1 --- /dev/null +++ b/examples/playbooks/taskimports.yml @@ -0,0 +1,16 @@ +--- +- name: Fixture + hosts: localhost + vars: + varset: tasks/simple_task.yml + tasks: + - name: Import 1 # noqa: fqcn + import_tasks: tasks/nestedincludes.yml + # - import_tasks: "{{ varnotset }}.yml" + - name: Import 2 # noqa: fqcn + import_tasks: "{{ varset }}" + - name: Import 3 # noqa: fqcn + import_tasks: tasks/directory with spaces/main.yml + # Import tasks by FQCN as well to ensure they load + - name: Import 4 + ansible.builtin.import_tasks: tasks/passing_task.yml diff --git a/examples/playbooks/taskincludes.yml b/examples/playbooks/taskincludes.yml new file mode 100644 index 0000000..91f0fc6 --- /dev/null +++ b/examples/playbooks/taskincludes.yml @@ -0,0 +1,11 @@ +--- +- name: Fixture + hosts: localhost + vars: + varset: tasks/simple_task.yml + tasks: + # - include_tasks: "{{ varnotset }}.yml" + - include_tasks: "{{ varset }}.yml" + - include_tasks: tasks/directory with spaces/main.yml + # Include tasks by FQCN as well to ensure they load + - ansible.builtin.include_tasks: tasks/passing_task.yml diff --git a/examples/playbooks/tasks/bug-2875.yml b/examples/playbooks/tasks/bug-2875.yml new file mode 100644 index 0000000..73abe23 --- /dev/null +++ b/examples/playbooks/tasks/bug-2875.yml @@ -0,0 +1,9 @@ +--- +- name: "Reproduce bug #2875" + include_tasks: "{{ lookup('first_found', __ff_params) }}" + vars: + __ff_params: + files: + - "default.yml" + paths: + - "{{ role_path }}/tasks/setup" diff --git a/examples/playbooks/tasks/conflicting-action-statements.yml b/examples/playbooks/tasks/conflicting-action-statements.yml new file mode 100644 index 0000000..3fe4d71 --- /dev/null +++ b/examples/playbooks/tasks/conflicting-action-statements.yml @@ -0,0 +1,3 @@ +--- +- shell: pip + changed: false diff --git a/examples/playbooks/tasks/directory with spaces/main.yml b/examples/playbooks/tasks/directory with spaces/main.yml new file mode 100644 index 0000000..d7c5c1c --- /dev/null +++ b/examples/playbooks/tasks/directory with spaces/main.yml @@ -0,0 +1,4 @@ +--- +# this should generate: name[missing]: All tasks should be named +- ansible.builtin.assert: + fail_msg: tasks in directory with spaces included diff --git a/examples/playbooks/tasks/empty_blocks.yml b/examples/playbooks/tasks/empty_blocks.yml new file mode 100644 index 0000000..2555e35 --- /dev/null +++ b/examples/playbooks/tasks/empty_blocks.yml @@ -0,0 +1,17 @@ +--- +- name: A named block task + block: + - name: an assertion + ansible.builtin.assert: + fail_msg: foo + rescue: # null + always: {} +- block: + - name: Another assertion + ansible.builtin.assert: + fail_msg: bar + rescue: {} + always: + - name: Yet another assertion + ansible.builtin.assert: + fail_msg: baz diff --git a/examples/playbooks/tasks/include-in-block-inner.yml b/examples/playbooks/tasks/include-in-block-inner.yml new file mode 100644 index 0000000..bc6f81b --- /dev/null +++ b/examples/playbooks/tasks/include-in-block-inner.yml @@ -0,0 +1,5 @@ +--- +- name: include-in-block-inner | I am a block + block: + - name: simple_task | Include tasks from inside a block + ansible.builtin.include_tasks: simple_task.yml diff --git a/examples/playbooks/tasks/included-task-with-vars.yml b/examples/playbooks/tasks/included-task-with-vars.yml new file mode 100644 index 0000000..6cf7a88 --- /dev/null +++ b/examples/playbooks/tasks/included-task-with-vars.yml @@ -0,0 +1,4 @@ +--- +- name: included-task-with-vars | Test + ansible.builtin.debug: + msg: "{{ foo }}" diff --git a/examples/playbooks/tasks/included-with-lint.yml b/examples/playbooks/tasks/included-with-lint.yml new file mode 100644 index 0000000..0f2bbd2 --- /dev/null +++ b/examples/playbooks/tasks/included-with-lint.yml @@ -0,0 +1,4 @@ +--- +# missing a task name +- ansible.builtin.assert: + fail_msg: foo diff --git a/examples/playbooks/tasks/malformed.yml b/examples/playbooks/tasks/malformed.yml new file mode 100644 index 0000000..f0805cd --- /dev/null +++ b/examples/playbooks/tasks/malformed.yml @@ -0,0 +1,3 @@ +--- +# should produce a malformed error from ansible syntax check +- oops this is invalid diff --git a/examples/playbooks/tasks/nestedincludes.yml b/examples/playbooks/tasks/nestedincludes.yml new file mode 100644 index 0000000..6c2631f --- /dev/null +++ b/examples/playbooks/tasks/nestedincludes.yml @@ -0,0 +1,3 @@ +--- +- name: simple_task | One include + include_tasks: tasks/simple_task.yml diff --git a/examples/playbooks/tasks/passing_task.yml b/examples/playbooks/tasks/passing_task.yml new file mode 100644 index 0000000..23a8651 --- /dev/null +++ b/examples/playbooks/tasks/passing_task.yml @@ -0,0 +1,4 @@ +--- +- name: passing_task | Simple task to include which generates no errors + ansible.builtin.assert: + that: true diff --git a/examples/playbooks/tasks/rule-name-prefix-fail.yml b/examples/playbooks/tasks/rule-name-prefix-fail.yml new file mode 100644 index 0000000..680ccd1 --- /dev/null +++ b/examples/playbooks/tasks/rule-name-prefix-fail.yml @@ -0,0 +1,13 @@ +--- +- name: rule-name-prefix-fail | this is not correctly capitalized + ansible.builtin.assert: + that: true +- name: This is missing the prefix + ansible.builtin.assert: + that: true +- name: name | This prefix is incomplete + ansible.builtin.assert: + that: true +- name: rule-name-prefix-fail | This is correctly | named too + ansible.builtin.assert: + that: true diff --git a/examples/playbooks/tasks/simple_task.yml b/examples/playbooks/tasks/simple_task.yml new file mode 100644 index 0000000..aea6938 --- /dev/null +++ b/examples/playbooks/tasks/simple_task.yml @@ -0,0 +1,4 @@ +--- +- name: simple_task | This is named + ansible.builtin.assert: + fail_msg: foo diff --git a/examples/playbooks/tasks/vars/bug-3289.yml b/examples/playbooks/tasks/vars/bug-3289.yml new file mode 100644 index 0000000..01308f2 --- /dev/null +++ b/examples/playbooks/tasks/vars/bug-3289.yml @@ -0,0 +1,2 @@ +--- +city: Dresden diff --git a/examples/playbooks/tasks/varset.yml b/examples/playbooks/tasks/varset.yml new file mode 100644 index 0000000..f4337eb --- /dev/null +++ b/examples/playbooks/tasks/varset.yml @@ -0,0 +1,4 @@ +--- +- debug: msg="var was set" + +- git: repo=hello.git diff --git a/examples/playbooks/tasks/varunset.yml b/examples/playbooks/tasks/varunset.yml new file mode 100644 index 0000000..a5508f0 --- /dev/null +++ b/examples/playbooks/tasks/varunset.yml @@ -0,0 +1,2 @@ +--- +- debug: msg="var was not set" diff --git a/examples/playbooks/tasks/x.yml b/examples/playbooks/tasks/x.yml new file mode 100644 index 0000000..a98230f --- /dev/null +++ b/examples/playbooks/tasks/x.yml @@ -0,0 +1,7 @@ +--- +- # nothing, checks bug #849 +- name: Test include + action: funny value=clown + args: + key: value +- # a second null task, validates yaml_utils.get_path_to_task diff --git a/examples/playbooks/templates/not-valid.yaml b/examples/playbooks/templates/not-valid.yaml new file mode 100644 index 0000000..5d34f55 --- /dev/null +++ b/examples/playbooks/templates/not-valid.yaml @@ -0,0 +1,2 @@ +# Used to validate that a templated YAML file does not confuse the linter +{% include 'port.j2' %} diff --git a/examples/playbooks/test_import_with_conflicting_action_statements.yml b/examples/playbooks/test_import_with_conflicting_action_statements.yml new file mode 100644 index 0000000..042a8dd --- /dev/null +++ b/examples/playbooks/test_import_with_conflicting_action_statements.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + tasks: + - import_tasks: tasks/conflicting-action-statements.yml diff --git a/examples/playbooks/test_import_with_malformed.yml b/examples/playbooks/test_import_with_malformed.yml new file mode 100644 index 0000000..6ce21cd --- /dev/null +++ b/examples/playbooks/test_import_with_malformed.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + tasks: + - import_tasks: tasks/malformed.yml diff --git a/examples/playbooks/test_include_inplace.yml b/examples/playbooks/test_include_inplace.yml new file mode 100644 index 0000000..0f4cf2c --- /dev/null +++ b/examples/playbooks/test_include_inplace.yml @@ -0,0 +1,5 @@ +--- +- name: Test fixture + hosts: all + roles: + - include_in_the_place diff --git a/examples/playbooks/test_include_relative.yml b/examples/playbooks/test_include_relative.yml new file mode 100644 index 0000000..340d949 --- /dev/null +++ b/examples/playbooks/test_include_relative.yml @@ -0,0 +1,6 @@ +--- +- name: Test fixture + hosts: localhost + gather_facts: false + roles: + - include_relative diff --git a/examples/playbooks/test_skip_inside_yaml.yml b/examples/playbooks/test_skip_inside_yaml.yml new file mode 100644 index 0000000..1f72954 --- /dev/null +++ b/examples/playbooks/test_skip_inside_yaml.yml @@ -0,0 +1,64 @@ +--- +- name: Fixture + hosts: all + tags: + - skip_ansible_lint # should disable error at playbook level + tasks: + - name: Test + action: community.general.hg + args: + repo: foo + version: HEAD + + - name: Test latest[hg] (skipped) + action: community.general.hg + args: + repo: foo + # revision: HEAD + + - name: Test latest[git] and partial-become # noqa: latest[git] + action: ansible.builtin.git + args: + repo: foo + version: HEAD + become_user: alice + + - name: Test latest[git] and partial-become (skipped) # noqa: latest[git] partial-become + action: ansible.builtin.git + args: + repo: foo + version: HEAD + become_user: alice + + - name: Test YAML # <-- 1 jinja[spacing] + ansible.builtin.get_url: + # noqa: risky-file-permissions + url: http://example.com/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/file.conf # <-- 2 yaml[line-length] + dest: "{{dest_proj_path}}/foo.conf" + - name: Test YAML and jinja[spacing] (skipped) + ansible.builtin.get_url: + # noqa: risky-file-permissions + url: http://example.com/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/really_long_path/file.conf # noqa: yaml[line-length] + dest: "{{dest_proj_path}}/foo.conf" # noqa: jinja[spacing] + + - name: Test no-free-form # <-- 3 no-free-form + ansible.builtin.command: creates=B chmod 644 A # noqa: no-free-form + - name: Test no-free-form # <-- 4 no-free-form + ansible.builtin.command: warn=yes creates=B chmod 644 A # noqa: no-free-form + - name: Test no-free-form (skipped via no warn) + ansible.builtin.command: warn=no creates=B chmod 644 A # noqa: no-free-form + - name: Test no-free-form (skipped via skip_ansible_lint) + ansible.builtin.command: creates=B chmod 644 A # noqa: no-free-form + tags: + - skip_ansible_lint + +- name: Fixture 2 + hosts: localhost + tasks: + - name: Foo + become: true + block: + - name: Bar + become_user: john_doe + ansible.builtin.command: "/etc/test.sh" + changed_when: false diff --git a/examples/playbooks/unicode.transformed.yml b/examples/playbooks/unicode.transformed.yml new file mode 100644 index 0000000..c07e9e7 --- /dev/null +++ b/examples/playbooks/unicode.transformed.yml @@ -0,0 +1,8 @@ +--- +- name: Fixture + hosts: all + tasks: + # cspell:disable-next-line + - name: Some тест + ansible.builtin.command: + cmd: uname diff --git a/examples/playbooks/unicode.yml b/examples/playbooks/unicode.yml new file mode 100644 index 0000000..c07e9e7 --- /dev/null +++ b/examples/playbooks/unicode.yml @@ -0,0 +1,8 @@ +--- +- name: Fixture + hosts: all + tasks: + # cspell:disable-next-line + - name: Some тест + ansible.builtin.command: + cmd: uname diff --git a/examples/playbooks/valid.yml b/examples/playbooks/valid.yml new file mode 100644 index 0000000..3c67f66 --- /dev/null +++ b/examples/playbooks/valid.yml @@ -0,0 +1,4 @@ +--- +- name: Minimal test play + hosts: localhost + tasks: [] diff --git a/examples/playbooks/valid_with_alt_extension.yaml b/examples/playbooks/valid_with_alt_extension.yaml new file mode 100644 index 0000000..e3694c8 --- /dev/null +++ b/examples/playbooks/valid_with_alt_extension.yaml @@ -0,0 +1,7 @@ +--- +# Used to validate that we also accept .yaml extension on playbooks +- name: Fixture + hosts: localhost + tasks: + - ansible.builtin.debug: # <-- should notify about missing 'name' + msg: hello! diff --git a/examples/playbooks/vars/empty.transformed.yml b/examples/playbooks/vars/empty.transformed.yml new file mode 100644 index 0000000..10abfa5 --- /dev/null +++ b/examples/playbooks/vars/empty.transformed.yml @@ -0,0 +1,3 @@ + +--- +# broken vars files due to spacing at the start of the file. diff --git a/examples/playbooks/vars/empty.yml b/examples/playbooks/vars/empty.yml new file mode 100644 index 0000000..10abfa5 --- /dev/null +++ b/examples/playbooks/vars/empty.yml @@ -0,0 +1,3 @@ + +--- +# broken vars files due to spacing at the start of the file. diff --git a/examples/playbooks/vars/empty_vars.transformed.yml b/examples/playbooks/vars/empty_vars.transformed.yml new file mode 100644 index 0000000..a6e18c1 --- /dev/null +++ b/examples/playbooks/vars/empty_vars.transformed.yml @@ -0,0 +1,2 @@ +--- +# Make sure that the Transformer does not mangle comment-only files! diff --git a/examples/playbooks/vars/empty_vars.yml b/examples/playbooks/vars/empty_vars.yml new file mode 100644 index 0000000..a6e18c1 --- /dev/null +++ b/examples/playbooks/vars/empty_vars.yml @@ -0,0 +1,2 @@ +--- +# Make sure that the Transformer does not mangle comment-only files! diff --git a/examples/playbooks/vars/invalid_vars_schema.yml b/examples/playbooks/vars/invalid_vars_schema.yml new file mode 100644 index 0000000..d4142a2 --- /dev/null +++ b/examples/playbooks/vars/invalid_vars_schema.yml @@ -0,0 +1,2 @@ +--- +123: true # invalid as schema expects string key diff --git a/examples/playbooks/vars/jinja-spacing.yml b/examples/playbooks/vars/jinja-spacing.yml new file mode 100644 index 0000000..419c7bc --- /dev/null +++ b/examples/playbooks/vars/jinja-spacing.yml @@ -0,0 +1,41 @@ +--- +# Should raise jinja[spacing] at line [14, 15, 16, 17, 18, 19, 22, 32, 38], at following variables. +# ".bad_var_1", ".bad_var_2", ".bad_var_3", ".invalid_multiline_nested_json", ".invalid_nested_json" +good_var_1: "{{ good_format }}" +good_var_2: "Value: {{ good_format }}" +good_var_3: "{{ good_format | filter }}" +good_var_4: "Value: {{ good_format | filter }}" +jinja_escape_1: "{{ '{{' }}" +jinja_escape_2: docker info --format '{{ '{{' }}json .Swarm.LocalNodeState{{ '}}' }}' | tr -d '"' +jinja_whitespace_control: | + {{ good_format }}/ + {{- good_format }} + {{- good_format -}} +bad_var_1: "{{bad_format}}" # <-- 1 +bad_var_2: "Value: {{ bad_format}}" # <-- 2 +bad_var_3: "{{bad_format }}" # <-- 3 +bad_var_4: "{{ bad_format|filter }}" # <-- 4 +bad_var_5: "Value: {{ bad_format |filter }}" # <-- 5 +bad_var_6: "{{ bad_format| filter }}" # <-- 6 +# spell-checker: disable-next-line +non_jinja_var: "data = ${lookup{$local_part}lsearch{/etc/aliases}}" # noqa: jinja[spacing] +json_inside_jinja: "{{ {'test': {'subtest': variable}} }}" +multiline_vars: # Assert that no false positive on multiline exists + cases: + case1: >- + http://example.com/{{ + case1 }} + case2: >- + http://example.com/{{ + case2 }} +valid_nested_json: "{{ {'dummy_2': {'nested_dummy_1': 'value_1', 'nested_dummy_2': value_2}} | combine(dummy_1) }}" +invalid_nested_json: "{{ {'dummy_2': {'nested_dummy_1': 'value_1', 'nested_dummy_2': value_2}} | combine(dummy_1)}}" # <-- 7 + +valid_multiline_nested_json: >- + {{ {'dummy_2': {'nested_dummy_1': value_1, + 'nested_dummy_2': value_2}} | + combine(dummy_1) }} +invalid_multiline_nested_json: >- # ignored multiline expression, for now + {{ {'dummy_2': {'nested_dummy_1': value_1, + 'nested_dummy_2': value_2}} | + combine(dummy_1)}} diff --git a/examples/playbooks/vars/other.yml b/examples/playbooks/vars/other.yml new file mode 100644 index 0000000..2771218 --- /dev/null +++ b/examples/playbooks/vars/other.yml @@ -0,0 +1,2 @@ +--- +some_var: some_value_defined_in_vars_other diff --git a/examples/playbooks/vars/rule_jinja_vars.yml b/examples/playbooks/vars/rule_jinja_vars.yml new file mode 100644 index 0000000..da9e6d1 --- /dev/null +++ b/examples/playbooks/vars/rule_jinja_vars.yml @@ -0,0 +1,5 @@ +# this should not trigger any errors because a 'when' inside +# a vars files, does not use implicit jinja. +--- +foo: + when: "{{ var }}" diff --git a/examples/playbooks/vars/rule_var_naming_fail.yml b/examples/playbooks/vars/rule_var_naming_fail.yml new file mode 100644 index 0000000..3870c26 --- /dev/null +++ b/examples/playbooks/vars/rule_var_naming_fail.yml @@ -0,0 +1,14 @@ +--- +CamelCaseIsBad: false # invalid +this_is_valid: # valid because content is a dict, not a variable + CamelCase: ... + ALL_CAPS: ... +ALL_CAPS_ARE_BAD_TOO: ... # invalid +"{{ 'test_' }}var": "value" # noqa: schema +CamelCaseButErrorIgnored: true # noqa: var-naming +assert: true # invalid due to being Python reserved keyword +é: true # invalid due to non-ascii character +hosts: true # invalid as being Ansible reserved name +role_name: boo # invalid as being Ansible special magic variable +ansible_facts: {} # special variable that we allow to be written +ansible_python_interpreter: python3 # special variable that we allow to be written diff --git a/examples/playbooks/vars/strings.transformed.yml b/examples/playbooks/vars/strings.transformed.yml new file mode 100644 index 0000000..6f2aae1 --- /dev/null +++ b/examples/playbooks/vars/strings.transformed.yml @@ -0,0 +1,39 @@ +--- +# Make sure that the Transformer does not mangle strings +# TODO: there is a bug in ruamel.yaml that discards some EOL comments + +single: single # this is a comment +single_with_double: '"single" quoted' # this is a comment + +single_multiline_with_octothorpe: "single over 160 char line to force wrapping. over 160 char line to force wrapping. over 160 char line to force wrapping. over 160\n + # this is not a comment" + +double: double # this is a comment +double_with_single: "'double' quoted" # this is a comment + +double_multiline_with_octothorpe: "double over 160 char line to force wrapping. over 160 char line to force wrapping. over 160 char line to force wrapping. over 160\n + # this is not a comment" + +# this is a comment +folded_block_scalar_with_octothorpe: > # comment 1 + # this is not a comment + +# this is a comment +folded_chomp_strip_block_scalar_with_octothorpe: >- # comment 2 + # this is not a comment + +# this is a comment +folded_chomp_keep_block_scalar_with_octothorpe: >+ # comment 3 + # this is not a comment + +# this is a comment +literal_block_scalar_with_octothorpe: | # this is a | EOL comment + # this is not a comment + +# this is a comment +literal_chomp_strip_block_scalar_with_octothorpe: |- # this is a | EOL comment + # this is not a comment + +# this is a comment +literal_chomp_keep_block_scalar_with_octothorpe: | # this is a | EOL comment + # this is not a comment diff --git a/examples/playbooks/vars/strings.yml b/examples/playbooks/vars/strings.yml new file mode 100644 index 0000000..a1b7868 --- /dev/null +++ b/examples/playbooks/vars/strings.yml @@ -0,0 +1,45 @@ +--- +# Make sure that the Transformer does not mangle strings +# TODO: there is a bug in ruamel.yaml that discards some EOL comments + +single: "single" # this is a comment +single_with_double: '"single" quoted' # this is a comment + +single_multiline_with_octothorpe: # this EOL comment gets lost + "single over 160 char line to force wrapping. over 160 char line to force wrapping. over 160 char line to force wrapping. + over 160 + + # this is not a comment" + +double: "double" # this is a comment +double_with_single: "'double' quoted" # this is a comment + +double_multiline_with_octothorpe: # this EOL comment gets lost + "double over 160 char line to force wrapping. over 160 char line to force wrapping. over 160 char line to force wrapping. + over 160 + + # this is not a comment" + +# this is a comment +folded_block_scalar_with_octothorpe: > # comment 1 + # this is not a comment + +# this is a comment +folded_chomp_strip_block_scalar_with_octothorpe: >- # comment 2 + # this is not a comment + +# this is a comment +folded_chomp_keep_block_scalar_with_octothorpe: >+ # comment 3 + # this is not a comment + +# this is a comment +literal_block_scalar_with_octothorpe: | # this is a | EOL comment + # this is not a comment + +# this is a comment +literal_chomp_strip_block_scalar_with_octothorpe: |- # this is a | EOL comment + # this is not a comment + +# this is a comment +literal_chomp_keep_block_scalar_with_octothorpe: |+ # this is a | EOL comment + # this is not a comment diff --git a/examples/playbooks/vars/subfolder/settings.yml b/examples/playbooks/vars/subfolder/settings.yml new file mode 100644 index 0000000..1c84d58 --- /dev/null +++ b/examples/playbooks/vars/subfolder/settings.yml @@ -0,0 +1,2 @@ +--- +some_var: some_value_defined_in_vars_subfolder_settings diff --git a/examples/playbooks/vars/vault_full.yml b/examples/playbooks/vars/vault_full.yml new file mode 100644 index 0000000..c432c62 --- /dev/null +++ b/examples/playbooks/vars/vault_full.yml @@ -0,0 +1,11 @@ +--- +$ANSIBLE_VAULT;1.1;AES256 +35366433323361393130396530643233373262666636646439303032366431303363316232313738 +3738636130636431623936303932306430316635663136610a353737333966353462333532393631 +36613030643762636138613734313862333165346464626461313361353732336131633137653865 +3862386136386137650a303433643531613337393735633338383163353737656339653134346363 +63613436333937313738633437373566333065663662643664643261313366323236356364316663 +62336264666464323066336365616634626336616537646336656266343562336533343732613539 +61643661303566313664313164623731316236666235656337363632393665353536303730666532 +64666639306361653963363462393966623763626566613831613739333666333665343734333630 +63623730623033346163393834396639383234393637653733396466316132663131 diff --git a/examples/playbooks/vars/vault_partial.yml b/examples/playbooks/vars/vault_partial.yml new file mode 100644 index 0000000..9806786 --- /dev/null +++ b/examples/playbooks/vars/vault_partial.yml @@ -0,0 +1,8 @@ +--- +ldap_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 35323062386261383633623963303361313937653837333033613933623434343138663331336164 + 3534373564393166656664306537633035613962356662645a316562353832363736313935383665 + 33306432623765646338303236363061326538653163643466643446716164326364643937623365 + 6239383765373639390a646361343566353934633532376231653838386231653865386665303733 + 34336534613538326639306139363538306636383463663437643466653064646363 diff --git a/examples/playbooks/warning-from-module.yml b/examples/playbooks/warning-from-module.yml new file mode 100644 index 0000000..d515361 --- /dev/null +++ b/examples/playbooks/warning-from-module.yml @@ -0,0 +1,11 @@ +--- +# https://github.com/ansible/ansible-lint/issues/3216 +- name: "Reproduce for bug #3216 warning from core module using Display.warning()" + hosts: localhost + gather_facts: false + tasks: + - name: Some task + ansible.builtin.debug: + msg: "{{ qq | unique }}" + vars: + qq: ["qq", "ww"] diff --git a/examples/playbooks/with-skip-tag-id.yml b/examples/playbooks/with-skip-tag-id.yml new file mode 100644 index 0000000..b383617 --- /dev/null +++ b/examples/playbooks/with-skip-tag-id.yml @@ -0,0 +1,7 @@ +--- +- hosts: all + tasks: + - name: Trailing whitespace on this line + ansible.builtin.git: + repo: "{{ archive_services_repo_url }}" + dest: /home/www diff --git "a/examples/playbooks/with-umlaut-\303\244.yml" "b/examples/playbooks/with-umlaut-\303\244.yml" new file mode 100644 index 0000000..2ee7a83 --- /dev/null +++ "b/examples/playbooks/with-umlaut-\303\244.yml" @@ -0,0 +1,5 @@ +--- +- hosts: + - localhost + roles: + - name: node -- cgit v1.2.3