Include domain in inventory

This commit is contained in:
nemunaire 2023-03-14 14:10:43 +01:00
parent 0f9b5178b3
commit 2f93186906
2 changed files with 3 additions and 4 deletions

View File

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

View File

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