On Sun, May 10, 2020 at 7:29 AM Kaushal Shriyan
<kaushalshri...@gmail.com> 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


Reply via email to