Virtualisation/DEVOPS/Automatisation/Packer

De MonPtitSite
Sauter à la navigation Sauter à la recherche
Accueil SysAdmin Hobbies                  
Déployer des VMs sur un ESX via packer

Pré-requis

cf Doc Packer Builder vmware-iso


Before using a remote vSphere Hypervisor, you need to enable GuestIPHack by running the following command:

 esxcli system settings advanced set -o /Net/GuestIPHack -i 1


Exemple de fichirr de configuration Packer : Fichier de configuration Packer vmware-iso


This is the ks.cfg file I have:

# SELinux configuration
selinux --enforcing

# Installation logging level
logging --level=info


# Run the Setup Agent on first boot
firstboot --enable

 # Reboot after installation
 reboot

# System timezone
timezone --isUtc America/Los_Angeles
# Network information
network --activate --bootproto=static --device=eth0 --gateway=8.1.132.254 --netmask=255.255.255.0 --ip= 8.1.132.18 —hostname=myhost.com

# System bootloader configuration
bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda"

# Partition clearing information
zerombr
clearpart --all  --drives=sda

# Disk partitioning information
part /boot --fstype="ext4" --size=500
part pv.008002 --grow --size=1
volgroup vg_centos --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=lv_root --vgname=vg_centos --grow --size=1024 --maxsize=51200
logvol swap --name=lv_swap --vgname=vg_centos --grow --size=3072 --maxsize=3072

%packages --nobase
@^minimal
@core
kexec-tools

%end


I however keep getting this error when I run it.

=> vmware-iso: Waiting for SSH to become available... ==> vmware-iso: Timeout waiting for SSH. ==> vmware-iso: Stopping virtual machine... ==> vmware-iso: Destroying virtual machine... Build 'vmware-iso' errored: Timeout waiting for SSH.

Why do I getting this error message? Is it because my code in the ks.cfg file to connect to a static ip address correct? Any thought would be greatly appreciated.