Hello Guru's,
I am new to DevOps and packer. I got small code (see below) to build in
"virtual Box" but nothing for VM Ware. Bottom is "ks.cfg" file
Any suggestion or help is very much appreciate and this code fails on with
following error.
?[1;32m==> virtualbox-iso: Waiting for SSH to become available...?[0m
>
> ?[1;31m==> virtualbox-iso: Error waiting for SSH: ssh: handshake failed:
>> ssh: unable to authenticate, attempted methods [none password], no supported
>
> methods remain?[0m
>
> ?[1;32m==> virtualbox-iso: Deregistering and deleting VM...?[0m
>
> ?[1;32m==> virtualbox-iso: Deleting output directory...?[0m
>
> ?[1;31mBuild 'virtualbox-iso' errored: ssh: handshake failed: ssh: unable
>> to authenticate, attempted methods [none password], no supported methods
>> remain?[0m
>
> ==> Some builds didn't complete successfully and had errors:
>>
> --> virtualbox-iso: ssh: handshake failed: ssh: unable to authenticate,
>> attempted methods [none password], no supported methods remain
>
> ==> Builds finished but no artifacts were created.
>>
>
>
{
"builders": [
{
"type": "virtualbox-iso",
"guest_os_type": "RedHat_64",
"iso_url":
"http://mirrors.liquidweb.com/CentOS/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso"
,
"iso_checksum":
"6d44331cc4f6c506c7bbe9feb8468fad6c51a88ca1393ca6b8b486ea04bec3c1",
"iso_checksum_type": "sha256",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_wait_timeout": "1500s",
"boot_command": [
"<esc>",
"<wait>linux inst.ks=hd:/dev/fd0:ks.cfg<enter>"
],
"boot_wait": "5s",
"disk_size": 10000,
"floppy_files": [
"ks.cfg"
],
"hard_drive_interface": "sata",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"1024"
]
]
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 30",
"sudo mkdir /media/VBoxGuestAdditions",
"sudo mount -o loop,ro /home/packer/VBoxGuestAdditions.iso
/media/VBoxGuestAdditions",
"sudo /bin/sh
/media/VBoxGuestAdditions/VBoxLinuxAdditions.run",
"sudo umount /media/VBoxGuestAdditions",
"sudo rmdir /media/VBoxGuestAdditions"
]
}
],
"post-processors": []
}
install
cdrom
cmdline
lang en_US.UTF-8
keyboard us
timezone Pacific/Honolulu
auth --useshadow --enablemd5
firewall --enabled --ssh --http
services --enabled=NetworkManager,sshd
eula --agreed
ignoredisk --only-use=sda
reboot
network --bootproto=dhcp --device=enp0s3 --onboot=on --hostname=[YOUR
HOSTNAME HERE]
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part swap --asprimary --fstype="swap" --size=1024
part /boot --fstype xfs --size=200
part pv.01 --size=1 --grow
volgroup rootvg01 pv.01
logvol / --fstype xfs --name=lv01 --vgname=rootvg01 --size=1 --grow
rootpw --iscrypted password
user --name=packer --iscrypted --password=packer
repo --name=base --baseurl=http:
//mirrors.liquidweb.com/CentOS/7.6.1810/isos/x86_64/
%packages --nobase --ignoremissing
@core
epel-release
dkms
kernel-devel
kernel-headers
make
automake
openssh-clients
gcc
gcc-c++
bzip2
%end
%post
SUDOERS_FILE=sudoers
SSHD_CONFIG=sshd_config
cp /etc/${SUDOERS_FILE}{,.bak}
(
SUDOERS_FILE=sudoers
sed 's/^Defaults[[:space:]]\+requiretty/Defaults !requiretty/'
/etc/${SUDOERS_FILE} > /tmp/${SUDOERS_FILE}
mv /tmp/${SUDOERS_FILE} /etc/${SUDOERS_FILE}
sed 's/^Defaults[[:space:]]\+!visiblepw/Defaults visiblepw/'
/etc/${SUDOERS_FILE} > /tmp/${SUDOERS_FILE}
mv /tmp/${SUDOERS_FILE} /etc/${SUDOERS_FILE}
)
chown root:root /etc/${SUDOERS_FILE}
chmod 0660 /etc/${SUDOERS_FILE}
echo "packer ALL = (ALL) NOPASSWD: ALL" >> /etc/${SUDOERS_FILE}
(
mkdir /home/packer/.ssh
chmod 0700 /home/packer/.ssh
cd /home/packer/.ssh
echo "ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==
packer insecure public key" > authorized_keys
chmod 0600 authorized_keys
chown packer:packer authorized_keys
cd /home/packer
chown packer:packer /home/packer/.ssh
)
(
SSHD_CONFIG=sshd_config
sed 's/^[[:space:]]*#*UseDNS[[:space:]]\+yes/UseDNS no/'
/etc/ssh/${SSHD_CONFIG} > /tmp/${SSHD_CONFIG}
mv /tmp${SSHD_CONFIG} /etc/ssh/${SSHD_CONFIG}
sed
's/^[[:space:]]*#*PasswordAuthentication[[:space:]]\+no/PasswordAuthentication
yes/' /etc/ssh/${SSHD_CONFIG} >> /tmp/${SSHD_CONFIG}
mv /tmp${SSHD_CONFIG} /etc/ssh/${SSHD_CONFIG}
)
chown root:root /etc/ssh/${SSHD_CONFIG}
chmod 0600 /etc/ssh/${SSHD_CONFIG}
%end
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/6084e833-4307-474f-b0cc-dd5ea55ff9c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.