-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathfedora.26.cfg.j2
75 lines (62 loc) · 2.06 KB
/
fedora.26.cfg.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
install
lang en_US.UTF-8
keyboard us
auth --useshadow --enablemd5
services --enabled=sshd,ntpd
eula --agreed
network --device={{ hostvars[item]['netdev'] | default('eth0') }} --noipv6 --onboot yes --hostname {{ item }}
{%- if hostvars[item]['ip'] is defined %}
--bootproto static --ip {{ hostvars[item]['ip'] }} --netmask {{ hostvars[item]['netmask'] }} --gateway {{ hostvars[item]['gateway'] }} --nameserver {{ hostvars[item]['nameservers'][0] }}
{% else %}
--bootproto dhcp
{% endif %}
rootpw --iscrypted {{ hostvars[item]['rootpw'] | default('$1$Jxif9H1Q$c5oIEvRdtkSDJs8ZBcRZ3/') }}
firewall --disabled
selinux --disabled
timezone --utc Europe/Moscow
firstboot --disable
skipx
text
ignoredisk --only-use=sda
bootloader --location=mbr --append="ipv6.disable=1 net.ifnames=0 biosdevname=0"
zerombr
clearpart --drives=sda --all
part swap --asprimary --fstype=swap --ondisk=sda --size=1024
part / --asprimary --fstype=xfs --ondisk=sda --size=100 --grow
reboot
%packages
@core
net-tools
ntp
%end
%post --log=/root/ks-post.log
sed -i -e 's|^# %wheel\tALL=(ALL)\tNOPASSWD: ALL|%wheel\tALL=(ALL)\tNOPASSWD: ALL|; s|^Defaults requiretty|#&|' /etc/sudoers
### DNS settings
cat << EOF > /etc/resolv.conf
domain {{ domain }}
search {{ domain }}
{% for item in hostvars[item]['nameservers'] %}
nameserver {{ item }}
{% endfor %}
EOF
### disable /etc/resolv.conf rewritting if NM is installed
[ -f /etc/NetworkManager/NetworkManager.conf ] && sed -i '/\[main\]/a dns=none' /etc/NetworkManager/NetworkManager.conf
### creating new /etc/hosts
cat << EOF > /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail
127.0.0.1 localhost.localdomain localhost
EOF
install --mode=700 -d /root/.ssh
install --mode=700 /dev/null /root/.ssh/authorized_keys
{% if hostvars[item]['root_authorized_keys'] is defined %}
cat << 'EOF' >> /root/.ssh/authorized_keys
{{ hostvars[item]['root_authorized_keys'] }}
EOF
{% endif %}
{% if root_authorized_keys is defined %}
cat << 'EOF' >> /root/.ssh/authorized_keys
{{ root_authorized_keys }}
EOF
{% endif %}
%end