Hi,
I think your approach has been overthought, a very common issue everyone
runs into when designing a backup solution. I also think you should use an
existing backup solution, such as http://www.rsnapshot.org. Ideally you
want a solution that can be configured from a central point and left to do
its job.
One thing to remember, also, is that Ansible is a Configuration Management
suite. It's not designed to replace a scripting or programming language -
it simply can't do the same things. Instead, use Ansible to configure a
piece of software, like rsnapshot, and then maintain this state to fit your
needs.
I believe you need to simplify the data structures in your example cases.
Also, instead of having a list of users to backup along with their
individual backup targets, use rsync's '--exclude-from' and
'--include-from' to build a list of regular expressions or globs for
matching what you do and do not want to backup, like:
+/home/alice/*
+/home/bob/my_files/*.txt
-/root/*
If you do this, you just need a set of templates for populating the exclude
and include files, which you can then feed to rsync, alone with the remote
system's (IP) address. Working with these patterns means you're not dealing
with complex data structures from within Ansible, but instead have
something simple such as this:
backup_target_systems:
- system: "localdev"
active: true
backup_include_patterns:
- "/home/alice/"
- "/home/bob/files/"
backup_exclude_patterns:
- "/root/"
I hope this has helped. Please let me know if you need any further
assistance.
- M
On Sunday, 1 February 2015 13:17:33 UTC, Tadej Janež wrote:
>
> Hi,
>
> On Sun, 2015-02-01 at 03:39 -0800, [email protected] <javascript:> wrote:
> > I was hoping to get more details from you regarding this issue. I
> > appreciate what you're trying to do at Ansible's level, but what's
> > going to do the data transfer? If it's rsync, then I would like to
> > propose a new approach to this, but if it's not, I need to know before
> > I can write some example code for you.
>
> Yes, I intend to use rsync.
>
> My plan is to use a Bash script template that uses rsync and use Ansible
> to fill in the directories that need to be rsync-ed. I intend to use a
> separate Bash script for each backup target.
> Then I plan to use another Ansible task that will set up a cron job for
> each of these backup targets.
>
> Of course, I'm eager to hear new approaches to the problem I'm tackling.
>
> Regards,
> Tadej
>
>
--
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/c9ab4c0d-bec8-4096-a3da-d267534bfaad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.