From be4e3c3b696e31bee37214c24dc4236786696a95 Mon Sep 17 00:00:00 2001 From: Jochen Demmer Date: Fri, 26 Jan 2024 13:15:23 +0100 Subject: [PATCH] motd bug in default_ipv4 method from facts --- galaxy.yml | 2 +- roles/ansible_motd/templates/motd | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 111266b..cc9c601 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: imp1sh name: ansible_managemynetwork -version: 0.4.3 +version: 0.4.4 readme: README.md authors: - Jochen Demmer diff --git a/roles/ansible_motd/templates/motd b/roles/ansible_motd/templates/motd index d892337..73b5645 100644 --- a/roles/ansible_motd/templates/motd +++ b/roles/ansible_motd/templates/motd @@ -38,7 +38,7 @@ _ __ ___ _ __ _ ___ _ __ ___| |___ _____ _ __| | _____ | '_ \ / _ \| '__| / __| | '_ \ / _ \ __\ \ /\ / / _ \| '__| |/ / __| | | | | (_) | | | \__ \ | | | | __/ |_ \ V V / (_) | | | <\__ \ -|_| |_|\___/|_| |_|___/ |_| |_|\___|\__| \_/\_/ \___/|_| |_|\_\___/ +|_| |_|\___/|_| |_|___/ |_| |_|\___|\__| \_/\_/ \___/|_| |_|\_\___ {% else %} ___ _ __ __ @@ -71,16 +71,16 @@ IPv6 address: {{ nb_vms[inventory_hostname]["primary_ip6"] }} IPv6 address: {{ nb_devices[inventory_hostname]["primary_ip6"] }} {% elif primary_ip6 is defined %} IPv6 address: {{ primary_ip6 }} -{% else %} -IPv6 address: {{ ansible_facts['ansible_default_ipv6']['address'] }}/{{ ansible_facts['ansible_default_ipv6']['prefix'] }} +{% elif ansible_facts['default_ipv6']['address'] is defined %} +IPv6 address: {{ ansible_facts['default_ipv6']['address'] }}/{{ ansible_facts['default_ipv6']['prefix'] }} {% endif %} -{% if nb_vms[inventory_hostname]["primary_ip4"] is defined %} +{% if nb_vms[inventory_hostname]["primary_ip4"]['address'] is defined %} IPv4 address: {{ nb_vms[inventory_hostname]["primary_ip4"] }} {% elif nb_devices[inventory_hostname]["primary_ip4"] is defined %} IPv4 address: {{ nb_devices[inventory_hostname]["primary_ip4"] }} {% elif primary_ip4 is defined %} IPv4 address: {{ primary_ip4 }} -{% else %} -IPv4 address: {{ ansible_facts['ansible_default_ipv4']['address'] }}/{{ ansible_facts['ansible_default_ipv4']['prefix'] }} +{% elif ansible_facts['default_ipv4']['address'] is defined %} +IPv4 address: {{ ansible_facts['default_ipv4']['address'] }}/{{ ansible_facts['default_ipv4']['prefix'] }} {% endif %} timezone: {{ ansible_date_time['tz'] }}