summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/tasks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:56 +0000
commitd964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2 (patch)
tree794bc3738a00b5e599f06d1f2f6d79048d87ff8e /examples/playbooks/tasks
parentInitial commit. (diff)
downloadansible-lint-d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2.tar.xz
ansible-lint-d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2.zip
Adding upstream version 6.13.1.upstream/6.13.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/playbooks/tasks')
-rw-r--r--examples/playbooks/tasks/bug-2875.yml9
-rw-r--r--examples/playbooks/tasks/conflicting-action-statements.yml3
-rw-r--r--examples/playbooks/tasks/directory with spaces/main.yml4
-rw-r--r--examples/playbooks/tasks/empty_blocks.yml17
-rw-r--r--examples/playbooks/tasks/include-in-block-inner.yml5
-rw-r--r--examples/playbooks/tasks/included-with-lint.yml4
-rw-r--r--examples/playbooks/tasks/malformed.yml3
-rw-r--r--examples/playbooks/tasks/nestedincludes.yml3
-rw-r--r--examples/playbooks/tasks/passing_task.yml4
-rw-r--r--examples/playbooks/tasks/rule-name-prefix-fail.yml13
-rw-r--r--examples/playbooks/tasks/simple_task.yml4
-rw-r--r--examples/playbooks/tasks/varset.yml4
-rw-r--r--examples/playbooks/tasks/varunset.yml2
-rw-r--r--examples/playbooks/tasks/x.yml7
14 files changed, 82 insertions, 0 deletions
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