Hi,
I want to dynamically every new host to the backup server with rsnapshot. I
have no problems putting SSH keys on backup target hosts and putting a template
and exclude config for the target host into /etc/rsnapshot.d on backup host.
The problem is when I try to add the rsnapshot cronjob for the new host. And
here's the trick - I'm trying to add different times for each host because I
don't want them to all hit the backup disk at the same time. So I figured I
could put several cron time vars for each host in host_vars/ directory. Here's
an example of what I'm trying to pull-off with cron module:
FILE: roles/common/backup.yml
-----------------------------
- name: weekly rsnapshot cron
cron: name="rsnap {{ ansible_fqdn }} (upravlja Ansible)"
weekday={{ rsnap_weekly_day }} hour={{ rsnap_weekly_hour }}
minute={{ rsnap_weekly_min }} user="root"
job="rsnapshot -c /etc/rsnapshot.d/{{ ansible_fqdn }}.conf weekly"
cron_file="rsnap-{{ ansible_fqdn }}"
delegate_to: backuphost
FILE: host_vars/newhost
--------------------
rsnap_hourly_min: 12
rsnap_daily_min: 45
rsnap_daily_hour: 1
rsnap_weekly_min: 30
rsnap_weekly_hour: 21
rsnap_weekly_day: 3
What happens is that backuphost picks up the var of newhost and then cries
foul:
fatal: [backuphost] => One or more undefined variables: 'rsnap_daily_hour'
is undefined
I'm running out of ideas how I could do it. I've looked into several loops but
I'm still a beginner with Ansible and YAML syntax, so if anyone has any idea how
this delegation could work I'd really appreciate it!
Regards,
Martin
--
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/20140402232909.GA12514%40gmail.com.
For more options, visit https://groups.google.com/d/optout.