Skip to content

Instantly share code, notes, and snippets.

@RickyCook
Created October 27, 2014 05:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickyCook/42c55959298f41faba07 to your computer and use it in GitHub Desktop.
Save RickyCook/42c55959298f41faba07 to your computer and use it in GitHub Desktop.
Ansible rsync changed status
# Uses the rsync change summary to figure out how many things changed, and uses that
# to tell Ansible if something changed or not
- name: sync hieradata
shell: rsync --delete -ri "/tmp/repo/hieradata" "/etc/puppet/hieradata" | awk '{print $1}' | grep -vE '..\.\..\.\.\.\.' | wc -l
register: hieradata_changes
changed_when: "hieradata_changes.stdout|int != 0"
@pfaffman
Copy link

Awesome! This was a huge help. I'd not have bothered to figure it out, but it makes me happy.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment