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) }}'
},
]