Can anyone spot my error here. I have the following in the minion config:

  network.interfaces: []

I expect the following to return the IP of all minions:

{% for ip in salt['mine.get']('*', 'network.interfaces', ['eth0']).items() %}
{{ ip }}
{% endfor %}

The state fails with the following:

Unable to manage file: Jinja error: 'list' object has no attribute 'lower'.

I've also tried doing it another way:

{% set hosts = salt['mine.get']('*', 'network.interfaces') %}
{% for i in hosts %}
{{ hosts[i]['eth0']['inet'][0]['address'] }}
{% endfor %}

From this I get:

variable 'dict object' has no attribute 'inet';

If I remove inet, 0 and address it works but outputs all interface info when I only want the IP of eth0.

Any help is greatly appreciated.


# use network.ip_addrs instead

  network.ip_addrs: [eth0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.