diff options
author | Tim Gerla <tim@gerla.net> | 2013-03-26 21:34:16 +0100 |
---|---|---|
committer | Tim Gerla <tim@gerla.net> | 2013-03-26 21:34:16 +0100 |
commit | 0e01085ab6563507556caec9caa781671a29b14f (patch) | |
tree | 2c8232380842dc22984372a118ffe4d3c1602eee | |
parent | Merge pull request #2501 from sergevanginderachter/devel (diff) | |
download | ansible-0e01085ab6563507556caec9caa781671a29b14f.tar.xz ansible-0e01085ab6563507556caec9caa781671a29b14f.zip |
Add some examples for local_action and rsync
-rw-r--r-- | docsite/rst/playbooks2.rst | 14 | ||||
-rw-r--r-- | library/copy | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/docsite/rst/playbooks2.rst b/docsite/rst/playbooks2.rst index ab2d1a015c..294c8a2bc5 100644 --- a/docsite/rst/playbooks2.rst +++ b/docsite/rst/playbooks2.rst @@ -888,8 +888,9 @@ a good idea:: delegate_to: 127.0.0.1 -Here is the same playbook as above, but using the shorthand syntax, -'local_action', for delegating to 127.0.0.1:: +These commands will run on 127.0.0.1, which is the machine running Ansible. There is also a shorthand syntax that +you can use on a per-task basis: 'local_action'. Here is the same playbook as above, but using the shorthand +syntax for delegating to 127.0.0.1:: --- # ... @@ -902,6 +903,15 @@ Here is the same playbook as above, but using the shorthand syntax, - name: add back to load balancer pool local_action: command /usr/bin/add_back_to_pool $inventory_hostname +A common pattern is to use a local action to call 'rsync' to recursively copy files to the managed servers. +Here is an example:: + + --- + # ... + tasks: + - name: recursively copy files from management server to target + local_action: command rsync -a /path/to/files $inventory_hostname:/path/to/target/ + Fireball Mode ````````````` diff --git a/library/copy b/library/copy index b1b95bf2df..cc5fb73241 100644 --- a/library/copy +++ b/library/copy @@ -75,6 +75,9 @@ examples: - code: "copy: src=/mine/ntp.conf dest=/etc/ntp.conf owner=root group=root mode=644 backup=yes" description: "Copy a new C(ntp.conf) file into place, backing up the original if it differs from the copied version" author: Michael DeHaan +notes: + - The "copy" module can't be used to recursively copy directory structures to the target machine. Please see the + "Delegation" section of the Advanced Playbooks documentation for a better approach to recursive copies. ''' def main(): |