I'm not entirely following this, but have you read the docs for the
synchronize module yet?  This wraps rsync and makes it easier than
composing the rsync CLI command.




On Wed, Aug 6, 2014 at 1:27 PM, Quentin Stafford-Fraser <[email protected]
> wrote:

> Hi there -
>
> A common deployment model I'm using is to checkout a git repo on the
> target machine and then copy the subdirectory(s) I actually want into
> position (e.g. under /var/www somewhere) using a remote rsync command.
>
> There may be a better way to do this, but here's how I run rsync so that
> it shows up correctly in the 'changed' statistics, just in case it's useful
> for others.
>
> - name: copy repo to live directory
>   command: rsync -rlpEtv -i --delete
>     --out-format='[changed] %f'
>     {{repo_root}}/my_key_subdirectory/
>     {{app_root_dir}}/
>   register: rsync_result
>   changed_when: "'[changed] ' in rsync_result.stdout"
>
> rsync tends to output various statistics even if nothing needs to be
> copied, so I tell it to use an easily-recognisable output format, where it
> will print:
>
>    [changed] filename1
>
> etc in the output for any files affected. Then I just look for instances
> of '[changed]' in stdout.
>
> Suggestions for more elegant ways to get a subset of a git archive
> efficiently are most welcome!
>
> Quentin
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7cab1c94-55e4-4522-866e-546934beede7%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7cab1c94-55e4-4522-866e-546934beede7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgy5JdanZERQgjXk6QejXn41Hy49e9B7U99m0qiobPm5uA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to