Does that apply if there is no external DHCP server? I’ll draw a text diagram, 
and hope it’ll render okay. Are you saying that the “builder VM” (as diagrammed 
below) is forwarding the DHCP request back upstream to the cluster, in hopes of 
getting an address there?

[target VM] (whose final destination will be the cluster on the bottom)
^
^
^
[builder VM where packer runs] (this VM has to have an IP statically 
configured, as all we have is vRA’s crappy IPAM, and no DHCP)
^
^
^
[vSphere cluster w/vRealize Automation (vRA)]

From: 'Nicholas Bayle' via Packer <packer-tool@googlegroups.com>
Reply-To: "packer-tool@googlegroups.com" <packer-tool@googlegroups.com>
Date: Saturday, April 14, 2018 at 11:58 AM
To: "packer-tool@googlegroups.com" <packer-tool@googlegroups.com>
Subject: Re: [packer] Error getting SSH address

I had this issue.

The problem occurs when the host VM has permission to "monitor all traffic" on 
the parent host. The DHCP request ends up going outside the VMware host 
(despite whatever your nat/hostonly settings are) to the parent VMware 
installation or external DHCP server. You can verify this by looking at what 
subnet the VM is supposed to be on ( /etc/vmware/vmnet8/dhcpd/dhcpd.conf) and 
comparing it to the actual IP that the VM receives (VNC to the instance packer 
is building). If you go to your parent DHCP server and look at the leases, you 
will likely find your DHCP lease.


If you can figure out how to deny that traffic, it will get the correct DHCP 
server and the lease will end up in the correct file for packer.


It's all terribly confusing, so hopefully this makes sense.

Nick

On Sat, Apr 14, 2018 at 8:44 AM, Aaron Kulbe 
<aa...@longviewbits.com<mailto:aa...@longviewbits.com>> wrote:
I have been using 1.2.2, but I also checked out the latest 1.2.3-dev code, and 
still get the same issue.

Here's my sanitized KS file.



#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'

# Root password
rootpw "$1$<my password hash>" --iscrypted

# System Services
services --enabled="chronyd"
services --enabled="sshd"

# Create default user
user --name=myuser --groups=myuser,wheel
user --name=vagrant --groups=vagrant,wheel --password=vagrant

# System timezone
timezone UTC --utc
# System language
lang en_US.UTF-8
# Firewall configuration
firewall --disabled
# System authorization information
auth --enableshadow --enablemd5

# Use CDROM installation media
cdrom

# Use text mode install
text

# SELinux configuration
selinux --permissive

# Do not configure the X Window System
skipx

# Network information
network --bootproto=dhcp --device=eth0
network --hostname=localhost.localdomain

# Reboot after installation
reboot

# System bootloader configuration
bootloader --location=mbr

# Disk partitioning information
zerombr
clearpart --all --drives=sda
part /boot --fstype ext4 --size=500
part pv.00 --size=16000 --ondisk=sda
volgroup vg00 pv.00
logvol / --vgname=vg00 --fstype=xfs --size=12288 --name=lv_root
#logvol /home --vgname=vg00 --fstype=xfs --size=2048 --name=lv_home
#logvol /var/log --vgname=vg00 --fstype=xfs --size=2048 --name=lv_varlog

%packages
# Minimal RHEL install
@core
# Further minimize unneeded packages
-alsa-lib
-mariadb-libs
-parted
-aic94xx-firmware
-iwl*
-plymouth
-firewalld
# Add packages we actually need
chrony
tmux
libyaml
ncurses-libs
setools-libs
open-vm-tools
vim-enhanced
yum-utils
net-tools
wget
bzip2
unzip
mtr
nmap-ncat
strace
tcpdump
selinux-policy-devel
libselinux-utils
sssd
realmd
policycoreutils-python
samba-common-tools
krb5-workstation
setools-console
make
openssh-clients
openssh-server
%end

%post --log=/root/ks-post.log
# Register with Red Hat
/usr/sbin/subscription-manager register --org=<my org number> 
--activationkey=<my activationkey>
# Unpinning for now.
/usr/sbin/subscription-manager release --set=7.2

# add extra repos
/usr/sbin/subscription-manager repos --enable rhel-7-server-optional-rpms
/usr/sbin/subscription-manager repos --enable rhel-7-server-rh-common-rpms

# add EPEL and packages on EPEL
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
yum check-update
yum -y install facter katello-agent mailx yum-utils
yum -y erase mariadb-libs postfix ivtv-firmware emacs-filesystem fxload

# set time
ln -s /usr/share/zoneinfo/UTC /etc/localtime

# Set up regular users & keys
mkdir -p /home/myuser/.ssh/
chmod 700 /home/myuser/.ssh
curl -k http://<my web server>/myco_CD_rsa.pub -o 
/home/myuser/.ssh/authorized_keys
curl -k http://<my web server>/myco_CD_DEV_rsa.pub >> 
/home/myuser/.ssh/authorized_keys
chown -R myuser:myuser /home/myuser/.ssh/
chmod 600 /home/myuser/.ssh/authorized_keys
echo "myuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/myuser
echo "Defaults:myuser !requiretty" >> /etc/sudoers.d/myuser
chown root:root /etc/sudoers.d/myuser
chmod 440 /etc/sudoers.d/myuser

