diff --git a/inventory/hosts b/inventory/hosts index 6e44ff1..8701249 100644 --- a/inventory/hosts +++ b/inventory/hosts @@ -1,2 +1,2 @@ [raspberry_pis] -192.168.50.27 +192.168.50.27 hostname=raspberry-pi-1 diff --git a/playbook.yml b/playbook.yml index af84958..2fa0dd0 100644 --- a/playbook.yml +++ b/playbook.yml @@ -34,6 +34,15 @@ # content: "{{ ansible_facts }}" # mode: "0600" # TODO: Replace this with setup that sets up unnattended updates on the machine itself. + - name: Configure hostname + become: true + ansible.builtin.hostname: + name: "{{ hostname }}" + - name: Add FQDN name in /etc/hosts + become: true + ansible.builtin.lineinfile: + path: /etc/hosts + line: "{{ ansible_facts['default_ipv4']['address'] }} {{ hostname }}.kleinendorst.info {{ hostname }}" - name: Update all packages to their latest version # noqa: package-latest become: true ansible.builtin.apt: