Properly add hostname and FQDN
This commit is contained in:
parent
8d27bd892c
commit
d1cf27d277
2 changed files with 10 additions and 1 deletions
|
|
@ -1,2 +1,2 @@
|
|||
[raspberry_pis]
|
||||
192.168.50.27
|
||||
192.168.50.27 hostname=raspberry-pi-1
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue