From d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 18:04:56 +0200 Subject: Adding upstream version 6.13.1. Signed-off-by: Daniel Baumann --- examples/.config/ansible-lint.yml | 1 + examples/.config/molecule/config.yml | 0 examples/Taskfile.yml | 8 + examples/ansible-navigator.yml | 3 + examples/broken/.ansible-lint | 2 + examples/broken/ansible-navigator.yml | 3 + examples/broken/encoding.j2 | 1 + .../broken/yaml-with-tabs/invalid-due-tabs.yaml | 4 + .../meta/runtime.yml | 2 + examples/changelogs/changelog.yaml | 0 examples/collection/CHANGELOG.rst | 0 examples/collection/galaxy.yml | 17 + examples/ee_broken/execution-environment.yml | 3 + examples/execution-environment.yml | 4 + .../fail/changelogs/changelog.yaml | 2 + examples/galaxy_no_required_tags/fail/galaxy.yml | 11 + .../pass/changelogs/changelog.yaml | 2 + examples/galaxy_no_required_tags/pass/galaxy.yml | 12 + examples/group_vars/all.yml | 2 + examples/host_vars/localhost.yml | 2 + examples/inventory/broken_dev_inventory.yml | 3 + examples/inventory/inventory.yml | 31 + examples/inventory/production.yml | 38 + examples/lineno.yml | 3 + examples/meta/changelogs/changelog.yaml | 2 + examples/meta/galaxy.yml | 15 + examples/meta/runtime.yml | 3 + .../fail_0/meta/runtime.yml | 2 + .../fail_1/meta/runtime.yml | 2 + .../fail_2/meta/runtime.yml | 2 + .../pass/meta/runtime.yml | 2 + examples/no_changelog/galaxy.yml | 17 + .../changelogs/changelog.yaml | 2 + examples/no_collection_version/galaxy.yml | 14 + examples/other/guess-1.yml | 3 + examples/other/some.j2.yaml | 2 + examples/other/some.yaml-too | 1 + .../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 + examples/playbooks/collections/.gitignore | 2 + examples/playbooks/command-check-failure.yml | 13 + examples/playbooks/command-check-success.yml | 60 ++ 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/ematcher-rule.yml | 13 + examples/playbooks/empty_playbook.yml | 3 + examples/playbooks/example.yml | 49 + examples/playbooks/extra_vars.yml | 9 + examples/playbooks/find_children.yml | 10 + 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/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-1.yml | 36 + examples/playbooks/rule-args-module-pass-1.yml | 26 + examples/playbooks/rule-avoid-implicit-fail.yml | 9 + examples/playbooks/rule-avoid-implicit-pass.yml | 9 + .../playbooks/rule-deprecated-bare-vars-fail.yml | 97 ++ .../playbooks/rule-deprecated-bare-vars-pass.yml | 168 ++++ examples/playbooks/rule-fqcn-fail.yml | 14 + examples/playbooks/rule-fqcn-pass.yml | 13 + examples/playbooks/rule-jinja-invalid.yml | 12 + examples/playbooks/rule-jinja-valid.yml | 48 + examples/playbooks/rule-key-order-fail.yml | 30 + 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 | 10 + 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 | 17 + 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 | 88 ++ .../playbooks/rule-risky-file-permissions-pass.yml | 75 ++ examples/playbooks/rule-risky-octal-fail.yml | 25 + examples/playbooks/rule-risky-octal-pass.yml | 42 + examples/playbooks/rule-role-name-path.yml | 10 + 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/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/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 + 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/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 | 50 + 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_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/not_decryptable.yml | 10 + examples/playbooks/vars/other.yml | 2 + examples/playbooks/vars/rule_jinja_vars.yml | 5 + examples/playbooks/vars/strings.transformed.yml | 39 + examples/playbooks/vars/strings.yml | 45 + examples/playbooks/vars/subfolder/settings.yml | 2 + examples/playbooks/with-skip-tag-id.yml | 7 + "examples/playbooks/with-umlaut-\303\244.yml" | 5 + examples/reqs_v1/requirements.yml | 10 + examples/reqs_v2/requirements.yml | 8 + examples/roles/ansible-role-foo/tasks/main.yaml | 0 examples/roles/bobbins/tasks/imported_tasks.yml | 0 examples/roles/bobbins/tasks/main.yml | 7 + .../broken_argument_specs/meta/argument_specs.yml | 5 + examples/roles/dependency_in_meta/meta/main.yml | 42 + examples/roles/foo.yml | 0 examples/roles/hello/meta/argument_specs.yml | 27 + examples/roles/hello/meta/main.yml | 3 + .../include_in_the_place/tasks/included_file.yml | 4 + examples/roles/include_in_the_place/tasks/main.yml | 3 + examples/roles/include_miss/tasks/main.yml | 3 + .../roles/include_relative/tasks/included_file.yml | 4 + examples/roles/include_relative/tasks/main.yml | 7 + examples/roles/invalid-name/tasks/main.yaml | 4 + examples/roles/invalid_due_syntax/tasks/main.yml | 2 + examples/roles/invalid_due_to_meta/meta/main.yml | 10 + examples/roles/invalid_due_to_meta/tasks/main.yaml | 0 examples/roles/invalid_meta_schema/meta/main.yml | 9 + .../meta/requirements.yml | 3 + examples/roles/invalud_meta_schema | 0 examples/roles/loop_var_prefix/tasks/fail.yml | 38 + examples/roles/loop_var_prefix/tasks/pass.yml | 30 + examples/roles/meta_noqa/meta/main.yml | 8 + examples/roles/more_complex/handlers/main.yml | 3 + examples/roles/more_complex/tasks/main.yml | 9 + .../roles/role_for_no_same_owner/tasks/fail.yml | 71 ++ .../roles/role_for_no_same_owner/tasks/pass.yml | 32 + .../tasks/imported_tasks.yml | 3 + .../tasks/included_tasks.yml | 3 + .../roles/role_with_task_inclusions/tasks/main.yml | 10 + examples/roles/subfolder/1st_role/tasks/main.yml | 0 examples/roles/subfolder/2nd_role/tasks/main.yml | 0 examples/roles/subfolder/3rd_role/tasks/main.yml | 0 examples/roles/subfolder/other_role/tasks/main.yml | 4 + examples/roles/template_lookup/files/a_file | 0 examples/roles/template_lookup/tasks/main.yml | 10 + .../roles/template_lookup_missing/tasks/main.yml | 7 + examples/roles/test-role/meta/requirements.yml | 3 + .../molecule/default/include-import-role.yml | 6 + examples/roles/test-role/tasks/main.yml | 4 + examples/roles/test-role/tasks/world.yml | 3 + examples/roles/valid-due-to-meta/meta/main.yml | 10 + .../roles/valid-due-to-meta/tasks/debian/main.yml | 2 + examples/roles/valid-due-to-meta/tasks/main.yaml | 0 examples/roles/var_naming_pattern/.ansible-lint | 2 + examples/roles/var_naming_pattern/tasks/main.yml | 4 + examples/rulebooks/rulebook.yml | 19 + examples/rules/task_has_tag.py | 41 + examples/templates/playbooks/playbook.yml | 6 + .../testproject/roles/test-role/tasks/main.yml | 3 + examples/yamllint/invalid.yml | 9 + examples/yamllint/multi-document.yaml | 4 + examples/yamllint/valid.yml | 0 226 files changed, 4959 insertions(+) create mode 120000 examples/.config/ansible-lint.yml create mode 100644 examples/.config/molecule/config.yml create mode 100644 examples/Taskfile.yml create mode 100644 examples/ansible-navigator.yml create mode 100644 examples/broken/.ansible-lint create mode 100644 examples/broken/ansible-navigator.yml create mode 100644 examples/broken/encoding.j2 create mode 100644 examples/broken/yaml-with-tabs/invalid-due-tabs.yaml create mode 100644 examples/broken_collection_meta_runtime/meta/runtime.yml create mode 100644 examples/changelogs/changelog.yaml create mode 100644 examples/collection/CHANGELOG.rst create mode 100644 examples/collection/galaxy.yml create mode 100644 examples/ee_broken/execution-environment.yml create mode 100644 examples/execution-environment.yml create mode 100644 examples/galaxy_no_required_tags/fail/changelogs/changelog.yaml create mode 100644 examples/galaxy_no_required_tags/fail/galaxy.yml create mode 100644 examples/galaxy_no_required_tags/pass/changelogs/changelog.yaml create mode 100644 examples/galaxy_no_required_tags/pass/galaxy.yml create mode 100644 examples/group_vars/all.yml create mode 100644 examples/host_vars/localhost.yml create mode 100644 examples/inventory/broken_dev_inventory.yml create mode 100644 examples/inventory/inventory.yml create mode 100644 examples/inventory/production.yml create mode 100644 examples/lineno.yml create mode 100644 examples/meta/changelogs/changelog.yaml create mode 100644 examples/meta/galaxy.yml create mode 100644 examples/meta/runtime.yml create mode 100644 examples/meta_runtime_version_checks/fail_0/meta/runtime.yml create mode 100644 examples/meta_runtime_version_checks/fail_1/meta/runtime.yml create mode 100644 examples/meta_runtime_version_checks/fail_2/meta/runtime.yml create mode 100644 examples/meta_runtime_version_checks/pass/meta/runtime.yml create mode 100644 examples/no_changelog/galaxy.yml create mode 100644 examples/no_collection_version/changelogs/changelog.yaml create mode 100644 examples/no_collection_version/galaxy.yml create mode 100644 examples/other/guess-1.yml create mode 100644 examples/other/some.j2.yaml create mode 100644 examples/other/some.yaml-too 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/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/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/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/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-1.yml create mode 100644 examples/playbooks/rule-args-module-pass-1.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-deprecated-bare-vars-fail.yml create mode 100644 examples/playbooks/rule-deprecated-bare-vars-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-invalid.yml create mode 100644 examples/playbooks/rule-jinja-valid.yml create mode 100644 examples/playbooks/rule-key-order-fail.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-role-name-path.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/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/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-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/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_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/not_decryptable.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/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/with-skip-tag-id.yml create mode 100644 "examples/playbooks/with-umlaut-\303\244.yml" create mode 100644 examples/reqs_v1/requirements.yml create mode 100644 examples/reqs_v2/requirements.yml create mode 100644 examples/roles/ansible-role-foo/tasks/main.yaml create mode 100644 examples/roles/bobbins/tasks/imported_tasks.yml create mode 100644 examples/roles/bobbins/tasks/main.yml create mode 100644 examples/roles/broken_argument_specs/meta/argument_specs.yml create mode 100644 examples/roles/dependency_in_meta/meta/main.yml create mode 100644 examples/roles/foo.yml create mode 100644 examples/roles/hello/meta/argument_specs.yml create mode 100644 examples/roles/hello/meta/main.yml create mode 100644 examples/roles/include_in_the_place/tasks/included_file.yml create mode 100644 examples/roles/include_in_the_place/tasks/main.yml create mode 100644 examples/roles/include_miss/tasks/main.yml create mode 100644 examples/roles/include_relative/tasks/included_file.yml create mode 100644 examples/roles/include_relative/tasks/main.yml create mode 100644 examples/roles/invalid-name/tasks/main.yaml create mode 100644 examples/roles/invalid_due_syntax/tasks/main.yml create mode 100644 examples/roles/invalid_due_to_meta/meta/main.yml create mode 100644 examples/roles/invalid_due_to_meta/tasks/main.yaml create mode 100644 examples/roles/invalid_meta_schema/meta/main.yml create mode 100644 examples/roles/invalid_requirements_schema/meta/requirements.yml create mode 100644 examples/roles/invalud_meta_schema create mode 100644 examples/roles/loop_var_prefix/tasks/fail.yml create mode 100644 examples/roles/loop_var_prefix/tasks/pass.yml create mode 100644 examples/roles/meta_noqa/meta/main.yml create mode 100644 examples/roles/more_complex/handlers/main.yml create mode 100644 examples/roles/more_complex/tasks/main.yml create mode 100644 examples/roles/role_for_no_same_owner/tasks/fail.yml create mode 100644 examples/roles/role_for_no_same_owner/tasks/pass.yml create mode 100644 examples/roles/role_with_task_inclusions/tasks/imported_tasks.yml create mode 100644 examples/roles/role_with_task_inclusions/tasks/included_tasks.yml create mode 100644 examples/roles/role_with_task_inclusions/tasks/main.yml create mode 100644 examples/roles/subfolder/1st_role/tasks/main.yml create mode 100644 examples/roles/subfolder/2nd_role/tasks/main.yml create mode 100644 examples/roles/subfolder/3rd_role/tasks/main.yml create mode 100644 examples/roles/subfolder/other_role/tasks/main.yml create mode 100644 examples/roles/template_lookup/files/a_file create mode 100644 examples/roles/template_lookup/tasks/main.yml create mode 100644 examples/roles/template_lookup_missing/tasks/main.yml create mode 100644 examples/roles/test-role/meta/requirements.yml create mode 100644 examples/roles/test-role/molecule/default/include-import-role.yml create mode 100644 examples/roles/test-role/tasks/main.yml create mode 100644 examples/roles/test-role/tasks/world.yml create mode 100644 examples/roles/valid-due-to-meta/meta/main.yml create mode 100644 examples/roles/valid-due-to-meta/tasks/debian/main.yml create mode 100644 examples/roles/valid-due-to-meta/tasks/main.yaml create mode 100644 examples/roles/var_naming_pattern/.ansible-lint create mode 100644 examples/roles/var_naming_pattern/tasks/main.yml create mode 100644 examples/rulebooks/rulebook.yml create mode 100644 examples/rules/task_has_tag.py create mode 100644 examples/templates/playbooks/playbook.yml create mode 100644 examples/testproject/roles/test-role/tasks/main.yml create mode 100644 examples/yamllint/invalid.yml create mode 100644 examples/yamllint/multi-document.yaml create mode 100644 examples/yamllint/valid.yml (limited to 'examples') diff --git a/examples/.config/ansible-lint.yml b/examples/.config/ansible-lint.yml new file mode 120000 index 0000000..3da8d98 --- /dev/null +++ b/examples/.config/ansible-lint.yml @@ -0,0 +1 @@ +../../.ansible-lint \ No newline at end of file diff --git a/examples/.config/molecule/config.yml b/examples/.config/molecule/config.yml new file mode 100644 index 0000000..e69de29 diff --git a/examples/Taskfile.yml b/examples/Taskfile.yml new file mode 100644 index 0000000..9b0913d --- /dev/null +++ b/examples/Taskfile.yml @@ -0,0 +1,8 @@ +--- +# Sample taskfile, for testing linter ability to identify it +version: "3" +output: group +vars: + HOSTNAME: # <-- this is valid for Taskfiles but not for ansible files + sh: echo ${HOSTNAME:-localhost} +tasks: {} diff --git a/examples/ansible-navigator.yml b/examples/ansible-navigator.yml new file mode 100644 index 0000000..56e89cb --- /dev/null +++ b/examples/ansible-navigator.yml @@ -0,0 +1,3 @@ +--- +# see https://ansible-navigator.readthedocs.io/en/latest/settings/ +ansible-navigator: {} diff --git a/examples/broken/.ansible-lint b/examples/broken/.ansible-lint new file mode 100644 index 0000000..6428f2c --- /dev/null +++ b/examples/broken/.ansible-lint @@ -0,0 +1,2 @@ +# invalid ansible-lint config file +foo: bar # invalid based on schema diff --git a/examples/broken/ansible-navigator.yml b/examples/broken/ansible-navigator.yml new file mode 100644 index 0000000..cb4f4f6 --- /dev/null +++ b/examples/broken/ansible-navigator.yml @@ -0,0 +1,3 @@ +--- +# https://ansible-navigator.readthedocs.io/en/latest/settings/ +ansible: {} # invalid as it is missing 'ansible-navigator' parent key diff --git a/examples/broken/encoding.j2 b/examples/broken/encoding.j2 new file mode 100644 index 0000000..2616fcc --- /dev/null +++ b/examples/broken/encoding.j2 @@ -0,0 +1 @@ +À-Á diff --git a/examples/broken/yaml-with-tabs/invalid-due-tabs.yaml b/examples/broken/yaml-with-tabs/invalid-due-tabs.yaml new file mode 100644 index 0000000..0667f2e --- /dev/null +++ b/examples/broken/yaml-with-tabs/invalid-due-tabs.yaml @@ -0,0 +1,4 @@ +{ + "data": "this is not a valid YAML file as specification forbids tabs", + } +} diff --git a/examples/broken_collection_meta_runtime/meta/runtime.yml b/examples/broken_collection_meta_runtime/meta/runtime.yml new file mode 100644 index 0000000..41f4ead --- /dev/null +++ b/examples/broken_collection_meta_runtime/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +foo: bar # should fail meta-runtime schema validation diff --git a/examples/changelogs/changelog.yaml b/examples/changelogs/changelog.yaml new file mode 100644 index 0000000..e69de29 diff --git a/examples/collection/CHANGELOG.rst b/examples/collection/CHANGELOG.rst new file mode 100644 index 0000000..e69de29 diff --git a/examples/collection/galaxy.yml b/examples/collection/galaxy.yml new file mode 100644 index 0000000..e509486 --- /dev/null +++ b/examples/collection/galaxy.yml @@ -0,0 +1,17 @@ +--- +name: foo +namespace: bar +version: 0.0.0 # noqa: galaxy[version-incorrect] +authors: + - John +readme: ../README.md +description: "..." +dependencies: + other_namespace.collection1: ">=1.0.0" + other_namespace.collection2: ">=2.0.0,<3.0.0" + anderson55.my_collection: "*" # note: "*" selects the highest version available +license: + - GPL # <-- invalid license values based on galaxy schema + - Apache +repository: some-url +tags: [networking, test_tag] diff --git a/examples/ee_broken/execution-environment.yml b/examples/ee_broken/execution-environment.yml new file mode 100644 index 0000000..6b15f66 --- /dev/null +++ b/examples/ee_broken/execution-environment.yml @@ -0,0 +1,3 @@ +--- +# This should fail Execution Environment Schema validation +foo: bar diff --git a/examples/execution-environment.yml b/examples/execution-environment.yml new file mode 100644 index 0000000..9bed441 --- /dev/null +++ b/examples/execution-environment.yml @@ -0,0 +1,4 @@ +--- +version: 1 +dependencies: + galaxy: requirements.yml diff --git a/examples/galaxy_no_required_tags/fail/changelogs/changelog.yaml b/examples/galaxy_no_required_tags/fail/changelogs/changelog.yaml new file mode 100644 index 0000000..52e7f38 --- /dev/null +++ b/examples/galaxy_no_required_tags/fail/changelogs/changelog.yaml @@ -0,0 +1,2 @@ +--- +releases: {} diff --git a/examples/galaxy_no_required_tags/fail/galaxy.yml b/examples/galaxy_no_required_tags/fail/galaxy.yml new file mode 100644 index 0000000..48ee587 --- /dev/null +++ b/examples/galaxy_no_required_tags/fail/galaxy.yml @@ -0,0 +1,11 @@ +--- +namespace: bar +name: foo +version: 1.0.0 # <-- that version is not valid, should be 1.0.0 or greater +authors: + - John +readme: ../README.md +description: "..." +license: + - Apache-2.0 +repository: https://github.com/ansible-collections/community.REPO_NAME diff --git a/examples/galaxy_no_required_tags/pass/changelogs/changelog.yaml b/examples/galaxy_no_required_tags/pass/changelogs/changelog.yaml new file mode 100644 index 0000000..52e7f38 --- /dev/null +++ b/examples/galaxy_no_required_tags/pass/changelogs/changelog.yaml @@ -0,0 +1,2 @@ +--- +releases: {} diff --git a/examples/galaxy_no_required_tags/pass/galaxy.yml b/examples/galaxy_no_required_tags/pass/galaxy.yml new file mode 100644 index 0000000..0f62481 --- /dev/null +++ b/examples/galaxy_no_required_tags/pass/galaxy.yml @@ -0,0 +1,12 @@ +--- +namespace: bar +name: foo +version: 1.0.0 # <-- that version is not valid, should be 1.0.0 or greater +authors: + - John +readme: ../README.md +description: "..." +license: + - Apache-2.0 +repository: https://github.com/ansible-collections/community.REPO_NAME +tags: [networking, test_tag] diff --git a/examples/group_vars/all.yml b/examples/group_vars/all.yml new file mode 100644 index 0000000..ef692db --- /dev/null +++ b/examples/group_vars/all.yml @@ -0,0 +1,2 @@ +--- +some_var: some_value_defined_in_group_vars_all diff --git a/examples/host_vars/localhost.yml b/examples/host_vars/localhost.yml new file mode 100644 index 0000000..9c058f5 --- /dev/null +++ b/examples/host_vars/localhost.yml @@ -0,0 +1,2 @@ +--- +some_var: some_value_defined_in_host_vars_localhost diff --git a/examples/inventory/broken_dev_inventory.yml b/examples/inventory/broken_dev_inventory.yml new file mode 100644 index 0000000..0d7a793 --- /dev/null +++ b/examples/inventory/broken_dev_inventory.yml @@ -0,0 +1,3 @@ +--- +all: + foo: {} # invalid based on inventory json schema diff --git a/examples/inventory/inventory.yml b/examples/inventory/inventory.yml new file mode 100644 index 0000000..8752d9b --- /dev/null +++ b/examples/inventory/inventory.yml @@ -0,0 +1,31 @@ +--- +# https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html +ungrouped: {} +all: + hosts: + mail.example.com: + children: + webservers: + hosts: + foo.example.com: + bar.example.com: + dbservers: + hosts: + one.example.com: + two.example.com: + three.example.com: + east: + hosts: + foo.example.com: + one.example.com: + two.example.com: + west: + hosts: + bar.example.com: + three.example.com: + prod: + children: + east: {} + test: + children: + west: {} diff --git a/examples/inventory/production.yml b/examples/inventory/production.yml new file mode 100644 index 0000000..a8a7deb --- /dev/null +++ b/examples/inventory/production.yml @@ -0,0 +1,38 @@ +--- +all: + hosts: + mail.example.com: + children: + webservers: + hosts: + foo.example.com: + bar.example.com: + # ranges are supported: + www[01:50].example.com: + www[01:50:2].example.com: + # these are variables: + var_1: value_1 + another_var: 200 + dbservers: + hosts: + one.example.com: + two.example.com: + three.example.com: + east: + hosts: + foo.example.com: + one.example.com: + two.example.com: + west: + hosts: + bar.example.com: + three.example.com: + prod: + children: + east: + test: + children: + west: + # add variables for all hosts + vars: + my_var: 123 diff --git a/examples/lineno.yml b/examples/lineno.yml new file mode 100644 index 0000000..a741d91 --- /dev/null +++ b/examples/lineno.yml @@ -0,0 +1,3 @@ +--- +- tasks: + - git: repo=hello diff --git a/examples/meta/changelogs/changelog.yaml b/examples/meta/changelogs/changelog.yaml new file mode 100644 index 0000000..52e7f38 --- /dev/null +++ b/examples/meta/changelogs/changelog.yaml @@ -0,0 +1,2 @@ +--- +releases: {} diff --git a/examples/meta/galaxy.yml b/examples/meta/galaxy.yml new file mode 100644 index 0000000..b981f5c --- /dev/null +++ b/examples/meta/galaxy.yml @@ -0,0 +1,15 @@ +--- +name: foo +namespace: bar +version: 0.2.3 # <-- that version is not valid, should be 1.0.0 or greater +authors: + - John +readme: ../README.md +description: "..." +dependencies: + other_namespace.collection1: ">=1.0.0" + other_namespace.collection2: ">=2.0.0,<3.0.0" + anderson55.my_collection: "*" # note: "*" selects the highest version available +license: + - Apache-2.0 +tags: [networking, test_tag] diff --git a/examples/meta/runtime.yml b/examples/meta/runtime.yml new file mode 100644 index 0000000..895980b --- /dev/null +++ b/examples/meta/runtime.yml @@ -0,0 +1,3 @@ +--- +# https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_structure.html +requires_ansible: ">=2.10,<2.20" diff --git a/examples/meta_runtime_version_checks/fail_0/meta/runtime.yml b/examples/meta_runtime_version_checks/fail_0/meta/runtime.yml new file mode 100644 index 0000000..5ff8a8c --- /dev/null +++ b/examples/meta_runtime_version_checks/fail_0/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: ">=2.20.0" diff --git a/examples/meta_runtime_version_checks/fail_1/meta/runtime.yml b/examples/meta_runtime_version_checks/fail_1/meta/runtime.yml new file mode 100644 index 0000000..eb5ade0 --- /dev/null +++ b/examples/meta_runtime_version_checks/fail_1/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: ">=2.9.0,<2.20" diff --git a/examples/meta_runtime_version_checks/fail_2/meta/runtime.yml b/examples/meta_runtime_version_checks/fail_2/meta/runtime.yml new file mode 100644 index 0000000..92db835 --- /dev/null +++ b/examples/meta_runtime_version_checks/fail_2/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: "2.13.0,<2.15" diff --git a/examples/meta_runtime_version_checks/pass/meta/runtime.yml b/examples/meta_runtime_version_checks/pass/meta/runtime.yml new file mode 100644 index 0000000..2b69758 --- /dev/null +++ b/examples/meta_runtime_version_checks/pass/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: ">=2.13.0,<2.15" diff --git a/examples/no_changelog/galaxy.yml b/examples/no_changelog/galaxy.yml new file mode 100644 index 0000000..2c35693 --- /dev/null +++ b/examples/no_changelog/galaxy.yml @@ -0,0 +1,17 @@ +--- +name: foo +namespace: bar +version: 0.0.0 # noqa: galaxy[version-incorrect] +authors: + - John +readme: ../README.md +description: "..." +dependencies: + other_namespace.collection1: ">=1.0.0" + other_namespace.collection2: ">=2.0.0,<3.0.0" + anderson55.my_collection: "*" # note: "*" selects the highest version available +license: + - GPL-3.0-or-later + - Apache-2.0 +repository: some-url +tags: [networking, test_tag] diff --git a/examples/no_collection_version/changelogs/changelog.yaml b/examples/no_collection_version/changelogs/changelog.yaml new file mode 100644 index 0000000..52e7f38 --- /dev/null +++ b/examples/no_collection_version/changelogs/changelog.yaml @@ -0,0 +1,2 @@ +--- +releases: {} diff --git a/examples/no_collection_version/galaxy.yml b/examples/no_collection_version/galaxy.yml new file mode 100644 index 0000000..95d9d18 --- /dev/null +++ b/examples/no_collection_version/galaxy.yml @@ -0,0 +1,14 @@ +--- +name: galaxy_no_version +namespace: test +readme: ../README.md +authors: + - John +description: your collection description +license: + - GPL + - Apache + +dependencies: {} +repository: http://example.com/repository +tags: [networking, test_tag] diff --git a/examples/other/guess-1.yml b/examples/other/guess-1.yml new file mode 100644 index 0000000..b11fb9c --- /dev/null +++ b/examples/other/guess-1.yml @@ -0,0 +1,3 @@ +--- +- name: Minimal yaml to determine it as a playbook + hosts: localhost diff --git a/examples/other/some.j2.yaml b/examples/other/some.j2.yaml new file mode 100644 index 0000000..5d34f55 --- /dev/null +++ b/examples/other/some.j2.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/other/some.yaml-too b/examples/other/some.yaml-too new file mode 100644 index 0000000..50a2ada --- /dev/null +++ b/examples/other/some.yaml-too @@ -0,0 +1 @@ +# Used to test custom kinds defined in .ansible-config 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/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..b855b8a --- /dev/null +++ b/examples/playbooks/command-check-success.yml @@ -0,0 +1,60 @@ +--- +- 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 + ansible.builtin.command: creates=Z echo blah + + - name: Command with inline removes + ansible.builtin.command: removes=Z echo blah + + - name: Command with cmd + command: + cmd: echo blah + args: + creates: Z + + - name: Use shell with creates check + shell: echo blah + args: + creates: Z + + - name: Use shell with removes check + shell: echo blah + args: + removes: Z + + - name: Use shell with changed_when + shell: echo blah + changed_when: false + + - name: Use shell with inline creates + shell: creates=Z echo blah + + - name: Use shell with inline removes + shell: removes=Z echo blah + + - name: Use shell with cmd + shell: + cmd: echo blah + args: + creates: Z + +- hosts: localhost + handlers: + - name: Restart something + command: do something + - 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/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..d3832f1 --- /dev/null +++ b/examples/playbooks/extra_vars.yml @@ -0,0 +1,9 @@ +--- +- 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/handlers/included-handlers.yml b/examples/playbooks/handlers/included-handlers.yml new file mode 100644 index 0000000..77e7440 --- /dev/null +++ b/examples/playbooks/handlers/included-handlers.yml @@ -0,0 +1,6 @@ +--- +- name: Restart xyz + service: name=xyz state=restarted +# see Issue #165 +- name: Command handler issue 165 + 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/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..505741e --- /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: unnamed-task + 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..d5f4ae8 --- /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 unnamed-task + - 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-1.yml b/examples/playbooks/rule-args-module-fail-1.yml new file mode 100644 index 0000000..4c9b51e --- /dev/null +++ b/examples/playbooks/rule-args-module-fail-1.yml @@ -0,0 +1,36 @@ +--- +- 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: foo. Supported parameters include: no_block, state, daemon_reload (daemon-reload), name (service, unit), force, masked, daemon_reexec (daemon-reexec), scope, enabled.' + 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 diff --git a/examples/playbooks/rule-args-module-pass-1.yml b/examples/playbooks/rule-args-module-pass-1.yml new file mode 100644 index 0000000..872cd39 --- /dev/null +++ b/examples/playbooks/rule-args-module-pass-1.yml @@ -0,0 +1,26 @@ +--- +- 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 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-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-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-invalid.yml b/examples/playbooks/rule-jinja-invalid.yml new file mode 100644 index 0000000..c7bf5ba --- /dev/null +++ b/examples/playbooks/rule-jinja-invalid.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-valid.yml b/examples/playbooks/rule-jinja-valid.yml new file mode 100644 index 0000000..00ce00f --- /dev/null +++ b/examples/playbooks/rule-jinja-valid.yml @@ -0,0 +1,48 @@ +--- +# 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 }}" + +# 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 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-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..f5bcb08 --- /dev/null +++ b/examples/playbooks/rule-no-free-form-fail.yml @@ -0,0 +1,10 @@ +--- +- 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 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..422d1d8 --- /dev/null +++ b/examples/playbooks/rule-no-tabs.yml @@ -0,0 +1,17 @@ +--- +- 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: 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..02c551b --- /dev/null +++ b/examples/playbooks/rule-risky-file-permissions-fail.yml @@ -0,0 +1,88 @@ +# 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 + +- name: FAIL_INI_PERMISSION + hosts: all + tasks: + - name: Permissions needed if create is used + community.general.ini_file: + path: foo + create: true + +- 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 + 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 + 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 + replace: + path: foo + mode: preserve + +- name: FAIL_PERMISSION_COMMENT + hosts: all + tasks: + - name: Permissions is only a comment + 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..656b1d4 --- /dev/null +++ b/examples/playbooks/rule-risky-file-permissions-pass.yml @@ -0,0 +1,75 @@ +# 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 + +- name: SUCCESS_RECURSE + hosts: all + tasks: + - name: File with recursive does not require mode + ansible.builtin.file: + state: directory + recurse: true + - 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-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-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..6d812e9 --- /dev/null +++ b/examples/playbooks/rule-var-naming-fail.yml @@ -0,0 +1,32 @@ +--- +- name: Fixture + hosts: localhost + vars: + CamelCaseIsBad: false # invalid + this_is_valid: # valid because content is a dict, not a variable + CamelCase: ... + ALL_CAPS: ... + ALL_CAPS_ARE_BAD_TOO: ... # invalid + CamelCaseButErrorIgnored: true # noqa: var-naming + + tasks: + - name: Foo + ansible.builtin.set_fact: + "{{ 'test_' }}var": "value" # valid + - name: Bar + ansible.builtin.set_fact: + CamelCaseButErrorIgnored: true # noqa: var-naming + - name: Test in a block + vars: + BAD: false # invalid + MoreBad: ... # invalid + block: + - name: Foo + vars: + ALL_CAPS_ARE_BAD_TOO: "{{ MoreBad }}" # invalid + ansible.builtin.set_fact: + CamelCaseIsBad: "{{ BAD }}" # invalid + - name: Test on register + ansible.builtin.debug: + var: test_var + register: CamelCaseIsBad # invalid 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..7a3b09d --- /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 deprecated-command-syntax + 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 deprecated-command-syntax (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/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..2d43b29 --- /dev/null +++ b/examples/playbooks/tasks/directory with spaces/main.yml @@ -0,0 +1,4 @@ +--- +# this should generate: unnamed-task: 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-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/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..44d6c28 --- /dev/null +++ b/examples/playbooks/test_skip_inside_yaml.yml @@ -0,0 +1,50 @@ +--- +- name: Fixture + hosts: all + tags: + - skip_ansible_lint # should disable error at playbook level + tasks: + - name: Test # <-- 0 latest[hg] + action: ansible.builtin.hg # noqa: fqcn[canonical] + - name: Test latest[hg] (skipped) # noqa: latest[hg] fqcn[canonical] + action: ansible.builtin.hg + + - name: Test latest[git] and partial-become + action: ansible.builtin.git + become_user: alice + - name: Test latest[git] and partial-become (skipped) # noqa: latest[git] partial-become + action: ansible.builtin.git + 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 deprecated-command-syntax # <-- 3 deprecated-command-syntax + ansible.builtin.command: creates=B chmod 644 A # noqa: no-free-form + - name: Test deprecated-command-syntax # <-- 4 deprecated-command-syntax + ansible.builtin.command: warn=yes creates=B chmod 644 A # noqa: no-free-form + - name: Test deprecated-command-syntax (skipped via no warn) + ansible.builtin.command: warn=no creates=B chmod 644 A # noqa: no-free-form + - name: Test deprecated-command-syntax (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_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/not_decryptable.yml b/examples/playbooks/vars/not_decryptable.yml new file mode 100644 index 0000000..9a19b07 --- /dev/null +++ b/examples/playbooks/vars/not_decryptable.yml @@ -0,0 +1,10 @@ +$ANSIBLE_VAULT;1.1;AES256 +35366433323361393130396530643233373262666636646439303032366431303363316232313738 +3738636130636431623936303932306430316635663136610a353737333966353462333532393631 +36613030643762636138613734313862333165346464626461313361353732336131633137653865 +3862386136386137650a303433643531613337393735633338383163353737656339653134346363 +63613436333937313738633437373566333065663662643664643261313366323236356364316663 +62336264666464323066336365616634626336616537646336656266343562336533343732613539 +61643661303566313664313164623731316236666235656337363632393665353536303730666532 +64666639306361653963363462393966623763626566613831613739333666333665343734333630 +63623730623033346163393834396639383234393637653733396466316132663131 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/strings.transformed.yml b/examples/playbooks/vars/strings.transformed.yml new file mode 100644 index 0000000..d4a737a --- /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: > + # this is not a comment + +# this is a comment +folded_chomp_strip_block_scalar_with_octothorpe: >- + # this is not a comment + +# this is a comment +folded_chomp_keep_block_scalar_with_octothorpe: >+ + # 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..6be848e --- /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: > # > EOL comment gets lost + # this is not a comment + +# this is a comment +folded_chomp_strip_block_scalar_with_octothorpe: >- # > EOL comment gets lost + # this is not a comment + +# this is a comment +folded_chomp_keep_block_scalar_with_octothorpe: >+ # > EOL comment gets lost + # 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/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 diff --git a/examples/reqs_v1/requirements.yml b/examples/reqs_v1/requirements.yml new file mode 100644 index 0000000..65643ae --- /dev/null +++ b/examples/reqs_v1/requirements.yml @@ -0,0 +1,10 @@ +--- +# v1 requirements test file + +# As Jeff never created releases on hit repo, we are unable to download tar.gz +# archives, so we need to use the slower git cloning instead. +# - src: https://github.com/geerlingguy/mysql/archive/refs/tags/4.2.0.tar.gz + +- name: geerlingguy.mysql + src: https://github.com/geerlingguy/ansible-role-mysql + version: 4.2.0 diff --git a/examples/reqs_v2/requirements.yml b/examples/reqs_v2/requirements.yml new file mode 100644 index 0000000..735bf3c --- /dev/null +++ b/examples/reqs_v2/requirements.yml @@ -0,0 +1,8 @@ +--- +roles: + - name: geerlingguy.mysql + src: https://github.com/geerlingguy/ansible-role-mysql + version: 4.2.0 + +collections: + - name: https://galaxy.ansible.com/download/community-molecule-0.1.0.tar.gz diff --git a/examples/roles/ansible-role-foo/tasks/main.yaml b/examples/roles/ansible-role-foo/tasks/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/bobbins/tasks/imported_tasks.yml b/examples/roles/bobbins/tasks/imported_tasks.yml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/bobbins/tasks/main.yml b/examples/roles/bobbins/tasks/main.yml new file mode 100644 index 0000000..992c85c --- /dev/null +++ b/examples/roles/bobbins/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- name: Test tasks + action: git a=b c=d + +- name: Import tasks + ansible.builtin.import_tasks: + file: imported_tasks.yml diff --git a/examples/roles/broken_argument_specs/meta/argument_specs.yml b/examples/roles/broken_argument_specs/meta/argument_specs.yml new file mode 100644 index 0000000..ddc9862 --- /dev/null +++ b/examples/roles/broken_argument_specs/meta/argument_specs.yml @@ -0,0 +1,5 @@ +--- +argument_specs: + main: + foo: bar # <-- invalid based on json schema + options: {} diff --git a/examples/roles/dependency_in_meta/meta/main.yml b/examples/roles/dependency_in_meta/meta/main.yml new file mode 100644 index 0000000..ce20d01 --- /dev/null +++ b/examples/roles/dependency_in_meta/meta/main.yml @@ -0,0 +1,42 @@ +--- +# meta file, determined by ending in meta/main.yml +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#role-dependencies +allow_duplicates: true +dependencies: + # from Bitbucket + - src: git+http://bitbucket.org/willthames/git-ansible-galaxy + version: v1.4 + + # from Bitbucket, alternative syntax and caveats + - src: http://bitbucket.org/willthames/hg-ansible-galaxy + scm: hg + + # from galaxy + - src: yatesr.timezone + + # from GitHub + - src: https://github.com/bennojoy/nginx + + # from GitHub, overriding the name and specifying a specific tag + - src: https://github.com/bennojoy/nginx + version: master + name: nginx_role + + # from GitLab or other git-based scm + - src: git@gitlab.company.com:my-group/my-repo.git + scm: git + version: "0.1" # quoted, so YAML doesn't parse this as a floating-point value + + # from a webserver, where the role is packaged in a tar.gz + - src: https://some.webserver.example.com/files/master.tar.gz + name: http-role + +galaxy_info: + standalone: true + author: foo + description: Testing meta + company: Not applicable + license: MIT + min_ansible_version: "2.5" + platforms: + - name: Fedora diff --git a/examples/roles/foo.yml b/examples/roles/foo.yml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/hello/meta/argument_specs.yml b/examples/roles/hello/meta/argument_specs.yml new file mode 100644 index 0000000..47bde78 --- /dev/null +++ b/examples/roles/hello/meta/argument_specs.yml @@ -0,0 +1,27 @@ +--- +# https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-argument-validation +argument_specs: + main: + short_description: The main entry point for the role. + description: "a longer description" + options: + my_app_int: + type: "int" + required: false + default: 42 + description: "The integer value, defaulting to 42." + no_log: false + + my_app_str: + type: "str" + required: true + description: "The string value" + + alternate: + short_description: The alternate entry point for the my_app role. + options: + my_app_int: + type: "int" + required: false + default: 1024 + description: "The integer value, defaulting to 1024." diff --git a/examples/roles/hello/meta/main.yml b/examples/roles/hello/meta/main.yml new file mode 100644 index 0000000..b15a998 --- /dev/null +++ b/examples/roles/hello/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: bobbins diff --git a/examples/roles/include_in_the_place/tasks/included_file.yml b/examples/roles/include_in_the_place/tasks/included_file.yml new file mode 100644 index 0000000..8dd30a3 --- /dev/null +++ b/examples/roles/include_in_the_place/tasks/included_file.yml @@ -0,0 +1,4 @@ +--- +- name: included_file | Test Fixture + ansible.builtin.debug: + msg: "was found & included" diff --git a/examples/roles/include_in_the_place/tasks/main.yml b/examples/roles/include_in_the_place/tasks/main.yml new file mode 100644 index 0000000..4e0d500 --- /dev/null +++ b/examples/roles/include_in_the_place/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Include a task + ansible.builtin.include_tasks: included_file.yml diff --git a/examples/roles/include_miss/tasks/main.yml b/examples/roles/include_miss/tasks/main.yml new file mode 100644 index 0000000..7df4ff2 --- /dev/null +++ b/examples/roles/include_miss/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Include a missing file + ansible.builtin.include_tasks: tasks/noexist_file.yml diff --git a/examples/roles/include_relative/tasks/included_file.yml b/examples/roles/include_relative/tasks/included_file.yml new file mode 100644 index 0000000..ef81833 --- /dev/null +++ b/examples/roles/include_relative/tasks/included_file.yml @@ -0,0 +1,4 @@ +--- +- name: included_file | Sample debug task + ansible.builtin.debug: + msg: "was found & included" diff --git a/examples/roles/include_relative/tasks/main.yml b/examples/roles/include_relative/tasks/main.yml new file mode 100644 index 0000000..de69255 --- /dev/null +++ b/examples/roles/include_relative/tasks/main.yml @@ -0,0 +1,7 @@ +--- +# ansible allow paths relative to role directory +- name: 1st include + ansible.builtin.include_tasks: tasks/included_file.yml +# relative to the current file, same effect as previous line +- name: 2nd include + ansible.builtin.include_tasks: included_file.yml diff --git a/examples/roles/invalid-name/tasks/main.yaml b/examples/roles/invalid-name/tasks/main.yaml new file mode 100644 index 0000000..228dca3 --- /dev/null +++ b/examples/roles/invalid-name/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- name: Foo + ansible.builtin.debug: + msg: foo diff --git a/examples/roles/invalid_due_syntax/tasks/main.yml b/examples/roles/invalid_due_syntax/tasks/main.yml new file mode 100644 index 0000000..b029f9c --- /dev/null +++ b/examples/roles/invalid_due_syntax/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- name: Fixture for testing syntax-check[specific] on roles diff --git a/examples/roles/invalid_due_to_meta/meta/main.yml b/examples/roles/invalid_due_to_meta/meta/main.yml new file mode 100644 index 0000000..c389d74 --- /dev/null +++ b/examples/roles/invalid_due_to_meta/meta/main.yml @@ -0,0 +1,10 @@ +--- +galaxy_info: + standalone: true + role_name: invalid-due-to-meta # <-- invalid role name + author: foo + description: foo + license: MIT + platforms: + - name: AIX + min_ansible_version: "2.7" diff --git a/examples/roles/invalid_due_to_meta/tasks/main.yaml b/examples/roles/invalid_due_to_meta/tasks/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/invalid_meta_schema/meta/main.yml b/examples/roles/invalid_meta_schema/meta/main.yml new file mode 100644 index 0000000..c8ea8e2 --- /dev/null +++ b/examples/roles/invalid_meta_schema/meta/main.yml @@ -0,0 +1,9 @@ +--- +galaxy_info: + standalone: true + author: foo + description: false # <-- schema fail as string is expected + license: XXX + platforms: + - name: AIX + min_ansible_version: "2.7" diff --git a/examples/roles/invalid_requirements_schema/meta/requirements.yml b/examples/roles/invalid_requirements_schema/meta/requirements.yml new file mode 100644 index 0000000..41a70af --- /dev/null +++ b/examples/roles/invalid_requirements_schema/meta/requirements.yml @@ -0,0 +1,3 @@ +--- +# this should fail validation +foo: bar diff --git a/examples/roles/invalud_meta_schema b/examples/roles/invalud_meta_schema new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/loop_var_prefix/tasks/fail.yml b/examples/roles/loop_var_prefix/tasks/fail.yml new file mode 100644 index 0000000..311cf27 --- /dev/null +++ b/examples/roles/loop_var_prefix/tasks/fail.yml @@ -0,0 +1,38 @@ +--- +# 5 expected loop-var-prefix failures at 3, 9, 19, 26, 33 +- name: fail | That should trigger loop-var-prefix + ansible.builtin.debug: + var: item + loop: + - foo + - bar +- name: fail | That should fail due to wrong prefix + ansible.builtin.debug: + var: zz_item + loop: + - foo + - bar + loop_control: + loop_var: zz_item +- name: fail | Using a block + block: + - name: fail | That should also not pass + ansible.builtin.debug: + var: item + loop: + - apples + - oranges + rescue: + - name: fail | That should also not pass + ansible.builtin.debug: + var: item + loop: + - avocados + - kiwis + always: + - name: fail | That should also not pass + ansible.builtin.debug: + var: item + loop: + - bananas + - muscats diff --git a/examples/roles/loop_var_prefix/tasks/pass.yml b/examples/roles/loop_var_prefix/tasks/pass.yml new file mode 100644 index 0000000..328c0a7 --- /dev/null +++ b/examples/roles/loop_var_prefix/tasks/pass.yml @@ -0,0 +1,30 @@ +--- +# 0 expected loop-var-prefix failures +- name: pass | That should pass + ansible.builtin.debug: + var: loop_var_prefix_item + loop: + - foo + - bar + loop_control: + loop_var: loop_var_prefix_item +- name: pass | Using a block + block: + - name: pass | That should also pass + ansible.builtin.debug: + var: loop_var_prefix_item + loop: + - foo + - bar + loop_control: + loop_var: loop_var_prefix_item +- name: pass | Using alternative double underline prefix + block: + - name: pass | That should also pass + ansible.builtin.debug: + var: __some_item + loop: + - foo + - bar + loop_control: + loop_var: __some_item diff --git a/examples/roles/meta_noqa/meta/main.yml b/examples/roles/meta_noqa/meta/main.yml new file mode 100644 index 0000000..62ccab3 --- /dev/null +++ b/examples/roles/meta_noqa/meta/main.yml @@ -0,0 +1,8 @@ +--- +galaxy_info: # noqa: meta-incorrect + standalone: true + author: your-name # noqa: meta-no-info + description: missing min_ansible_version and platforms. author default not changed + license: MIT + min_ansible_version: "2.10" + platforms: [] diff --git a/examples/roles/more_complex/handlers/main.yml b/examples/roles/more_complex/handlers/main.yml new file mode 100644 index 0000000..1476749 --- /dev/null +++ b/examples/roles/more_complex/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Restart service using command + command: service bar restart diff --git a/examples/roles/more_complex/tasks/main.yml b/examples/roles/more_complex/tasks/main.yml new file mode 100644 index 0000000..62880a6 --- /dev/null +++ b/examples/roles/more_complex/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Test bad command + action: command mkdir blah + +- name: Test bad command v2 + command: mkdir blah + +- name: Test bad local command + local_action: shell touch foo diff --git a/examples/roles/role_for_no_same_owner/tasks/fail.yml b/examples/roles/role_for_no_same_owner/tasks/fail.yml new file mode 100644 index 0000000..b1e01b0 --- /dev/null +++ b/examples/roles/role_for_no_same_owner/tasks/fail.yml @@ -0,0 +1,71 @@ +--- +- name: fail | Block + block: + - name: fail | Synchronize-in-block + ansible.posix.synchronize: + src: dummy + dest: dummy + +- name: fail | Synchronize + ansible.posix.synchronize: + src: dummy + dest: dummy + +- name: fail | Nested-block + block: + - name: fail | Synchronize + block: + - name: fail | Synchronize-in-deep-block + ansible.posix.synchronize: + src: dummy + dest: dummy + rescue: + - name: fail | Synchronize-in-rescue + ansible.posix.synchronize: + src: dummy + dest: dummy + always: + - name: fail | Synchronize-in-always + ansible.posix.synchronize: + src: dummy + dest: dummy + +- name: fail | Unarchive-bz2 + ansible.builtin.unarchive: + src: "{{ file }}.tar.bz2" + dest: dummy + +- name: fail | Unarchive delegated + ansible.builtin.unarchive: + src: "{{ file }}.tar.bz2" + dest: dummy + delegate_to: localhost + +- name: fail | Unarchive-gz + ansible.builtin.unarchive: + src: "{{ file }}.tar.gz" + dest: dummy + +- name: fail | Unarchive-tar + ansible.builtin.unarchive: + src: "{{ file }}.tar" + dest: dummy + +- name: fail | Unarchive-xz + ansible.builtin.unarchive: + src: "{{ file }}.tar.xz" + dest: dummy + +- name: fail | Unarchive-zip + ansible.builtin.unarchive: + src: "{{ file }}.zip" + dest: dummy + extra_opts: + - -X + +- name: fail | Unarchive-zip-same-owner + ansible.builtin.unarchive: + src: "{{ file }}.zip" + dest: dummy + extra_opts: + - -X diff --git a/examples/roles/role_for_no_same_owner/tasks/pass.yml b/examples/roles/role_for_no_same_owner/tasks/pass.yml new file mode 100644 index 0000000..3af914b --- /dev/null +++ b/examples/roles/role_for_no_same_owner/tasks/pass.yml @@ -0,0 +1,32 @@ +--- +- name: pass | Synchronize-delegate + ansible.posix.synchronize: + src: dummy + dest: dummy + delegate_to: localhost + +- name: pass | Synchronize-no-same-owner + ansible.posix.synchronize: + src: dummy + dest: dummy + owner: false + group: false + +- name: pass | Unarchive-no-same-owner + ansible.builtin.unarchive: + src: "{{ file }}.tar.gz" + dest: dummy + extra_opts: + - --no-same-owner + +- name: pass | Unarchive-remote-src + ansible.builtin.unarchive: + src: "{{ file }}.tar.gz" + dest: dummy + extra_opts: + - --no-same-owner + +- name: pass | Unarchive-unknown-file-ending + ansible.builtin.unarchive: + src: "{{ file }}" + dest: dummy diff --git a/examples/roles/role_with_task_inclusions/tasks/imported_tasks.yml b/examples/roles/role_with_task_inclusions/tasks/imported_tasks.yml new file mode 100644 index 0000000..601b164 --- /dev/null +++ b/examples/roles/role_with_task_inclusions/tasks/imported_tasks.yml @@ -0,0 +1,3 @@ +--- +# this task is missing a name (unnamed-task) +- ansible.builtin.ping: diff --git a/examples/roles/role_with_task_inclusions/tasks/included_tasks.yml b/examples/roles/role_with_task_inclusions/tasks/included_tasks.yml new file mode 100644 index 0000000..601b164 --- /dev/null +++ b/examples/roles/role_with_task_inclusions/tasks/included_tasks.yml @@ -0,0 +1,3 @@ +--- +# this task is missing a name (unnamed-task) +- ansible.builtin.ping: diff --git a/examples/roles/role_with_task_inclusions/tasks/main.yml b/examples/roles/role_with_task_inclusions/tasks/main.yml new file mode 100644 index 0000000..46bc212 --- /dev/null +++ b/examples/roles/role_with_task_inclusions/tasks/main.yml @@ -0,0 +1,10 @@ +--- +- name: Include 1 + ansible.builtin.include_tasks: included_tasks.yml +- name: Include 2 + ansible.builtin.import_tasks: imported_tasks.yml +- name: Include 3 + ansible.builtin.include_tasks: + file: included_tasks.yml + apply: + tags: some_tag diff --git a/examples/roles/subfolder/1st_role/tasks/main.yml b/examples/roles/subfolder/1st_role/tasks/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/subfolder/2nd_role/tasks/main.yml b/examples/roles/subfolder/2nd_role/tasks/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/subfolder/3rd_role/tasks/main.yml b/examples/roles/subfolder/3rd_role/tasks/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/subfolder/other_role/tasks/main.yml b/examples/roles/subfolder/other_role/tasks/main.yml new file mode 100644 index 0000000..b4d7f48 --- /dev/null +++ b/examples/roles/subfolder/other_role/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: Foo + debug: + msg: "Hello!" diff --git a/examples/roles/template_lookup/files/a_file b/examples/roles/template_lookup/files/a_file new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/template_lookup/tasks/main.yml b/examples/roles/template_lookup/tasks/main.yml new file mode 100644 index 0000000..db2e490 --- /dev/null +++ b/examples/roles/template_lookup/tasks/main.yml @@ -0,0 +1,10 @@ +--- +# Place tasks in a block as templates are not rendered for top-level tasks +# in roles. Specifically, in `play_children()` of src/ansiblelint/utils.py, +# tasks in blocks go through `delegate_map['block']`, while top-level tasks +# in a role is not handled by `delegate_map`. +# Ref: https://github.com/ansible/ansible-lint/blob/v5.0.12/src/ansiblelint/utils.py#L305 +- block: + - name: Bug demo + ansible.builtin.debug: + msg: '{{ lookup("file", "a_file") }}' diff --git a/examples/roles/template_lookup_missing/tasks/main.yml b/examples/roles/template_lookup_missing/tasks/main.yml new file mode 100644 index 0000000..fc0542c --- /dev/null +++ b/examples/roles/template_lookup_missing/tasks/main.yml @@ -0,0 +1,7 @@ +--- +# See comments in `examples/roles/template_lookup/tasks/main.yml` +# for why the task is in a block. +- block: + - name: Bug demo + ansible.builtin.debug: + msg: '{{ lookup("file", "a_file") }}' diff --git a/examples/roles/test-role/meta/requirements.yml b/examples/roles/test-role/meta/requirements.yml new file mode 100644 index 0000000..8e7fccc --- /dev/null +++ b/examples/roles/test-role/meta/requirements.yml @@ -0,0 +1,3 @@ +--- +roles: [] +collections: [] diff --git a/examples/roles/test-role/molecule/default/include-import-role.yml b/examples/roles/test-role/molecule/default/include-import-role.yml new file mode 100644 index 0000000..6d56c42 --- /dev/null +++ b/examples/roles/test-role/molecule/default/include-import-role.yml @@ -0,0 +1,6 @@ +--- +- name: test + gather_facts: false + hosts: all + roles: + - role: test-role diff --git a/examples/roles/test-role/tasks/main.yml b/examples/roles/test-role/tasks/main.yml new file mode 100644 index 0000000..8e5402f --- /dev/null +++ b/examples/roles/test-role/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: Shell instead of command + ansible.builtin.shell: + cmd: echo hello world diff --git a/examples/roles/test-role/tasks/world.yml b/examples/roles/test-role/tasks/world.yml new file mode 100644 index 0000000..3f3fd3e --- /dev/null +++ b/examples/roles/test-role/tasks/world.yml @@ -0,0 +1,3 @@ +--- +- command: # noqa: fqcn + cmd: echo this is a task without a name # noqa: no-free-form diff --git a/examples/roles/valid-due-to-meta/meta/main.yml b/examples/roles/valid-due-to-meta/meta/main.yml new file mode 100644 index 0000000..32fc400 --- /dev/null +++ b/examples/roles/valid-due-to-meta/meta/main.yml @@ -0,0 +1,10 @@ +--- +galaxy_info: + standalone: true + role_name: valid_due_to_meta + author: foo + description: foo + license: MIT + platforms: + - name: Fedora + min_ansible_version: "2.7" diff --git a/examples/roles/valid-due-to-meta/tasks/debian/main.yml b/examples/roles/valid-due-to-meta/tasks/debian/main.yml new file mode 100644 index 0000000..6fa48c2 --- /dev/null +++ b/examples/roles/valid-due-to-meta/tasks/debian/main.yml @@ -0,0 +1,2 @@ +# This empty task file is here to test that roles with tasks organized in subdirectories +# are handled correctly by ansible-lint. diff --git a/examples/roles/valid-due-to-meta/tasks/main.yaml b/examples/roles/valid-due-to-meta/tasks/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/examples/roles/var_naming_pattern/.ansible-lint b/examples/roles/var_naming_pattern/.ansible-lint new file mode 100644 index 0000000..d6dc161 --- /dev/null +++ b/examples/roles/var_naming_pattern/.ansible-lint @@ -0,0 +1,2 @@ +--- +var_naming_pattern: "^[a-z][a-z0-9_]*[a-z0-9]__[a-z][a-z0-9_]*[a-z0-9]$" diff --git a/examples/roles/var_naming_pattern/tasks/main.yml b/examples/roles/var_naming_pattern/tasks/main.yml new file mode 100644 index 0000000..4964f17 --- /dev/null +++ b/examples/roles/var_naming_pattern/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: Foobar + ansible.builtin.set_fact: + k8s_grafana_users__namespace: "foo" diff --git a/examples/rulebooks/rulebook.yml b/examples/rulebooks/rulebook.yml new file mode 100644 index 0000000..1f5d444 --- /dev/null +++ b/examples/rulebooks/rulebook.yml @@ -0,0 +1,19 @@ +--- +- 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/rules/task_has_tag.py b/examples/rules/task_has_tag.py new file mode 100644 index 0000000..e9c6a3e --- /dev/null +++ b/examples/rules/task_has_tag.py @@ -0,0 +1,41 @@ +"""Example implementation of a rule requiring tasks to have tags set.""" +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from ansiblelint.rules import AnsibleLintRule + +if TYPE_CHECKING: + from ansiblelint.file_utils import Lintable + + +class TaskHasTag(AnsibleLintRule): + """Tasks must have tag.""" + + id = "EXAMPLE001" + description = "Tasks must have tag" + tags = ["productivity", "tags"] + + def matchtask( + self, task: dict[str, Any], file: Lintable | None = None + ) -> bool | str: + """Task matching method.""" + if isinstance(task, str): + return False + + # If the task include another task or make the playbook fail + # Don't force to have a tag + if not set(task.keys()).isdisjoint(["include", "fail"]): + return False + + if not set(task.keys()).isdisjoint(["include_tasks", "fail"]): + return False + + if not set(task.keys()).isdisjoint(["import_tasks", "fail"]): + return False + + # Task should have tags + if "tags" not in task: + return True + + return False diff --git a/examples/templates/playbooks/playbook.yml b/examples/templates/playbooks/playbook.yml new file mode 100644 index 0000000..bf85245 --- /dev/null +++ b/examples/templates/playbooks/playbook.yml @@ -0,0 +1,6 @@ +--- +# even if is hosted under playbooks and is named playbook.yml, this file +# is not a real playbook because it is hosted in a "templates" directory +# and that means we will avoid processing it as a playbook. Templates use +# either jinja2 or another templating engine, so we cannot load them. +foo: bar diff --git a/examples/testproject/roles/test-role/tasks/main.yml b/examples/testproject/roles/test-role/tasks/main.yml new file mode 100644 index 0000000..fda441f --- /dev/null +++ b/examples/testproject/roles/test-role/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Shell instead of command + shell: echo hello world diff --git a/examples/yamllint/invalid.yml b/examples/yamllint/invalid.yml new file mode 100644 index 0000000..44e4072 --- /dev/null +++ b/examples/yamllint/invalid.yml @@ -0,0 +1,9 @@ +# missing document-start +foo: ... +foo: ... # <-- key-duplicates +bar: ... # <-- wrong comment indentation + +# next line has trailing-spaces: +other: aaa + +# ^ empty-lines diff --git a/examples/yamllint/multi-document.yaml b/examples/yamllint/multi-document.yaml new file mode 100644 index 0000000..e3d8805 --- /dev/null +++ b/examples/yamllint/multi-document.yaml @@ -0,0 +1,4 @@ +--- +foo: ... +--- +bar: ... diff --git a/examples/yamllint/valid.yml b/examples/yamllint/valid.yml new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3