[libvirt] [libvirt-jenkins-ci PATCH v2 4/6] guests: Add unattended installation support

Pavel Hrdina phrdina at redhat.com
Thu Oct 19 11:15:05 UTC 2017


On Wed, Oct 18, 2017 at 07:11:49PM +0200, Andrea Bolognani wrote:
> The lcitool script can now be used to install most known guests
> without requiring user interaction.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---

[...]

> diff --git a/guests/kickstart.cfg b/guests/kickstart.cfg
> new file mode 100644
> index 0000000..603c0ae
> --- /dev/null
> +++ b/guests/kickstart.cfg
> @@ -0,0 +1,60 @@
> +# Installer configuration
> +#
> +# Perform a text based installation followed by a reboot, and disable
> +# the first boot assistant
> +text
> +install
> +reboot
> +firstboot --disable
> +
> +
> +# Environment configuration
> +#
> +# Locale, keyboard and timezone. All these will be configured again
> +# later with Ansible, but they're required information so we must
> +# provide them
> +lang en_US.UTF-8
> +keyboard us
> +timezone --utc UTC
> +
> +
> +# User creation
> +#
> +# We don't create any user except for root. We can use a very insecure
> +# root password here because it will be replaced with a used-defined one
> +# with Ansible immediately after installation
> +authconfig --enableshadow --passalgo=sha512
> +rootpw --plaintext root
> +
> +
> +# Partition disk
> +#
> +# Erase everything and set up a 2 GiB swap partition, then assign all

s/2 GiB/256 MiB/

> +# remaining space to the root partition
> +ignoredisk --only-use=vda
> +zerombr
> +clearpart --none
> +part / --fstype=ext4 --size=2048 --grow
> +part swap --fstype=swap --size=256
> +
> +
> +# Install bootloader
> +#
> +# The bootloader will be installed in the MBR
> +bootloader --location=mbr --timeout=1
> +
> +
> +# Configure networking
> +#
> +# The only network interface available to the guest will come up
> +# at boot using IPv4-only DHCP
> +network --bootproto=dhcp --noipv6 --activate --onboot=yes
> +
> +
> +# Software installation
> +#
> +# Only install the very base packages: everything else will be
> +# installed later using Ansible
> +%packages
> + at core
> +%end

[...]

> diff --git a/guests/preseed.cfg b/guests/preseed.cfg
> new file mode 100644
> index 0000000..00fd20d
> --- /dev/null
> +++ b/guests/preseed.cfg
> @@ -0,0 +1,85 @@
> +# Installer configuration
> +#
> +# Perform an automated installation where only critical questions
> +# are asked interactively
> +d-i auto-install/enable boolean true
> +d-i debconf/priority string critical
> +d-i finish-install/reboot_in_progress note
> +
> +
> +# Environment configuration
> +#
> +# Locale, keyboard and timezone. All these will be configured again
> +# later with Ansible, but they're required information so we must
> +# provide them
> +d-i debian-installer/locale string en_US.UTF-8
> +d-i keyboard-configuration/xkb-keymap select us
> +d-i time/zone string UTC
> +d-i clock-setup/utc boolean true
> +d-i clock-setup/ntp boolean true
> +
> +
> +# User creation
> +#
> +# We don't create any user except for root. We can use a very insecure
> +# root password here because it will be replaced with a used-defined one
> +# with Ansible immediately after installation
> +d-i passwd/make-user boolean false
> +d-i passwd/root-login boolean true
> +d-i passwd/root-password password root
> +d-i passwd/root-password-again password root
> +d-i user-setup/allow-password-weak boolean true
> +
> +
> +# Partition disk
> +#
> +# Erase everything and set up a 2 GiB swap partition, then assign all

s/2 GiB/256 MiB/

> +# remaining space to the root partition
> +d-i partman-auto/disk string /dev/vda
> +d-i partman-auto/method string regular
> +d-i partman-auto/expert_recipe string \
> +    custom :: \
> +        2048 2048 -1 ext4 \
> +            $primary{ } $bootable{ } \
> +            method{ format } format{ } \
> +            use_filesystem{ } filesystem{ ext4 } \
> +            mountpoint{ / } \
> +        . \
> +        256 256 256 linux-swap \
> +            $primary{ } \
> +            method{ swap } format{ } \
> +        .
> +d-i partman-partitioning/confirm_write_new_label boolean true
> +d-i partman/choose_partition select finish
> +d-i partman/confirm boolean true
> +d-i partman/confirm_nooverwrite boolean true
> +
> +
> +# Install bootloader
> +#
> +# The bootloader will be installed in the MBR
> +d-i grub-installer/skip boolean false
> +d-i grub-installer/bootdev string /dev/vda
> +d-i grub-installer/only_debian boolean true
> +
> +
> +# Configure networking
> +#
> +# The only network interface available to the guest will come up
> +# at boot using DHCP
> +d-i netcfg/enable boolean true
> +d-i netcfg/choose_interface select auto
> +d-i netcfg/get_hostname string localhost
> +d-i netcfg/get_domain string localdomain
> +
> +
> +# Software installation
> +#
> +# Only install the very base packages: everything else will be
> +# installed later using Ansible. We need to install openssh-server
> +# and configure it to permit root login now, though, otherwise we
> +# won't be able to access the machine for Ansible use later on
> +tasksel tasksel/first multiselect standard
> +d-i pkgsel/upgrade select none
> +d-i pkgsel/include string openssh-server
> +d-i preseed/late_command string in-target sed -i 's/^#*\s*PermitRootLogin\s*.*$/PermitRootLogin yes/g' /etc/ssh/sshd_config
> -- 
> 2.13.6
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171019/336153e7/attachment-0001.sig>


More information about the libvir-list mailing list