Re: virt-install command line provide additional parameters. Automating KVM VM creation using automation tool

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

 



On Sun, May 10, 2020 at 7:29 AM Kaushal Shriyan
<kaushalshriyan@xxxxxxxxx> wrote:
>
> Hi,
>
> I am running the below command to spawn the KVM based VM instance.
>
> #virt-install --name=openmonitoringdistributionlabs --file=/linuxkvmguestosdisk/var/lib/libvirt/images/openmonitoringdistributionlabs.img --file-size=100 --nonsparse --vcpu=2 --ram=6096 --network=bridge:br0 --os-type=linux --os-variant=rhel7 --graphics none --location=/linuxkvmguestosdisk/var/lib/libvirt/isos/CentOS-7-x86_64-DVD-2003.iso --extra-args="console=ttyS0"
> Is there a way to provide the below settings in the command line instead of manually setting 2) Time settings 3) Installation source 4) Software selection 5) Installation Destination 8) Root password 9) User creation?
>
> Installation
>
>  1) [x] Language settings                 2) [!] Time settings
>         (English (United States))                (Timezone is not set.)
>  3) [!] Installation source               4) [!] Software selection
>         (Processing...)                          (Processing...)
>  5) [!] Installation Destination          6) [x] Kdump
>         (No disks selected)                      (Kdump is enabled)
>  7) [ ] Network configuration             8) [!] Root password
>         (Not connected)                          (Password is not set.)
>  9) [!] User creation
>         (No user will be created)
>   Please make your choice from above ['q' to quit | 'b' to begin installation |
>   'r' to refresh]:
>
> Is there a way to automate KVM VM instance creation as per the above virt-install command using Ansible for example or any automation tool?  Please suggest. Thanks in advance and i look forward to hearing from you.
>
> Best Regards,
>
> Kaushal
>

No. For that you can create your own kickstart file and pass it via
command line as described here:

# virt-install \
  --name guest1-rhel7 \
  --memory 2048 \
  --vcpus 2 \
  --disk size=8 \
  --location http://example.com/path/to/os \
  --os-variant rhel7 \
  --initrd-inject /path/to/ks.cfg \
  --extra-args="ks=file:/ks.cfg console=tty0 console=ttyS0,115200n8"

Or, if you have a new enough version of virt-install, you can use:
# virt-install --install centos7.0 --unattended
profile={desktop|jeos),admin-password-file=/path/to/admin/password/file,user-password-file=/path/to/user/password/file

This second option will rely on the libosinfo project to get the
optimal values for memory, vcpus, disk size, os-variant, etc.

Best Regards,
-- 
Fabiano Fidêncio





[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux