From b77506cb50ab66e8157347e0423325c76dda24b2 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 20 Oct 2015 17:41:32 -0700 Subject: [PATCH] Add documentation and kickstart for --make-vagrant --- docs/fedora-vagrant.ks | 69 ++++++++++++++++++++++++++++++++++++++ docs/livemedia-creator.rst | 25 ++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 docs/fedora-vagrant.ks diff --git a/docs/fedora-vagrant.ks b/docs/fedora-vagrant.ks new file mode 100644 index 00000000..57d7ad70 --- /dev/null +++ b/docs/fedora-vagrant.ks @@ -0,0 +1,69 @@ +# Minimal Vagrant Disk Image +# + +# Firewall configuration +firewall --enabled +# Use network installation +url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/" + +# Root account is locked, access via sudo from vagrant user +rootpw --lock + +# Vagrant user with the INSECURE default public key +user --name=vagrant +sshkey --username=vagrant "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" + +# System authorization information +auth --useshadow --enablemd5 +# System keyboard +keyboard --xlayouts=us --vckeymap=us +# System language +lang en_US.UTF-8 +# SELinux configuration +selinux --enforcing +# Installation logging level +logging --level=info +# Shutdown after installation +shutdown +# System timezone +timezone US/Eastern +# System bootloader configuration +bootloader --location=mbr +# Partition clearing information +clearpart --all --initlabel +# Disk partitioning information +part / --fstype="ext4" --size=4000 +part swap --size=1000 + +%post +# Remove random-seed +rm /var/lib/systemd/random-seed + +# Setup sudoers for Vagrant +echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers +sed -i 's/Defaults\s*requiretty/Defaults !requiretty/' /etc/sudoers + +# SSH setup +sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config +%end + +%packages --excludedocs +@core +kernel +memtest86+ +grub2-efi +grub2 +shim +syslinux +-dracut-config-rescue + +# dracut needs these included +dracut-network +tar + +# Useful tools for Vagrant +openssh-server +openssh-clients +sudo +rsync +%end diff --git a/docs/livemedia-creator.rst b/docs/livemedia-creator.rst index 15db5964..2a379eb7 100644 --- a/docs/livemedia-creator.rst +++ b/docs/livemedia-creator.rst @@ -454,6 +454,31 @@ This will work with ``--no-virt`` and inside a mock since it doesn't use any partitioned disk images. +Vagrant Image Creation +---------------------- + +`Vagrant ` images can be created using the following command:: + + sudo livemedia-creator --make-vagrant --vagrant-metadata /path/to/metadata.json \ + --iso=/path/to/boot.iso --ks=/path/to/fedora-vagrant.ks + +The image created is a `vagrant-libvirt +` provider image and needs to have +vagrant setup with libvirt before you can use it. + +The ``--vagrant-metadata`` file is optional, it will create a minimal one by +default, and if one is passed it will make sure the disk size is setup +correctly. If you pass a ``--vagrant-vagrantfile`` it will be included in the +image verbatim. By default no vagrantfile is created. + +There is an example Vagrant kickstart file in the docs directory that sets up +the vagrant user with the default insecure SSH pubkey and a few useful +utilities. + +This also works with ``--no-virt``, but will not work inside a mock due to its +use of partitioned disk images and qcow2. + + Debugging problems ------------------