diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 06:24:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 06:24:58 +0000 |
commit | ba233a0cbad76b4783a03893e7bf4716fbc0f0ec (patch) | |
tree | ad369728c1edbe3631c8150585659078ae5d7d0b /examples/roles | |
parent | Releasing progress-linux version 6.17.2-3~progress7.99u1. (diff) | |
download | ansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.tar.xz ansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.zip |
Merging upstream version 24.6.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/roles')
14 files changed, 158 insertions, 3 deletions
diff --git a/examples/roles/include_wrong_syntax/tasks/main.yml b/examples/roles/include_wrong_syntax/tasks/main.yml new file mode 100644 index 0000000..be269e5 --- /dev/null +++ b/examples/roles/include_wrong_syntax/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Invalid syntax for import (coverage) + ansible.builtin.import_tasks: wrong=imported_tasks.yml diff --git a/examples/roles/name_casing/tasks/main.transformed.yml b/examples/roles/name_casing/tasks/main.transformed.yml new file mode 100644 index 0000000..74c18ae --- /dev/null +++ b/examples/roles/name_casing/tasks/main.transformed.yml @@ -0,0 +1,15 @@ +--- +- name: Test nested tasks within block and always + block: + - name: Test1 + ansible.builtin.debug: + msg: Foo + + - name: Test2 + ansible.builtin.debug: + msg: Bar + + always: + - name: From always block to be auto fixed as name[casing] scenario + ansible.builtin.debug: + msg: Baz diff --git a/examples/roles/name_casing/tasks/main.yml b/examples/roles/name_casing/tasks/main.yml new file mode 100644 index 0000000..7bf73ff --- /dev/null +++ b/examples/roles/name_casing/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Test nested tasks within block and always + block: + - name: test1 + ansible.builtin.debug: + msg: Foo + + - name: Test2 + ansible.builtin.debug: + msg: Bar + + always: + - name: from always block to be auto fixed as name[casing] scenario + ansible.builtin.debug: + msg: Baz diff --git a/examples/roles/name_prefix/tasks/test.transformed.yml b/examples/roles/name_prefix/tasks/test.transformed.yml new file mode 100644 index 0000000..eb6e116 --- /dev/null +++ b/examples/roles/name_prefix/tasks/test.transformed.yml @@ -0,0 +1,8 @@ +--- +- name: test | Not cap + ansible.builtin.debug: + msg: not cap + +- name: test | Cap + ansible.builtin.debug: + msg: Cap diff --git a/examples/roles/name_prefix/tasks/test.yml b/examples/roles/name_prefix/tasks/test.yml new file mode 100644 index 0000000..679332a --- /dev/null +++ b/examples/roles/name_prefix/tasks/test.yml @@ -0,0 +1,8 @@ +--- +- name: test | not cap + ansible.builtin.debug: + msg: not cap + +- name: test | Cap + ansible.builtin.debug: + msg: Cap diff --git a/examples/roles/role_detection/base/bar/defaults/main.yml b/examples/roles/role_detection/base/bar/defaults/main.yml new file mode 100644 index 0000000..faa4ea1 --- /dev/null +++ b/examples/roles/role_detection/base/bar/defaults/main.yml @@ -0,0 +1,3 @@ +--- +base_var_1: foo +base_var_2: foo diff --git a/examples/roles/role_detection/foo/defaults/main.yml b/examples/roles/role_detection/foo/defaults/main.yml new file mode 100644 index 0000000..1a5b54b --- /dev/null +++ b/examples/roles/role_detection/foo/defaults/main.yml @@ -0,0 +1,3 @@ +--- +foo_var_1: bar +foo_var_2: bar diff --git a/examples/roles/role_vars_prefix_detection/defaults/main.yml b/examples/roles/role_vars_prefix_detection/defaults/main.yml new file mode 100644 index 0000000..23809fe --- /dev/null +++ b/examples/roles/role_vars_prefix_detection/defaults/main.yml @@ -0,0 +1,2 @@ +--- +foo: bar diff --git a/examples/roles/role_vars_prefix_detection/vars/main.yml b/examples/roles/role_vars_prefix_detection/vars/main.yml new file mode 100644 index 0000000..143ee72 --- /dev/null +++ b/examples/roles/role_vars_prefix_detection/vars/main.yml @@ -0,0 +1,3 @@ +--- +role_vars_prefix_detection_bar: baz +bar: baz diff --git a/examples/roles/role_with_deps_paths/meta/main.yml b/examples/roles/role_with_deps_paths/meta/main.yml new file mode 100644 index 0000000..51efd72 --- /dev/null +++ b/examples/roles/role_with_deps_paths/meta/main.yml @@ -0,0 +1,10 @@ +--- +dependencies: + - role: subfolder/1st_role + vars: + param: baz + - role: subfolder + vars: + param: baz + - role: subfolder/2nd_role + - subfolder/3rd_role diff --git a/examples/roles/role_with_handler/handlers/main.yml b/examples/roles/role_with_handler/handlers/main.yml new file mode 100644 index 0000000..9ca1ab1 --- /dev/null +++ b/examples/roles/role_with_handler/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: Debug + loop: "{{ _something_done.results }}" + loop_control: + label: "{{ item.item.name }}" + when: item.changed + ansible.builtin.debug: + msg: "{{ item.item.name }} changed" diff --git a/examples/roles/role_with_handler/tasks/main.yml b/examples/roles/role_with_handler/tasks/main.yml new file mode 100644 index 0000000..362dc78 --- /dev/null +++ b/examples/roles/role_with_handler/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Get info + delegate_to: localhost + register: collected_info + ansible.builtin.debug: + msg: test + +- name: Do something + delegate_to: localhost + loop: "{{ collected_info['some_list'] }}" + loop_control: + label: "{{ item.name }}" + notify: + - Debug + register: _something_done + ansible.builtin.debug: + msg: test2 diff --git a/examples/roles/test-no-deps-role/meta/main.yml b/examples/roles/test-no-deps-role/meta/main.yml new file mode 100644 index 0000000..1d80cc3 --- /dev/null +++ b/examples/roles/test-no-deps-role/meta/main.yml @@ -0,0 +1,55 @@ +--- +galaxy_info: + author: audgirka + description: your role description + company: Red Hat + role_name: test_no_deps_role # if absent directory name hosting role is used instead + namespace: foo # if absent, author is used instead + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: GPL-2.0-or-later + + min_ansible_version: "2.1" + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. +# Skipping deps for testing scenario when no role deps are present +# dependencies: [] +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. diff --git a/examples/roles/var_naming_pattern/tasks/include_task_with_vars.yml b/examples/roles/var_naming_pattern/tasks/include_task_with_vars.yml index 5151cd3..40b6729 100644 --- a/examples/roles/var_naming_pattern/tasks/include_task_with_vars.yml +++ b/examples/roles/var_naming_pattern/tasks/include_task_with_vars.yml @@ -1,10 +1,15 @@ --- -- name: include_task_with_vars | Foo +- name: include_task_with_vars | Var1 + ansible.builtin.include_tasks: file=../tasks/included-task-with-vars.yml + +- name: include_task_with_vars | Var2 ansible.builtin.include_tasks: ../tasks/included-task-with-vars.yml vars: - var_naming_pattern_foo: bar + var_naming_pattern_1: bar + _var_naming_pattern_2: ... # we allow _ before the prefix + __var_naming_pattern_3: ... # we allow __ before the prefix -- name: include_task_with_vars | Foo +- name: include_task_with_vars | Var3 ansible.builtin.include_role: name: bobbins vars: |