summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/rule-partial-become-without-become-fail.yml
blob: 80b633d90875d95c4df73f298cc41fa8fcf11e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Use of become_user without become at play level
  hosts: localhost
  become_user: root

  tasks:
    - name: A task without issues
      ansible.builtin.debug:
        msg: hello

- name: Use of become_user without become at task level
  hosts: localhost
  tasks:
    - name: Use of become_user without become task
      ansible.builtin.command: whoami
      become_user: postgres
      changed_when: false

- name: Use of become_user without become at task level
  hosts: localhost
  tasks:
    - name: A block with become and become_user on different tasks
      block:
        - name: Sample become
          ansible.builtin.command: whoami
          become_user: true
          changed_when: false