Use inventory_hostname_short

This commit is contained in:
nemunaire 2023-03-15 01:36:34 +01:00
parent 2f93186906
commit 9af8e490a3
2 changed files with 3 additions and 3 deletions

View File

@ -20,9 +20,9 @@
line: "{{ item.ip }} {{ item.hosts }}"
with_items:
- ip: "127.0.0.1"
hosts: "{{ inventory_hostname }} {{ inventory_hostname.split('.')[0] }} localhost localhost.localdomain"
hosts: "{{ inventory_hostname }} {{ inventory_hostname_short }} localhost localhost.localdomain"
- ip: "::1"
hosts: "{{ inventory_hostname }} {{ inventory_hostname.split('.')[0] }} localhost localhost.localdomain"
hosts: "{{ inventory_hostname }} {{ inventory_hostname_short }} localhost localhost.localdomain"
- import_tasks: "pkg_Alpine.yml"
when: ansible_distribution == 'Alpine'

View File

@ -1 +1 @@
{{ inventory_hostname.split(".")[0] }}
{{ inventory_hostname_short }}