From 332dbe851c44543b69e516439baf203c9bebcadc Mon Sep 17 00:00:00 2001 From: zsdc Date: Thu, 20 Feb 2020 10:43:36 +0200 Subject: QEMU image build improvements * Added missed package dependencies (for Debian 10 based builders) * Added additional options, which can be passed to the playbook: * iso_local - path to local ISO file * disk_size - target disk image size * cloud_init - enable or disable Cloud-init integration to an image * cloud_init_ds - set custom list of data sources for Cloud-init * Added a version number and Cloud-init mark to a QCOW2 image name * Cloud-init installation procedure tuned to use packages from a proper one VyOS repository, according to VyOS and Debian version * Added workaround for /etc/network/interfaces to allow Cloud-init initialize network in a native way * Replaced default config file to Jinja2 template * Fixed GRUB installation on UEFI builders - added target i386-pc * Replaced GRUB configuration: * enable both KVM and Serial console for all images (Serial by default) * added password recovery option for all images * added 5 seconds of a timeout to allow select proper menu entry * fixed booting for 1.3 VyOS * Added loop device detach after image build - allows to build images multiple times without exhausting loop device limit * Added fstrim applying for image - theoretically, this may save some space * Enabled compression for QCOW2 image - this reduces image size significantly * Added RAW image deletion after conversion to more accurate cleanup --- roles/install-config/templates/config.boot.j2 | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 roles/install-config/templates/config.boot.j2 (limited to 'roles/install-config/templates') diff --git a/roles/install-config/templates/config.boot.j2 b/roles/install-config/templates/config.boot.j2 new file mode 100644 index 0000000..9b3e8ec --- /dev/null +++ b/roles/install-config/templates/config.boot.j2 @@ -0,0 +1,50 @@ +system { + host-name vyos + login { + user vyos { + authentication { +{% if cloud_init == "true" %} + encrypted-password "*" +{% else %} + encrypted-password "$6$MjV2YvKQ56q$QbL562qhRoyUu8OaqrXagicvcsNpF1HssCY06ZxxghDJkBCfSfTE/4FlFB41xZcd/HqYyVBuRt8Zyq3ozJ0dc." +{% endif %} + plaintext-password "" + } + level admin + } + } + syslog { + global { + facility all { + level notice + } + facility protocols { + level debug + } + } + } + ntp { + server "0.pool.ntp.org" + server "1.pool.ntp.org" + server "2.pool.ntp.org" + } + config-management { + commit-revisions 100 + } +} +interfaces { +{% if cloud_init == "true" %} + ethernet eth0 { + address dhcp + } +{% endif %} + loopback lo { + } +} +{% if cloud_init == "true" %} +service { + ssh { + port 22 + } +} +{% endif %} -- cgit v1.2.3