Skip to content

Commit

Permalink
Only loop over interfaces who know ipv4.address attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Thilo Solbrig authored and Rendanic committed Oct 15, 2024
1 parent f02d3d1 commit b20197d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion roles/common/templates/motd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Welcome to {{ ansible_hostname }}

FQDN: {{ ansible_fqdn }}
IP's:
{% for a in ansible_interfaces %}
{% if a != 'lo' and hostvars[inventory_hostname]['ansible_'~a]['ipv4']['address'] is defined %}
{% if a != 'lo' %}
{{a}}: {{ hostvars[inventory_hostname]['ansible_'~a]['ipv4']['address'] }}
{% endif %}
Expand Down

0 comments on commit b20197d

Please sign in to comment.