alpine: set hostname

And configure /etc/hosts accordingly.
This commit is contained in:
Timotej Lazar 2024-06-05 15:38:20 +02:00
parent fe6c35edf1
commit 398e41732e
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,12 @@
- name: Set hostname
hostname:
name: '{{ dns_name }}'
- name: Configure hosts
template:
dest: /etc/hosts
src: hosts.j2
- name: Enable community package repo
lineinfile:
path: /etc/apk/repositories

View file

@ -0,0 +1,2 @@
127.0.0.1 {{ dns_name }} {{ dns_name | split('.') | first }} localhost.localdomain localhost
::1 localhost localhost.localdomain