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:
|
vars:
|
||||||
if_lan: "" # ← interface name here, like: ens3 or enp2s0"
|
if_lan: "" # ← interface name here, like: ens3 or enp2s0"
|
||||||
if_wan: "{{ ansible_default_ipv4.interface }}"
|
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
|
ipaddr_lan: 192.168.0.10
|
||||||
dhcp_range: 192.168.0.50,192.168.0.150,2h
|
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) }}"
|
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
|
||||||
|
@ -34,3 +34,20 @@
|
||||||
- tftp-netboot-installer
|
- tftp-netboot-installer
|
||||||
- preseed-installer
|
- preseed-installer
|
||||||
# - installbox2kiosk # enable this to install kiosk automatically
|
# - 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
|
force: no
|
||||||
|
|
||||||
- name: make the hostname resolvable from the LAN
|
- name: make the hostname resolvable from the LAN
|
||||||
replace:
|
lineinfile:
|
||||||
dest: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: '(127.0.1.1\s+){{ hostname }}'
|
insertafter: '^127.0.1.1'
|
||||||
replace: '\1localhost\n{{ ipaddr_lan }} {{ hostname }}'
|
line: '{{ ipaddr_lan }} {{ hostname }}'
|
||||||
|
|
||||||
- name: add auto pxe boot entry to di-netboot-assistant
|
- name: add auto pxe boot entry to di-netboot-assistant
|
||||||
blockinfile:
|
blockinfile:
|
||||||
|
|
|
@ -9,11 +9,9 @@
|
||||||
apt:
|
apt:
|
||||||
upgrade: dist
|
upgrade: dist
|
||||||
autoremove: yes
|
autoremove: yes
|
||||||
|
autoclean: yes
|
||||||
|
|
||||||
- name: install some packages
|
- name: install etckeeper
|
||||||
apt:
|
apt:
|
||||||
name: etckeeper
|
name: etckeeper
|
||||||
state: latest
|
state: latest
|
||||||
|
|
||||||
#- name: clean apt package cache
|
|
||||||
# command: apt clean
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue