Hi everyone

I'm trying to setup multiple proxmox network interfaces for my containers 
with Ansible. 

Here is the code that I'm using. You can see in the netif property that I 
sometimes want to add a second interface to the container.

- name: Create instances
  proxmox: 
    vmid={{ item.id }} 
    node='simpsons' 
    api_user='{{ proxmox.api.username }}' 
    api_password='{{ proxmox.api.password }}' 
    api_host='localhost' 
    password='{{ item.hostname | b64encode | to_uuid }}' 
    hostname='{{ item.hostname }}' 
    onboot=yes
    memory={{ item.memory }}
    ostemplate='local:vztmpl/debian-8.0-standard_8.4-1_amd64.tar.gz' 
    netif='
      {"net0":"name=eth0,gw=10.100.0.1,ip=10.100.0.{{ item.id 
}}/24,bridge=vmbr0"}
      {% item.public_ip is defined %}
      ,
      {"net1":"name=eth1,gw=100.100.100.1,ip={{ item.public_ip 
}}/24,bridge=vmbr0,mac={{ item.public_mac }}"}
      {% endif %}'
  with_items: "{{ containers }}"

When I run my playbook with this task I get the following error: fatal: 
[xxx]: FAILED! => {"failed": true, "msg": "template error while templating 
string: Encountered unknown tag 'item'.. String: 
 {\"net0\":\"name=eth0,gw=10.100.0.1,ip=10.100.0.{{ item.id 
}}/24,bridge=vmbr0\"} {% item.public_ip is defined %} , 
{\"net1\":\"name=eth1,gw=100.100.100.1,ip={{ item.public_ip 
}}/24,bridge=vmbr0,mac={{ item.public_mac }}\"} {% endif %}"}

It feels like I'm taking the wrong approach to this. Can someone point me 
into the right direction to solve this or provide an alternative method?

ansible 2.1.2.0

Thanks a lot for your time

-- 
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/c7fe57c2-cd34-4d89-b7fd-c7dbc16886fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to