Merge pull request #7915 from gitaarik/devel

Add examples for `shell` and `command` modules.
reviewable/pr18780/r1
James Cammarata 10 years ago
commit aa028f3fb3

@ -77,11 +77,19 @@ author: Michael DeHaan
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Example from Ansible Playbooks # Example from Ansible Playbooks.
- command: /sbin/shutdown -t now - command: /sbin/shutdown -t now
# Run the command if the specified file does not exist # Run the command if the specified file does not exist.
- command: /usr/bin/make_database.sh arg1 arg2 creates=/path/to/database - command: /usr/bin/make_database.sh arg1 arg2 creates=/path/to/database
# You can also use the 'args' form to provide the options. This command
# will change the working directory to somedir/ and will only run when
# /path/to/database doesn't exist.
- command: /usr/bin/make_database.sh arg1 arg2
args:
chdir: somedir/
creates: /path/to/database
''' '''
def main(): def main():

@ -53,6 +53,17 @@ author: Michael DeHaan
EXAMPLES = ''' EXAMPLES = '''
# Execute the command in remote shell; stdout goes to the specified # Execute the command in remote shell; stdout goes to the specified
# file on the remote # file on the remote.
- shell: somescript.sh >> somelog.txt - shell: somescript.sh >> somelog.txt
# Change the working directory to somedir/ before executing the command.
- shell: somescript.sh >> somelog.txt chdir=somedir/
# You can also use the 'args' form to provide the options. This command
# will change the working directory to somedir/ and will only run when
# somedir/somelog.txt doesn't exist.
- shell: somescript.sh >> somelog.txt
args:
chdir: somedir/
creates: somelog.txt
''' '''

Loading…
Cancel
Save