mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Merge pull request #2508 from tgerla/devel
Add some examples for local_action and rsync
This commit is contained in:
@@ -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,18 @@ 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/
|
||||
|
||||
Note that you must have passphrase-less SSH keys or an ssh-agent configured for this to work, otherwise rsync
|
||||
will need to ask for a passphrase.
|
||||
|
||||
Fireball Mode
|
||||
`````````````
|
||||
|
||||
|
||||
Reference in New Issue
Block a user