Skip to content

Commit f2f9b47

Browse files
authored
Merge pull request #54 from remerge/DATA-552-fix-tf-bootstrap
make bootstrap resilient against nmcli changes from Leaseweb
2 parents 20f369f + d23259f commit f2f9b47

File tree

1 file changed

+23
-28
lines changed
  • leaseweb/server/installation

1 file changed

+23
-28
lines changed

leaseweb/server/installation/main.tf

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,11 @@ resource "leaseweb_dedicated_server_installation" "main" {
1515
#!/bin/bash
1616
set -ex
1717
18-
dnf install yum-utils
18+
dnf install -y yum-utils
1919
dnf config-manager --set-enabled crb
2020
dnf install -y epel-release
2121
dnf install -y systemd-networkd
2222
23-
cat > /etc/udev/rules.d/10-shared.rules <<EOR
24-
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="${lower(var.internal_mac)}", ATTR{addr_assign_type}=="0", NAME="shared"
25-
EOR
26-
27-
mkdir -p /etc/systemd/network
28-
cat > /etc/systemd/network/shared.network <<EOR
29-
[Match]
30-
MACAddress=${var.internal_mac}
31-
32-
[Network]
33-
Address=${var.internal_ip}/16
34-
Gateway=10.32.0.1
35-
DNS=10.164.15.230
36-
EOR
37-
38-
nmcli con down public
39-
systemctl stop NetworkManager
40-
systemctl start systemd-networkd
41-
42-
systemctl disable NetworkManager
43-
systemctl enable systemd-networkd
44-
45-
cat > /etc/resolv.conf <<EOR
46-
nameserver 10.164.15.230
47-
EOR
48-
4923
mkdir -p /var/lib/sftd
5024
chmod 700 /var/lib/sftd
5125
echo "${var.enrollment_token}" > /var/lib/sftd/enrollment.token
@@ -75,8 +49,29 @@ update-crypto-policies --set LEGACY
7549
dnf install -y scaleft-server-tools
7650
systemctl enable sftd
7751
52+
cat > /etc/udev/rules.d/10-shared.rules <<EOR
53+
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="${lower(var.internal_mac)}", ATTR{addr_assign_type}=="0", NAME="shared"
54+
EOR
55+
56+
mkdir -p /etc/systemd/network
57+
cat > /etc/systemd/network/shared.network <<EOR
58+
[Match]
59+
MACAddress=${var.internal_mac}
60+
61+
[Network]
62+
Address=${var.internal_ip}/16
63+
Gateway=10.32.0.1
64+
DNS=10.164.15.230
65+
EOR
66+
67+
systemctl disable NetworkManager
68+
systemctl enable systemd-networkd
69+
70+
cat > /etc/resolv.conf <<EOR
71+
nameserver 10.164.15.230
72+
EOR
73+
7874
sgdisk -n 4:0:0 -t 4:bf01 -c 4:data /dev/sda
79-
partprobe
8075
8176
reboot
8277
EOT

0 commit comments

Comments
 (0)