Raspberry-Pi-IaC/roles/hostname/tasks/main.yml
Thomas Kleinendorst 71499b2610 Bind hostname to 172.0.1.1 and use FQDN in config
This makes that we see better labels in Grafana and that we don't
need to expose the address externally.
2024-09-23 12:23:05 +02:00

11 lines
337 B
YAML

---
- name: Configure hostname
become: true
ansible.builtin.hostname:
name: "{{ hostname }}"
- name: Remove existing /etc/hosts entry for hostname and add FQDN name
become: true
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: "^127.0.1.1.*$"
line: "127.0.0.1 {{ hostname }}.kleinendorst.info {{ hostname }}"