openstack-ansible-ops/multi-node-aio/playbooks/pxe/configs/redhat/vm.config.j2
Jesse Pretorius 42189e272f MNAIO: Use discard option for all mount points
Using the discard option for all mount points ensures
that the deletes actually release the blocks on the disk.
This ensures that SSD performance is optimised and that
file-backed images are kept as small as possible.

Change-Id: I648cbaca56d75e355cf6c8af01e2e3ad20dfc398
2018-08-23 18:57:02 +01:00

77 lines
2.4 KiB
Django/Jinja

# Server Kickstart - vm
install
text
lang en_US
keyboard us
timezone --utc Etc/UTC
auth --useshadow --enablemd5
selinux --disabled
firewall --disabled
services --enabled=NetworkManager,sshd
eula --agreed
ignoredisk --only-use=sda
reboot
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /boot --fstype ext3 --size=512
part pv.01 --size=1 --grow
volgroup vmvg00 pv.01
logvol / --fstype ext4 --name=root00 --vgname=vmvg00 --size=8192 --fsoptions=defaults,discard
logvol swap --fstype swap --name=swap00 --vgname=vmvg00 --size=2048
logvol /openstack --fstype ext4 --name=openstack00 --vgname=vmvg00 --size=16384 --fsoptions=defaults,discard
{% if default_container_tech == 'nspawn' %}
logvol /var/lib/machines --fstype ext4 --name=machines00 --vgname=vmvg00 --size=8192 --grow --fsoptions=defaults,discard
{% elif default_container_tech == 'lxc' %}
logvol /var/lib/machines --fstype ext4 --name=machines00 --vgname=vmvg00 --size=4096 --fsoptions=defaults,discard
logvol /var/lib/lxc --fstype ext4 --name=lxc00 --vgname=vmvg00 --size=8192 --grow --fsoptions=defaults,discard
{% endif %}
rootpw secrete
repo --name=base --baseurl={{ images[default_vm_image]['image_repo_base_url'] }}/os/x86_64/
repo --name=updates --baseurl={{ images[default_vm_image]['image_repo_base_url'] }}/updates/x86_64/
url --url="{{ images[default_vm_image]['image_repo_base_url'] }}/os/x86_64/" --proxy {{ default_proxy_url }}
%packages --nobase --ignoremissing
@core
wget
bridge-utils
btrfs-progs
dstat
git
python
systemd-networkd
systemd-resolved
tmux
vim
%end
%post
(set -x
echo
echo "################################"
echo "# Running Post Configuration #"
echo "################################"
# install ssh key
mkdir -m0700 /root/.ssh/
cat <<EOF >/root/.ssh/authorized_keys
{{ tftp_ssh_key }}
EOF
chmod 0600 /root/.ssh/authorized_keys
# set apt-cacher-ng proxy
sed -i '/\[main\]/a proxy={{ default_proxy_url }}' /etc/yum.conf
# kickstart has issues setting fstype to btrfs, so this converts the machines lvm partition to btrfs
modprobe btrfs
umount /dev/vmvg00/machines00
btrfs-convert /dev/vmvg00/machines00
sed -i '/vmvg00-machines00/d' /etc/fstab
echo "/dev/mapper/vmvg00-machines00 /var/lib/machines btrfs defaults,discard 1 2" >> /etc/fstab
wget --no-proxy http://{{ tftp_server }}/scripts/vm-post-install-redhat-script.sh -O /opt/vm-post-install-script.sh
chmod +x /opt/vm-post-install-script.sh
/opt/vm-post-install-script.sh
) > /root/post_install.log 2>&1
%end