You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
608 B
YAML

---
- name: Set local hostname
copy:
content: "{{ hostname }}\n"
dest: /etc/hostname
notify: restart systemd-hostnamed
- name: Set hostname and fqdn as alias for ipv4
lineinfile:
path: /etc/hosts
regexp: '^127\.0\.0\.1\s'
line: "127.0.0.1 {{ fqdn }} {{ hostname }} localhost *.localhost"
notify: restart systemd-hostnamed
- name: Set hostname and fqdn as alias for ipv6
lineinfile:
path: /etc/hosts
regexp: '^::1\s'
line: "::1 {{ fqdn }} {{ hostname }} localhost *.localhost ip6-localhost ip6-loopback"
notify: restart systemd-hostnamed
- meta: flush_handlers