summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/rule-partial-become-without-become-fail.yml
blob: da48b2f9677741949e8de31695f3dd5695204b24 (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
28
---
- hosts: localhost
  name: Use of become_user without become play
  become_user: root

  tasks:
    - ansible.builtin.debug:
        msg: hello

- hosts: localhost

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

- hosts: localhost

  tasks:
    - name: A block with become and become_user on different tasks
      block:
        - name: Sample become
          become: true
          ansible.builtin.command: whoami
        - name: Sample become_user
          become_user: postgres
          ansible.builtin.command: whoami