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 15:46:15 +01:00
|
|
|
# Set reboot method as "kured"
|
|
|
|
- content: |
|
|
|
|
REBOOT_METHOD=kured
|
|
|
|
path: /etc/transactional-update.conf
|
|
|
|
|
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
|
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
|
2022-03-04 16:08:05 +01:00
|
|
|
- [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]
|
2022-03-03 19:25:58 +01:00
|
|
|
|
2022-03-04 15:46:15 +01:00
|
|
|
# We set Cloudflare DNS servers, followed by Google as a backup
|
2022-03-04 16:08:05 +01:00
|
|
|
- [sed, '-i', 's/NETCONFIG_DNS_STATIC_SERVERS=""/NETCONFIG_DNS_STATIC_SERVERS="1.1.1.1 1.0.0.1 8.8.8.8"/g', /etc/sysconfig/network/config]
|
2022-03-03 01:28:51 +01:00
|
|
|
|
2022-03-04 15:46:15 +01:00
|
|
|
# Bounds the amount of logs that can survive on the system
|
2022-03-04 16:08:05 +01:00
|
|
|
- [sed, '-i', 's/#SystemMaxUse=/SystemMaxUse=3G/g', /etc/systemd/journald.conf]
|
|
|
|
- [sed, '-i', 's/#MaxRetentionSec=/MaxRetentionSec=1week/g', /etc/systemd/journald.conf]
|
|
|
|
|
|
|
|
# Reduces the default number of snapshots from 2-10 number limit, to 4 and from 4-10 number limit important, to 2
|
|
|
|
- [sed, '-i', 's/NUMBER_LIMIT="2-10"/NUMBER_LIMIT="4"/g', /etc/snapper/configs/root]
|
|
|
|
- [sed, '-i', 's/NUMBER_LIMIT_IMPORTANT="4-10"/NUMBER_LIMIT_IMPORTANT="3"/g', /etc/snapper/configs/root]
|
2022-03-03 01:28:51 +01:00
|
|
|
|
2022-03-04 15:46:15 +01:00
|
|
|
# Disables unneeded services
|
|
|
|
- [systemctl, disable, '--now', 'rebootmgr.service']
|