Created
August 7, 2019 11:09
-
-
Save versionsix/78b7ed5032743fb9bb411dc87d5baccc to your computer and use it in GitHub Desktop.
Legacy free openstack images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O /var/lib/libvirt/images/ubuntu-bionic.qcow2 https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img | |
cat <<EOF > 51-vga.cfg | |
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0 vga=789" | |
EOF | |
virt-copy-in -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 51-vga.cfg /etc/default/grub.d | |
virt-customize -v -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 \ | |
--run-command "update-grub" \ | |
--run-command "apt -yqq update && apt -yqq upgrade" \ | |
--run-command "apt -y -qq --no-install-recommends install jq dnsutils && apt -y autoremove" \ | |
--run-command "mkdir -p /etc/systemd/system/getty@tty1.service.d && mkdir -p /etc/systemd/system/serial-getty@ttyS0.service.d && mkdir -p /etc/cloud/cloud.cfg.d/" | |
cat <<EOF > override.conf | |
[Service] | |
Type=simple | |
ExecStart= | |
ExecStart=-/sbin/agetty --autologin root --noclear %I 38400 linux | |
EOF | |
virt-copy-in -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 override.conf /etc/systemd/system/getty@tty1.service.d | |
cat <<EOF > override.conf | |
[Service] | |
Type=simple | |
ExecStart= | |
ExecStart=-/sbin/agetty --autologin ubuntu --noclear %I 38400 linux | |
EOF | |
virt-copy-in -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 override.conf /etc/systemd/system/serial-getty@ttyS0.service.d | |
cat <<EOF > 98-openstack-network.cfg | |
datasource: | |
OpenStack: | |
apply_network_config: True | |
EOF | |
virt-copy-in -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 98-openstack-network.cfg /etc/cloud/cloud.cfg.d/ | |
virt-sysprep -v -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 \ | |
--colors --operations machine-id | |
# virt-sparsify /var/lib/libvirt/images/ubuntu-bionic.qcow2 /usr/share/nginx/html/ubuntu-bionic.qcow2 | |
qemu-img convert -O qcow2 -c /var/lib/libvirt/images/ubuntu-bionic.qcow2 /usr/share/nginx/html/ubuntu-bionic.qcow2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment