summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/transform-partial-become.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:57 +0000
commit1faea9a6c75f33109e8f66b57b432fdad57b3f46 (patch)
tree4184ce38ac0cf9d5a46bbbae03c87be82927f12b /examples/playbooks/transform-partial-become.yml
parentAdding upstream version 6.17.2. (diff)
downloadansible-lint-upstream.tar.xz
ansible-lint-upstream.zip
Adding upstream version 24.6.1.upstream/24.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/playbooks/transform-partial-become.yml')
-rw-r--r--examples/playbooks/transform-partial-become.yml56
1 files changed, 56 insertions, 0 deletions
diff --git a/examples/playbooks/transform-partial-become.yml b/examples/playbooks/transform-partial-become.yml
new file mode 100644
index 0000000..079d1a0
--- /dev/null
+++ b/examples/playbooks/transform-partial-become.yml
@@ -0,0 +1,56 @@
+---
+# The play has become_user and the task has become
+# this is fixable, copy the become_user to the task
+# and remove from the play
+- name: Play 1
+ hosts: localhost
+ become_user: root
+ tasks:
+ - name: A block
+ block:
+ - name: Debug
+ ansible.builtin.debug:
+ msg: hello
+ become: true
+
+# The task has become_user but the play does not
+# this is fixable, remove the become_user from the task
+- name: Play 2
+ hosts: localhost
+ tasks:
+ - name: A block
+ block:
+ - name: Debug
+ ansible.builtin.debug:
+ msg: hello
+ become_user: root
+
+# The task has become_user and the play has become
+# this is fixable, add become to the task
+- name: Play 3
+ hosts: localhost
+ become: true
+ tasks:
+ - name: A block
+ block:
+ - name: Debug
+ ansible.builtin.debug:
+ msg: hello
+ become_user: root
+
+# The play has become_user but has an include
+# this is not fixable, the include could be called from multiple playbooks
+- name: Play 4
+ hosts: localhost
+ become_user: root
+ tasks:
+ - name: A block
+ block:
+ - name: Debug
+ ansible.builtin.debug:
+ msg: hello
+ become: true
+
+ - name: Include
+ ansible.builtin.include_tasks:
+ file: ../tasks/partial_become/main.yml