-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathks.cfg
121 lines (94 loc) · 3.49 KB
/
ks.cfg
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# System language and keyboard settings
lang en_US.UTF-8
keyboard it
# Timezone and NTP
timezone Europe/Rome --utc
network --hostname=nethserver8.localdomain
# Network configuration (Static IP assignment)
network --bootproto=dhcp --device=eth0 --activate
# Root password
rootpw --plaintext Nethesis,1234
# Disable user interaction during installation
text
reboot --eject
# Disk partitioning
clearpart --all
autopart --type=lvm
# Bootloader configuration
bootloader --location=mbr
# Package selection (Minimal installation)
%packages
@^minimal-environment
curl
%end
# Post-installation script
%post
# Enable network connection
nmcli connection modify eth0 connection.autoconnect yes
# Allow root login via SSH
sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
systemctl restart sshd >> /var/log/ns8-install.log
# Enable rc.local
cat << EOF > /etc/rc.d/rc.local
#!/bin/bash
# Install NethServer 8
curl https://raw.githubusercontent.com/NethServer/ns8-core/ns8-stable/core/install.sh | bash >> /var/log/ns8-install.log 2>&1
if [ \$? -eq 0 ]; then
echo "NethServer 8 installation completed successfully." >> /var/log/ns8-install.log
else
echo "NethServer 8 installation failed." >> /var/log/ns8-install.log
exit 1
fi
# Create a new cluster
create-cluster leader.nethserver8.localdomain:55820 10.5.4.0/24 Nethesis,1234
if [ \$? -eq 0 ]; then
echo "Cluster creation completed successfully." >> /var/log/ns8-install.log
else
echo "Cluster creation failed." >> /var/log/ns8-install.log
exit 1
fi
# Add an internal provider to the cluster
api-cli run cluster/add-internal-provider --data '{"image": "openldap", "node": 1}'
api-cli run module/openldap1/configure-module --data '{"provision":"new-domain","admuser":"administrator","admpass":"Nethesis,1234","domain":"ns8.local"}'
if [ \$? -eq 0 ]; then
echo "Internal provider addition completed successfully." >> /var/log/ns8-install.log
else
echo "Internal provider addition failed." >> /var/log/ns8-install.log
exit 1
fi
# Install NethVoice Proxy
add-module nethvoice-proxy >> /var/log/ns8-install.log 2>&1
if [ \$? -eq 0 ]; then
echo "NethVoice Proxy installation completed successfully." >> /var/log/ns8-install.log
else
echo "NethVoice Proxy installation failed." >> /var/log/ns8-install.log
exit 1
fi
# Install NethVoice
add-module nethvoice >> /var/log/ns8-install.log 2>&1
if [ \$? -eq 0 ]; then
echo "NethVoice installation completed successfully." >> /var/log/ns8-install.log
else
echo "NethVoice installation failed." >> /var/log/ns8-install.log
exit 1
fi
# Cleanup all existing network configurations
nmcli connection show | grep -v "NAME" | awk '{print \$1}' | while read -r conn; do
nmcli connection delete "\$conn"
done
# List all network interfaces except for loopback
interfaces=\$(nmcli device status | grep -vE "DEVICE|lo" | awk '{print \$1}')
# Get the first network interface
first_interface=\$(echo "\$interfaces" | head -n 1)
# Create a new network configuration for the first interface with a static address
nmcli connection add type ethernet ifname "\$first_interface" con-name "static-connection" ipv4.method manual ipv4.addresses "192.168.1.1/24" ipv4.gateway "192.168.1.254" ipv4.dns "8.8.8.8"
nmcli connection up "static-connection"
echo "Network configuration for \$first_interface set to 192.168.1.1/24 without a gateway." >> /var/log/ns8-install.log
# Disable rc.local after first boot
rm -f /etc/rc.d/rc.local
systemctl disable rc-local
shutdown -h now
EOF
chmod +x /etc/rc.d/rc.local
systemctl enable rc-local
%end