alpine: set hostname
And configure /etc/hosts accordingly.
This commit is contained in:
parent
fe6c35edf1
commit
398e41732e
|
@ -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
|
- name: Enable community package repo
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /etc/apk/repositories
|
path: /etc/apk/repositories
|
||||||
|
|
2
roles/alpine/templates/hosts.j2
Normal file
2
roles/alpine/templates/hosts.j2
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
127.0.0.1 {{ dns_name }} {{ dns_name | split('.') | first }} localhost.localdomain localhost
|
||||||
|
::1 localhost localhost.localdomain
|
Loading…
Reference in a new issue