Hi,

I'm trying to iterate over this list of dictionaries but I got:

"One or more undefined variables: 'hostname' is undefined".



Task:

       - name: LXC - creating directory
         file: path={{ lxc_dir }}/{{ item.hostname}} owner=root group=root
owner=755
         with_items: containers


Vars:

lxc_dir: "/var/lib/lxc"
containers: [
    {
        hostname : "test",
        lxc_rootfs : '{{ lxc_dir }}/{{ hostname }}/rootfs',
        lxc_mount : '{{ lxc_dir }}/{{ hostname }}/fstab',
        lxc_utsname : '{{ hostname }}',
        lxc_arch : '{{ ansible_architecture }}',
        lxc_ip_addr : "10.0.3.101",
        lxc_prefix_ip_addr : "24",
        lxc_broadcast_addr : "10.0.0.255",
        lxc.network.ipv4 : '{{ lxc_ip_addr }}/{{ lxc_prefix_ip_addr }} {{
lxc_broadcast_addr }}',
        lxc.network.ipv4.gateway : "10.0.3.1",
        lxc_network_type : '{{ | default(veth) }}',
        lxc_network_flags : '{{ | default(up) }}',
        lxc_network_link : '{{ | default(link) }}'
    },
]


-- 
Luis M. Ibarra

-- 
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/CAFyQ8TQczFckK-Rs_69V8oVppZdqCrSdf3pX4nzU%3DPJuzZtR4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to