Re: [libvirt-jenkins-ci PATCH 3/5] ansible: Add unattended installation support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 17, 2017 at 05:57:30PM +0200, Pavel Hrdina wrote:
> On Mon, Oct 16, 2017 at 06:02:06PM +0200, Andrea Bolognani wrote:
> > The 'manage' tool can now be used to install most known guests
> > without requiring user interaction.
> > 
> > Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> > ---
> >  ansible/group_vars/all/install.yml                 | 10 +++
> >  ansible/host_vars/libvirt-centos-6/install.yml     |  3 +
> >  ansible/host_vars/libvirt-centos-7/install.yml     |  3 +
> >  ansible/host_vars/libvirt-debian-8/install.yml     |  3 +
> >  ansible/host_vars/libvirt-debian-9/install.yml     |  3 +
> >  ansible/host_vars/libvirt-fedora-25/install.yml    |  3 +
> >  ansible/host_vars/libvirt-fedora-26/install.yml    |  3 +
> >  .../host_vars/libvirt-fedora-rawhide/install.yml   |  3 +
> >  ansible/host_vars/libvirt-ubuntu-12/install.yml    |  3 +
> >  ansible/host_vars/libvirt-ubuntu-14/install.yml    |  3 +
> >  ansible/host_vars/libvirt-ubuntu-16/install.yml    |  3 +
> >  ansible/kickstart.cfg                              | 60 +++++++++++++++
> >  ansible/manage                                     | 74 +++++++++++++++++++
> >  ansible/preseed.cfg                                | 85 ++++++++++++++++++++++
> >  14 files changed, 259 insertions(+)
> >  create mode 100644 ansible/group_vars/all/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-centos-6/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-centos-7/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-debian-8/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-debian-9/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-fedora-25/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-fedora-26/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-fedora-rawhide/install.yml
> 
> I wouldn't include Ubuntu related things.  Yes, we use travis where they
> have Ubuntu nodes, but this is jenkins-ci repository where we don't use
> Ubuntu at all.
> 
> >  create mode 100644 ansible/host_vars/libvirt-ubuntu-12/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-ubuntu-14/install.yml
> >  create mode 100644 ansible/host_vars/libvirt-ubuntu-16/install.yml
> >  create mode 100644 ansible/kickstart.cfg
> >  create mode 100644 ansible/preseed.cfg
> > 
> > diff --git a/ansible/group_vars/all/install.yml b/ansible/group_vars/all/install.yml
> > new file mode 100644
> > index 0000000..714328e
> > --- /dev/null
> > +++ b/ansible/group_vars/all/install.yml
> > @@ -0,0 +1,10 @@
> > +---
> > +# Sizes are in GiB
> > +install_virt_type: kvm
> > +install_arch: x86_64
> > +install_machine: pc
> > +install_vcpus: 2
> > +install_memory_size: 2
> > +install_disk_size: 10
> 
> Currently we have 15 GiB per guest and in some cases we are able to run
> out of space.  Let's use 15 GiB.

We used to run out of space periodically because our RPM build jobs were
creating RPMs in $HOME/rpmbuild which jenkins never purged. I reconfigured
Jenkins to use the GIT workspace as the RPM build dir, so jenkins always
purges RPMs. Since then we've not run out of space again AFAIK. None the
less, I agree that 15 GiB is probably the min we need


> > diff --git a/ansible/kickstart.cfg b/ansible/kickstart.cfg
> > new file mode 100644
> > index 0000000..c28f275
> > --- /dev/null
> > +++ b/ansible/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 Europe/Prague

How about UTC as a neutral option for timezone ;-)


> > +
> > +
> > +# User creation
> > +#
> > +# We don't create any user except for root. We can use a very insecure
> > +# root password because the guest will not be exposed to the Internet:
> > +# it will only be accessible from the host itself
> > +authconfig --enableshadow --passalgo=sha512
> > +rootpw --plaintext root
> > +
> > +
> > +# Partition disk
> > +#
> > +# Erase everything and set up a 2 GiB swap partition, then assign all
> > +# remaining space to the root partition
> > +ignoredisk --only-use=vda
> > +zerombr
> > +clearpart --none
> > +part / --fstype=ext4 --size=2048 --grow
> > +part swap --fstype=swap --size=2048

We shouldn't need 2 GiB swap - any builder that uses even a few 100 MB
of swap is doomed.  I'd give it 300 MB swap max.



> > +    virt-install \
> > +        --name "$GUEST" \
> > +        --location "$INSTALL_URL" \
> > +        --virt-type "$INSTALL_VIRT_TYPE" \
> > +        --arch "$INSTALL_ARCH" \
> > +        --machine "$INSTALL_MACHINE"  \
> > +        --vcpus "$INSTALL_VCPUS" \
> > +        --ram "$INSTALL_MEMORY_SIZE" \
> 
> Don't use --ram, that is deprecated, --memory should be used instead.
> 
> > +        --disk "size=$INSTALL_DISK_SIZE,pool=$INSTALL_STORAGE_POOL,bus=virtio" \
> > +        --network "network=$INSTALL_NETWORK,model=virtio" \
> > +        --initrd-inject "$INSTALL_CONFIG" \
> > +        --extra-args "$EXTRA_ARGS"
> 
> and we might add:
> 
>     --cpu host-passthrough  // we will not migrate the guest
>     --graphics none         // we use only ssh to the CI host
>     --serial pty            // if something is really wrong with the guest
>     --autostart


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux