56 lines
3.4 KiB
Django/Jinja
56 lines
3.4 KiB
Django/Jinja
#cloud-boothook
|
|
#!/bin/bash
|
|
|
|
cloud-init-per instance disable_selinux_on_the_fly setenforce 0
|
|
|
|
cloud-init-per instance disable_selinux sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux
|
|
|
|
# configure udev rules
|
|
|
|
# udev persistent net
|
|
cloud-init-per instance udev_persistent_net1 service network stop
|
|
|
|
ADMIN_MAC={{ common.admin_mac }}
|
|
ADMIN_IF=$(echo {{ common.udevrules }} | sed 's/[,=]/\n/g' | grep "$ADMIN_MAC" | cut -d_ -f2 | head -1)
|
|
cloud-init-per instance configure_admin_interface /bin/sh -c "echo -e \"# FROM COBBLER SNIPPET\nDEVICE=$ADMIN_IF\nIPADDR={{ common.admin_ip }}\nNETMASK={{ common.admin_mask }}\nBOOTPROTO=none\nONBOOT=yes\nUSERCTL=no\n\" | tee /etc/sysconfig/network-scripts/ifcfg-$ADMIN_IF"
|
|
|
|
cloud-init-per instance set_gateway /bin/sh -c 'echo GATEWAY="{{ common.gw }}" | tee -a /etc/sysconfig/network'
|
|
|
|
cloud-init-per instance udev_persistent_net5 service network start
|
|
|
|
# end of udev
|
|
|
|
#FIXME(agordeev): if operator updates dns settings on masternode after the node had been provisioned,
|
|
# cloud-init will start to generate resolv.conf with non-actual data
|
|
cloud-init-per instance resolv_conf_remove rm -f /etc/resolv.conf
|
|
cloud-init-per instance resolv_conf_header /bin/sh -c 'echo "# re-generated by cloud-init boothook only at the first boot;" | tee /etc/resolv.conf'
|
|
cloud-init-per instance resolv_conf_search /bin/sh -c 'echo "search {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf'
|
|
cloud-init-per instance resolv_conf_domain /bin/sh -c 'echo "domain {{ common.search_domain|replace('"','') }}" | tee -a /etc/resolv.conf'
|
|
cloud-init-per instance resolv_conf_nameserver /bin/sh -c 'echo nameserver {{ common.master_ip }} | tee -a /etc/resolv.conf'
|
|
|
|
# configure black module lists
|
|
# virt-what should be installed
|
|
if [ ! -f /etc/modprobe.d/blacklist-i2c_piix4.conf ]; then
|
|
([[ $(virt-what) = "virtualbox" ]] && echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist-i2c_piix4.conf || :)
|
|
modprobe -r i2c_piix4
|
|
fi
|
|
|
|
cloud-init-per instance conntrack_ipv4 /bin/sh -c 'echo nf_conntrack_ipv4 | tee -a /etc/rc.modules'
|
|
cloud-init-per instance conntrack_ipv6 /bin/sh -c 'echo nf_conntrack_ipv6 | tee -a /etc/rc.modules'
|
|
cloud-init-per instance conntrack_proto_gre /bin/sh -c 'echo nf_conntrack_proto_gre | tee -a /etc/rc.modules'
|
|
cloud-init-per instance chmod_rc_modules chmod +x /etc/rc.modules
|
|
cloud-init-per instance conntrack_max /bin/sh -c 'echo "net.nf_conntrack_max=1048576" | tee -a /etc/sysctl.conf'
|
|
cloud-init-per instance kernel_panic /bin/sh -c 'echo "kernel.panic=60" | tee -a /etc/sysctl.conf'
|
|
|
|
cloud-init-per instance conntrack_ipv4_load modprobe nf_conntrack_ipv4
|
|
cloud-init-per instance conntrack_ipv6_load modprobe nf_conntrack_ipv6
|
|
cloud-init-per instance conntrack_proto_gre_load modprobe nf_conntrack_proto_gre
|
|
cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=1048576"
|
|
cloud-init-per instance kernel_panic_set sysctl -w "kernel.panic=60"
|
|
|
|
cloud-init-per instance mkdir_coredump mkdir -p /var/log/coredump
|
|
cloud-init-per instance set_coredump /bin/sh -c 'echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" | tee -a /etc/sysctl.conf'
|
|
cloud-init-per instance set_coredump_sysctl sysctl -w "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t"
|
|
cloud-init-per instance set_chmod chmod 777 /var/log/coredump
|
|
cloud-init-per instance set_limits /bin/sh -c 'echo -e "* soft core unlimited\n* hard core unlimited" | tee -a /etc/security/limits.conf'
|