All I wanted to do was to fetch files for OTAP purposes. Well ....
I tried fetch, combining it with copying files to a backup folder and using
fdupes (not installed by default). But i needed the backup files to include
a timestamp. Well you can imagine my playbook grew and grew with set_facts
and what not (i did not give up without a fight). The playbook filled my
screen with useless information and on top of it all, it did not work like
i wanted it to.
So i resorted to back to old trusty rsync and now have a nice simple single
task in my playbook
- How are others implementing this?
- Anything missing by any change?
vars:
files_to_sync:
- file1
- file2
fetchfiles: /root/ansible/fetchfiles
tasks:
- name: sync file to master
local_action: shell rsync -abci --backup-dir=backup --suffix=_`date
'+%Y%m%d.%H%M%S'` {{ ansible_user_id }}@{{ ansible_fqdn }}:'{{
files_to_sync | join(' ') }}' {{ fetchfiles }}/{{ inventory_hostname }}
register: mastersync
changed_when: mastersync.stdout
i use the -c option of rsync, because i dump sql tables to temporary files,
so the timestamp does get changed
the -i option to itemize changes to report actual changes
--
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/707308e9-18aa-4648-ad9b-52ac4b299e08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.