Hi!
Just a quick ping. Does anyone have any idea how I could solve the
problem described below? Maybe a work-around?
Thanks and best regards,
Tadej
On Thu, 2015-01-22 at 01:29 -0800, Tadej Janež wrote:
> Hi!
>
> I'm trying to develop a simple backup solution with Ansible.
>
> My inventory file contains:
> [backup-hosts]
> backup-host1
> backup-host2
>
> [backup-targets]
> backup-target1
> backup-target2
> backup-target3
> backup-target4
>
> Each backup-target has a host_vars file with contents similar to the
> following:
> # list of users and their directories that should be backed up
> backup_target_users_dirs:
> - user: "alice"
> dirs:
> - "Maildir"
> - "Important"
> - user: "bob"
> dirs:
> - "Maildir"
> - "ProjectX"
>
> I have a role that is played on each backup-host that contains
> a task to prepare directories for each backup target:
>
> - name: prepare directories for each backup target
> file:
> path: "~/{{ item[0] }}/{{ item[1]['dir'] }}"
> state: directory
> sudo: yes
> sudo_user: "{{ backup_host_user }}"
> with_nested:
> - groups["backup-targets"]
> - hostvars[item[0]]["backup_target_users_dirs"]
>
> As it is, it doesn't work. What I would like to achieve is that
> "item[0]" in
> the nested loop would refer to the value of the current item of the
> outer loop.
> How can I do that?
>
> Thanks and best 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/1422398620.9937.10.camel%40tlinux64.
For more options, visit https://groups.google.com/d/optout.