Add example of using non-posix shellisms to raw and shell

Fixes #14262
This commit is contained in:
Toshio Kuratomi 2016-02-03 13:07:30 -08:00
parent 50bfacb0da
commit 6ff4c4cb71
2 changed files with 19 additions and 1 deletions

View file

@ -44,7 +44,10 @@ description:
- This module does not require python on the remote system, much like - This module does not require python on the remote system, much like
the M(script) module. the M(script) module.
notes: notes:
- If you want to execute a command securely and predictably, it may be - "If using raw from a playbook, you may need to disable fact gathering
using C(gather_facts: no) if you're using C(raw) to bootstrap python
onto the machine."
- If you want to execute a command securely and predictably, it may be
better to use the M(command) module instead. Best practices when writing better to use the M(command) module instead. Best practices when writing
playbooks will follow the trend of using M(command) unless M(shell) is playbooks will follow the trend of using M(command) unless M(shell) is
explicitly required. When running ad-hoc commands, use your best explicitly required. When running ad-hoc commands, use your best
@ -57,4 +60,13 @@ author:
EXAMPLES = ''' EXAMPLES = '''
# Bootstrap a legacy python 2.4 host # Bootstrap a legacy python 2.4 host
- raw: yum -y install python-simplejson - raw: yum -y install python-simplejson
# Bootstrap a host without python2 installed
- raw: dnf install -y python2 python2-dnf libselinux-python
# Run a command that uses non-posix shell-isms (in this example /bin/sh
# doesn't handle redirection and wildcards together but bash does)
- raw: cat < /tmp/*txt
args:
executable: /bin/bash
''' '''

View file

@ -92,4 +92,10 @@ EXAMPLES = '''
args: args:
chdir: somedir/ chdir: somedir/
creates: somelog.txt creates: somelog.txt
# Run a command that uses non-posix shell-isms (in this example /bin/sh
# doesn't handle redirection and wildcards together but bash does)
- shell: cat < /tmp/*txt
args:
executable: /bin/bash
''' '''