2022-02-23 19:36:03 +01:00
|
|
|
#cloud-config
|
|
|
|
|
2022-03-03 01:28:51 +01:00
|
|
|
write_files:
|
|
|
|
|
|
|
|
# Configure the private network interface
|
|
|
|
- content: |
|
|
|
|
BOOTPROTO='dhcp'
|
|
|
|
STARTMODE='auto'
|
|
|
|
path: /etc/sysconfig/network/ifcfg-eth1
|
|
|
|
|
|
|
|
# Disable ssh password authentication
|
|
|
|
- content: |
|
|
|
|
PasswordAuthentication no
|
|
|
|
X11Forwarding no
|
|
|
|
MaxAuthTries 2
|
|
|
|
AllowTcpForwarding no
|
|
|
|
AllowAgentForwarding no
|
|
|
|
AuthorizedKeysFile .ssh/authorized_keys
|
|
|
|
path: /etc/ssh/sshd_config.d/kube-hetzner.conf
|
|
|
|
|
2022-03-04 13:53:45 +01:00
|
|
|
# Setting the right reboot mode
|
|
|
|
- content: |
|
|
|
|
REBOOT_METHOD=kured
|
|
|
|
path: /etc/transactional-update.conf
|
|
|
|
append: true
|
|
|
|
|
2022-03-03 01:28:51 +01:00
|
|
|
# Add ssh authorized keys
|
|
|
|
ssh_authorized_keys:
|
|
|
|
%{ for key in sshAuthorizedKeys ~}
|
|
|
|
- ${key}
|
|
|
|
%{ endfor ~}
|
|
|
|
|
2022-03-02 14:30:19 +01:00
|
|
|
# Resize /var, not /, as that's the last partition in MicroOS image.
|
|
|
|
growpart:
|
|
|
|
devices: ["/var"]
|
|
|
|
|
2022-03-02 22:23:36 +01:00
|
|
|
# Make sure the hostname is set correctly
|
2022-03-02 22:19:58 +01:00
|
|
|
hostname: ${hostname}
|
2022-03-03 01:28:51 +01:00
|
|
|
preserve_hostname: true
|
|
|
|
manage_etc_hosts: "localhost"
|
2022-02-23 19:36:03 +01:00
|
|
|
|
|
|
|
runcmd:
|
2022-03-03 01:28:51 +01:00
|
|
|
|
|
|
|
# As above, make sure the hostname is not reset
|
|
|
|
- [ sed, -i, 's#preserve_hostname: false#preserve_hostname: true#g', /etc/cloud/cloud.cfg]
|
|
|
|
- [ sed, -i, 's#NETCONFIG_NIS_SETDOMAINNAME="yes"#NETCONFIG_NIS_SETDOMAINNAME="no"#g', /etc/sysconfig/network/config]
|
|
|
|
- [ sed, -i, 's#DHCLIENT_SET_HOSTNAME="yes"#DHCLIENT_SET_HOSTNAME="no"#g', /etc/sysconfig/network/dhcp]
|
|
|
|
|
|
|
|
# We set Google DNS servers
|
|
|
|
- [ sed, -i, 's#NETCONFIG_DNS_STATIC_SERVERS=""#NETCONFIG_DNS_STATIC_SERVERS="8.8.8.8 8.8.4.4"#g', /etc/sysconfig/network/config]
|
|
|
|
|
2022-03-03 19:25:58 +01:00
|
|
|
# Bound the amount of logs that can survive on the system
|
|
|
|
- [ sed, -i, 's/#SystemMaxUse=/SystemMaxUse=3G/g', /etc/systemd/journald.conf]
|
|
|
|
- [ sed, -i, 's/#MaxRetentionSec=/MaxRetentionSec=1week/g', /etc/systemd/journald.conf]
|
|
|
|
|
2022-03-03 01:28:51 +01:00
|
|
|
# Activate the private network
|
|
|
|
- systemctl reload network
|
|
|
|
|
|
|
|
# Activate ssh configuration
|
|
|
|
- systemctl reload sshd
|
|
|
|
|
|
|
|
# Finishing automatic reboot via Kured setup
|
|
|
|
- rebootmgrctl set-strategy off
|
|
|
|
|
|
|
|
# Reduce the default number of snapshots from 2-10 number limit, to 4
|
|
|
|
# And from 4-10 number limit important, to 2
|
|
|
|
- snapper -c root set-config "NUMBER_LIMIT=4"
|
|
|
|
- snapper -c root set-config "NUMBER_LIMIT_IMPORTANT=2"
|