Make sure hostname can be set manually, cleanup/fixes.
This commit is contained in:
parent
0d534d8939
commit
f0004b6fe9
3 changed files with 24 additions and 9 deletions
|
@ -8,7 +8,7 @@
|
|||
vars:
|
||||
if_lan: "" # ← interface name here, like: ens3 or enp2s0"
|
||||
if_wan: "{{ ansible_default_ipv4.interface }}"
|
||||
hostname: "{{ ansible_hostname }}"
|
||||
hostname: "{{ ansible_hostname }}" # change this to not use the DNS-provided name
|
||||
ipaddr_lan: 192.168.0.10
|
||||
dhcp_range: 192.168.0.50,192.168.0.150,2h
|
||||
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
|
||||
|
@ -34,3 +34,20 @@
|
|||
- tftp-netboot-installer
|
||||
- preseed-installer
|
||||
# - installbox2kiosk # enable this to install kiosk automatically
|
||||
|
||||
post_tasks:
|
||||
- name: make sure hostname is set correctly in /etc/hosts
|
||||
replace:
|
||||
path: /etc/hosts
|
||||
regexp: '(127.0.1.1\s+){{ ansible_hostname }}(\s+.*)?$'
|
||||
replace: '\1{{ hostname }}\2'
|
||||
|
||||
- name: make sure hostname is set correctly in /etc/hostname
|
||||
replace:
|
||||
path: /etc/hostname
|
||||
regexp: '{{ ansible_hostname }}'
|
||||
replace: '{{ hostname }}'
|
||||
|
||||
- name: set hostname
|
||||
hostname:
|
||||
name: "{{ hostname }}"
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
force: no
|
||||
|
||||
- name: make the hostname resolvable from the LAN
|
||||
replace:
|
||||
dest: /etc/hosts
|
||||
regexp: '(127.0.1.1\s+){{ hostname }}'
|
||||
replace: '\1localhost\n{{ ipaddr_lan }} {{ hostname }}'
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
insertafter: '^127.0.1.1'
|
||||
line: '{{ ipaddr_lan }} {{ hostname }}'
|
||||
|
||||
- name: add auto pxe boot entry to di-netboot-assistant
|
||||
blockinfile:
|
||||
|
|
|
@ -9,11 +9,9 @@
|
|||
apt:
|
||||
upgrade: dist
|
||||
autoremove: yes
|
||||
autoclean: yes
|
||||
|
||||
- name: install some packages
|
||||
- name: install etckeeper
|
||||
apt:
|
||||
name: etckeeper
|
||||
state: latest
|
||||
|
||||
#- name: clean apt package cache
|
||||
# command: apt clean
|
||||
|
|
Loading…
Add table
Reference in a new issue