From 1146c09f9d1475c4c5d9c6d9a51bf324329f3254 Mon Sep 17 00:00:00 2001 From: Rik Date: Tue, 24 Jun 2014 13:40:19 +0200 Subject: [PATCH 1/2] Added examples to the shell module --- library/commands/shell | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/library/commands/shell b/library/commands/shell index 639d4a14b09..130abc6718f 100644 --- a/library/commands/shell +++ b/library/commands/shell @@ -53,6 +53,17 @@ author: Michael DeHaan EXAMPLES = ''' # Execute the command in remote shell; stdout goes to the specified -# file on the remote +# file on the remote. - 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 ''' From 59d98993ebd01bf68462988c74061f69721a4055 Mon Sep 17 00:00:00 2001 From: Rik Date: Tue, 24 Jun 2014 13:45:49 +0200 Subject: [PATCH 2/2] Added examples to the command module --- library/commands/command | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/library/commands/command b/library/commands/command index f1a48922122..342e3db4938 100644 --- a/library/commands/command +++ b/library/commands/command @@ -77,11 +77,19 @@ author: Michael DeHaan ''' EXAMPLES = ''' -# Example from Ansible Playbooks +# Example from Ansible Playbooks. - 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 + +# 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():