58 lines
1.6 KiB
Django/Jinja
58 lines
1.6 KiB
Django/Jinja
#!/bin/bash
|
|
|
|
set -eux
|
|
|
|
FS_TYPE=`findmnt -o FSTYPE -fn /`
|
|
|
|
if [ "$FS_TYPE" = "xfs" ]; then
|
|
xfs_growfs /
|
|
elif [ "$FS_TYPE" = "ext4" ]; then
|
|
resize2fs /dev/sda
|
|
else
|
|
echo "ERROR: Unknown filesystem, cannot resize."
|
|
exit 1
|
|
fi
|
|
|
|
{% if not undercloud_setup|bool %}
|
|
|
|
{% if convert_image_update|bool %}
|
|
yum update -y
|
|
{% endif %}
|
|
|
|
yum remove -y {{ convert_image_remove_pkgs|join(" ") }}
|
|
yum install -y {{ convert_image_install_pkgs|join(" ") }}
|
|
# NOTE(trown) Install tempest and test packages in a seperate yum transaction
|
|
# so that we do not fail the conversion if this install fails. There is a period
|
|
# after TripleO uploads a new image, but before the buildlogs repo gets synced,
|
|
# where this will fail because we try to install older test packages than the
|
|
# service packages already installed in the image.
|
|
yum install -y {{ convert_image_tempest_plugins|join(" ") }} || /bin/true
|
|
|
|
{% endif %}
|
|
|
|
useradd {{ undercloud_user }}
|
|
echo "{{ undercloud_user }} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/{{ undercloud_user }}
|
|
chmod 0440 /etc/sudoers.d/{{ undercloud_user }}
|
|
|
|
mkdir /home/{{ undercloud_user }}/.ssh
|
|
|
|
echo "127.0.0.1 undercloud localhost" > /etc/hosts
|
|
echo "HOSTNAME=undercloud" >> /etc/sysconfig/network
|
|
echo "undercloud" > /etc/hostname
|
|
|
|
chown -R {{ undercloud_user }}:{{ undercloud_user }} /home/{{ undercloud_user }}/
|
|
|
|
# Add a 4GB swap file to the Undercloud
|
|
dd if=/dev/zero of=/swapfile bs=1024 count=4194304
|
|
mkswap /swapfile
|
|
chmod 600 /swapfile
|
|
# Enable it on start
|
|
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
|
|
|
|
{% if not selinux_enforcing|bool %}
|
|
|
|
sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
|
|
|
|
{% endif %}
|
|
|