mkdir -p /home/vagrant/.ssh/
chmod 700 /home/vagrant/.ssh
curl -k http://<my web server>/myco_CD_rsa.pub -o 
/home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh/
chmod 600 /home/vagrant/.ssh/authorized_keys
echo "vagrant ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/vagrant
echo "Defaults:vagrant !requiretty" >> /etc/sudoers.d/vagrant
chown root:root /etc/sudoers.d/vagrant
chmod 440 /etc/sudoers.d/vagrant

# Set up Manifest generation
echo "export BASE_IMAGE_VERSION=1.3.0" > /etc/profile.d/baseimage.sh
chmod +x /etc/profile.d/baseimage.sh

curl -k http://<my web server>/generate_manifest.sh -o 
/home/myuser/generate_manifest.sh
chmod +x /home/myuser/generate_manifest.sh

# update everything
yum -y update

%end


On Saturday, April 14, 2018 at 4:06:49 AM UTC-7, Rickard von Essen wrote:
(Change management)... There have been some fixes around this is 1.2.1 and 
1.2.2 be sure to test it with 1.2.2.

If that doesn't solve it provide your KS file so we can comment on it.

On 14 April 2018 at 04:41, Aaron Kulbe <aa...@longviewbits.com> wrote:
The management won't let us run packer builds on vSphere yet. So we're stuck 
standing up a VM with nested virt enabled on it.

When I attempt to do a build, I get this in the log:

2018/04/14 01:01:03 packer: 2018/04/14 01:01:03 [DEBUG] Error getting SSH 
address: IP lookup failed: None of the found device(s) [vmnet8] has a DHCP 
lease for MAC 00:0c:29:81:91:5d
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 Located networkmapper 
configuration file using Workstation: /etc/vmware/netmap.conf
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 GuestIP discovered device 
matching nat: vmnet8
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 Lookup up IP information...
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 GuestAddress found MAC address 
in VMX: 00:0c:29:81:91:5d
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 Trying DHCP leases path: 
/etc/vmware/vmnet8/dhcpd/dhcpd.leases
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 IP lookup failed: None of the 
found device(s) [vmnet8] has a DHCP lease for MAC 00:0c:29:81:91:5d

(it repeats continuously)

Here is my template:

➜  build_here cat rhel72.json
{
  "builders": [
    {
      "type": "vmware-iso",
      "boot_command": [
        "<up><tab> text biosdevname=0 net.ifnames=0 
ks=hd:fd0/baseimage_130_72.cfg<enter><wait>"
      ],
      "boot_wait": "15s",
      "disk_size": "20480",
      "guest_os_type": "rhel7-64",
      "headless": true,
      "iso_urls": [
        "rhel-server-7.2-x86_64-dvd.is<http://rhel-server-7.2-x86_64-dvd.is>o"
      ],
      "floppy_files": [ "http/baseimage_130_72.cfg" ],
      "iso_checksum_type": "sha256",
      "iso_checksum": 
"03f3a0291634335f6995534d829bd21ffaa0d000004dfeb1b2fb81052d64a4d5",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_wait_timeout": "20000s",
      "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
      "tools_upload_flavor": "linux",
      "vm_name": "packer-rhel-72-x86_64",
      "vnc_port_min": "5902",
      "vnc_port_max": "5902",
      "vnc_disable_password": true,
      "network": "nat",
      "vmx_data": {
        "cpuid.coresPerSocket": "1",
        "memsize": "1024",
        "numvcpus": "1"
      }
    }
  ],
  "post-processors": [
    {
      "output": "builds/{{.Provider}}-rhel72.box",
      "type": "vagrant",
      "keep_input_artifact": true
    },
    {
      "type": "ovftool",
      "only": [
        "vmware-iso"
      ],
      "format": "ova"
    }
  ]
}
--
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/75afbb96-e1cb-4879-962f-6d2b30c32f30%40googlegroups.com<https://groups.google.com/d/msgid/packer-tool/75afbb96-e1cb-4879-962f-6d2b30c32f30%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
packer-tool+unsubscr...@googlegroups.com<mailto:packer-tool+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/da3012d7-8dfa-4827-8cda-176b8f215525%40googlegroups.com<https://groups.google.com/d/msgid/packer-tool/da3012d7-8dfa-4827-8cda-176b8f215525%40googlegroups.com?utm_medium=email&utm_source=footer>.

For more options, visit https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
packer-tool+unsubscr...@googlegroups.com<mailto:packer-tool+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAGzi4%3D50ti3dUXLc-0zz3n8G6N_r6vDRZT-sgKPOxec3oH39Ow%40mail.gmail.com<https://groups.google.com/d/msgid/packer-tool/CAGzi4%3D50ti3dUXLc-0zz3n8G6N_r6vDRZT-sgKPOxec3oH39Ow%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/AFF4642F-4FAB-49DA-8DA1-71027E49DEBF%40longviewbits.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to