Fix the hostname definition in /etc/hosts.

This commit is contained in:
Andrea Dell'Amico 2026-04-13 18:13:43 +02:00
parent 91c4b509ec
commit 1baa07ca3e
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 1 additions and 1 deletions

View File

@ -19,5 +19,5 @@
marker_begin: ansible_hostname_start
marker_end: ansible_hostname_end
marker: "# {mark} hostname entry managed by ansible"
block: "{{ ansible_default_ipv4.address }} {{ hostname | default(ansible_hostname) }} {{ ansible_hostname }} {{ ansible_fqdn }}"
block: "{{ ansible_default_ipv4.address }} {% if hostname is defined {{ hostname }}{% else %}{{ ansible_fqdn }} {{ ansible_hostname) }}{% endif %}"
state: present