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/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 ++ 46 files changed, 395 insertions(+) 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 (limited to 'examples/roles') 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" -- cgit v1.2.3