summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/rule-command-instead-of-shell-pass.yml
blob: 8bbaef30701d794c029f2c7a52d8de855a3cb9c3 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
- name: Fixture
  hosts: localhost
  tasks:
    - name: Shell with pipe
      ansible.builtin.shell:
        cmd: echo hello | true # noqa: risky-shell-pipe
      changed_when: false

    - name: Shell with redirect
      ansible.builtin.shell:
        cmd: echo hello >  /tmp/hello
      changed_when: false

    - name: Chain two shell commands
      ansible.builtin.shell:
        cmd: echo hello && echo goodbye
      changed_when: false

    - name: Run commands in succession
      ansible.builtin.shell:
        cmd: echo hello ; echo goodbye
      changed_when: false

    - name: Use variables
      ansible.builtin.shell:
        cmd: echo $HOME $USER
      changed_when: false

    - name: Use * for globbing
      ansible.builtin.shell:
        cmd: ls foo*
      changed_when: false

    - name: Use ? for globbing
      ansible.builtin.shell:
        cmd: ls foo?
      changed_when: false

    - name: Use [] for globbing
      ansible.builtin.shell:
        cmd: ls foo[1,2,3]
      changed_when: false

    - name: Use shell generator
      ansible.builtin.shell:
        cmd: ls foo{.txt,.xml}
      changed_when: false

    - name: Use backticks
      ansible.builtin.shell:
        cmd: ls `ls foo*`
      changed_when: false

    - name: Use shell with cmd
      ansible.builtin.shell:
        cmd: |
          set -x
          ls foo?
      changed_when: false