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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to