Re: [packer] Packer builder for Xenserver

2019-08-14 Thread Antony Nixson
Hello Megan,

Thanks for replying, yes i have set the environment variable PACKER_LOG=1, 
so that i can see the logs,

Thanks,

-- 
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/ffc191f6-8acb-48f0-b380-f1d4218438bb%40googlegroups.com.


Re: [packer] Using Packer to build a windows box and provision with Ansible

2019-08-14 Thread 'Richard Payne' via Packer
Yeah, the relevant directories are accessible and writable by my user.

I have managed to get it working using this:
https://www.packer.io/docs/provisioners/ansible.html

You have to create connection plugin alongside the playbook.


On Tuesday, 13 August 2019 11:45:23 UTC+1, deanwarrenuk wrote:
>
> Looks like its saying you don't have permissions to create 
> ~/.ansible/tmp/etc... 
> e.g.
> exec request: /bin/sh -c '( umask 77 && mkdir -p "` echo 
> ~/.ansible/tmp/ansible-tmp-1565678283.204747-204856165820508...
> amazon-ebs: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": 
> "Authentication or permission failure.
>
> Does the user have those permission?
>
> On Tuesday, 13 August 2019 10:09:56 UTC+1, Richard Payne wrote:
>>
>> Actually, the IP is in the standard output, not even debug.
>>
>> No idea how you're supposed to use that though.
>>
>> On Tuesday, 13 August 2019 08:37:49 UTC+1, Richard Payne wrote:
>>>
>>> I'm not seeing the IP in the log.  However, it might provide some info 
>>> on what's wrong with the Ansible provisioner?
>>>
>>>
>>> 2019/08/13 07:37:43 packer: 2019/08/13 07:37:43 [DEBUG] Password is 
>>> blank, will retry...
>>> 2019/08/13 07:37:49 ui: amazon-ebs:
>>> amazon-ebs: Password retrieved!
>>> amazon-ebs:
>>> amazon-ebs: Password retrieved!
>>> ==> amazon-ebs: Waiting for WinRM to become available...
>>> 2019/08/13 07:37:49 packer: 2019/08/13 07:37:49 Waiting for WinRM, up to 
>>> timeout: 30m0s
>>> 2019/08/13 07:37:49 ui: ==> amazon-ebs: Waiting for WinRM to become 
>>> available...
>>> 2019/08/13 07:37:54 packer: 2019/08/13 07:37:54 [INFO] Attempting WinRM 
>>> connection...
>>> 2019/08/13 07:37:54 packer: 2019/08/13 07:37:54 [DEBUG] connecting to 
>>> remote shell using WinRM
>>> 2019/08/13 07:38:01 ui: ==> amazon-ebs: Connected to WinRM!
>>> 2019/08/13 07:38:01 packer: 2019/08/13 07:38:01 Running the provision 
>>> hook
>>> ==> amazon-ebs: Connected to WinRM!
>>> 2019/08/13 07:38:01 [INFO] (telemetry) Starting provisioner ansible
>>> 2019/08/13 07:38:01 ui: ==> amazon-ebs: Provisioning with Ansible...
>>> ==> amazon-ebs: Provisioning with Ansible...
>>> 2019/08/13 07:38:02 packer: 2019/08/13 07:38:02 SSH proxy: serving on 
>>> 127.0.0.1:36005
>>> 2019/08/13 07:38:02 ui: ==> amazon-ebs: Executing Ansible: 
>>> ansible-playbook --extra-vars packer_build_name=amazon-ebs 
>>> packer_builder_type=amazon-ebs -i /tmp/packer-provisioner-ansible774557480 
>>> /home/richard/git/ansible/playbooks/windows_image_build/playbook.yml 
>>> --private-key /tmp/ansible-key713730989 --extra-vars {'environment_name': 
>>> 'packer', 'hosting_environment': 'aws', 'connection': 'packer'} --skip-tags 
>>> gitchecks --skip-tags gather_facts --skip-tags slack
>>> ==> amazon-ebs: Executing Ansible: ansible-playbook --extra-vars 
>>> packer_build_name=amazon-ebs packer_builder_type=amazon-ebs -i 
>>> /tmp/packer-provisioner-ansible774557480 
>>> /home/richard/git/ansible/playbooks/windows_image_build/playbook.yml 
>>> --private-key /tmp/ansible-key713730989 --extra-vars {'environment_name': 
>>> 'packer', 'hosting_environment': 'aws', 'connection': 'packer'} --skip-tags 
>>> gitchecks --skip-tags gather_facts --skip-tags slack
>>> 2019/08/13 07:38:03 ui: amazon-ebs:  [WARNING]: Found variable using 
>>> reserved name: connection
>>> amazon-ebs:  [WARNING]: Found variable using reserved name: 
>>> connection
>>> amazon-ebs:
>>> 2019/08/13 07:38:03 ui: amazon-ebs:
>>> 2019/08/13 07:38:03 ui: amazon-ebs: PLAY [all] 
>>> *
>>> amazon-ebs: PLAY [all] 
>>> *
>>> 2019/08/13 07:38:03 ui: amazon-ebs:
>>> amazon-ebs:
>>> 2019/08/13 07:38:03 ui: amazon-ebs: TASK [Gathering Facts] 
>>> *
>>> amazon-ebs: TASK [Gathering Facts] 
>>> *
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 SSH proxy: accepted 
>>> connection
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 authentication attempt 
>>> from 127.0.0.1:41696 to 127.0.0.1:36005 as richard using none
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 authentication attempt 
>>> from 127.0.0.1:41696 to 127.0.0.1:36005 as richard using publickey
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new env request: 
>>> LANG=en_GB.UTF-8
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 new exec request: 
>>> /bin/sh -c 'echo ~richard && sleep 0'
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] starting remote 
>>> command: /bin/sh -c 'echo ~richard && sleep 0'
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] command '/bin/sh 
>>> -c 'echo ~richard && sleep 0'' exited with code: 1
>>> 2019/08/13 07:38:03 packer: 2019/08/13 07:38:03 [INFO] RPC endpoint: 
>>> Communicator ended with: 1
>>> 2019/08/13 07:38:03 [INFO] 0 bytes written 

Re: [packer] Windows2016 guest on RHEL linux host never ending winrm loop

2019-08-14 Thread Automationbuilder360 Builder
Hi All,

Any help on this much appreciated..!
I have also tried with base image provided by MS, but still the VBOX 
crashed on windows host

On Tuesday, 13 August 2019 19:55:47 UTC+5:30, Automationbuilder360 Builder 
wrote:
>
> Yes..! when i try to boot VBOX VM with the ISO the server crashes again.. 
> ( When on windows host )
> but when on RHEL host ( The VM gets crated but waits on winrm endless )..!
>
>
> BTW, this ISO runs just find on VMWARE environment.
> it is customized such a way that it will not wait for any input and 
> completes the whole installation.
>
>
> On Tuesday, 13 August 2019 19:45:49 UTC+5:30, Rickard von Essen wrote:
>>
>> Can you run and install windows manually in virtualbox? Seem like you 
>> have problems with that? 
>>
>> On Tue, Aug 13, 2019, 15:49 Automationbuilder360 Builder <
>> automation...@gmail.com> wrote:
>>
>>> Hi Rickard,
>>>
>>> To verify the "headless Flase" mode i tried this on windows 2016 host VM 
>>> as well.
>>> but as soon i attach the iso the VM gets crashed with no updates.
>>>
>>> BTW "--on-error=ask" was not of much help. as it never asked for any 
>>> input.
>>>
>>> and the last few lines of output from VBOX.log is here.
>>>
>>> 00:00:00.394503 *** End of VT-x features 
>>> 
>>> 00:00:00.396851 PcBios: ATA LUN#0 LCHS=1024/255/63
>>> 00:00:00.396924 APIC: fPostedIntrsEnabled=false 
>>> fVirtApicRegsEnabled=false fSupportsTscDeadline=false
>>> 00:00:00.396933 TMR3UtcNow: nsNow=1 565 703 281 470 031 000 nsPrev=0 -> 
>>> cNsDelta=1 565 703 281 470 031 000 (offLag=0 offVirtualSync=0 
>>> offVirtualSyncGivenUp=0, NowAgain=1 565 703 281 470 031 000)
>>> 00:00:00.396945 VMEmt: Halt method global1 (5)
>>> 00:00:00.396986 VMEmt: HaltedGlobal1 config: 
>>> cNsSpinBlockThresholdCfg=2000
>>> 00:00:00.397019 Changing the VM state from 'CREATING' to 'CREATED'
>>> 00:00:00.403717 Changing the VM state from 'CREATED' to 'POWERING_ON'
>>> 00:00:00.404306 Changing the VM state from 'POWERING_ON' to 'RUNNING'
>>> 00:00:00.404319 Console: Machine state changed to 'Running'
>>> 00:00:00.410651 VMMDev: Guest Log: BIOS: VirtualBox 6.0.4
>>> 00:00:00.410980 PCI: Setting up resources and interrupts
>>> 00:00:00.411473 PIT: mode=2 count=0x1 (65536) - 18.20 Hz (ch=0)
>>> 00:00:00.433895 Display::handleDisplayResize: uScreenId=0 
>>> pvVRAM= w=720 h=400 bpp=0 cbLine=0x0 flags=0x0
>>> 00:00:00.452285 VMMDev: Guest Log: CPUID EDX: 0x178bfbff
>>> 00:00:00.452554 PIIX3 ATA: Ctl#0: RESET, DevSel=0 AIOIf=0 CmdIf0=0x00 
>>> (-1 usec ago) CmdIf1=0x00 (-1 usec ago)
>>> 00:00:00.452664 PIIX3 ATA: Ctl#0: finished processing RESET
>>> 00:00:00.456064 VMMDev: Guest Log: BIOS: ata0-0: PCHS=16383/16/63 
>>> LCHS=1024/255/63
>>> 00:00:00.460933 PIIX3 ATA: Ctl#0: RESET, DevSel=1 AIOIf=0 CmdIf0=0xec 
>>> (-1 usec ago) CmdIf1=0x00 (-1 usec ago)
>>> 00:00:00.461049 PIIX3 ATA: Ctl#0: finished processing RESET
>>> 00:00:00.506867 PIT: mode=2 count=0x48d3 (18643) - 64.00 Hz (ch=0)
>>> 00:00:00.510412 Display::handleDisplayResize: uScreenId=0 
>>> pvVRAM=7f0d4996c000 w=640 h=480 bpp=32 cbLine=0xA00 flags=0x0
>>> 00:00:02.997497 Display::handleDisplayResize: uScreenId=0 
>>> pvVRAM= w=720 h=400 bpp=0 cbLine=0x0 flags=0x0
>>> 00:00:03.005835 PIT: mode=2 count=0x1 (65536) - 18.20 Hz (ch=0)
>>> 00:00:03.008104 VMMDev: Guest Log: BIOS: Boot : bseqnr=1, bootseq=0032
>>> 00:00:03.010321 VMMDev: Guest Log: BIOS: Boot from Hard Disk 0 failed
>>> 00:00:03.011968 VMMDev: Guest Log: BIOS: Boot : bseqnr=2, bootseq=0003
>>> 00:00:03.015036 VMMDev: Guest Log: BIOS: Booting from CD-ROM...
>>> 00:00:03.450411 Display::handleDisplayResize: uScreenId=0 
>>> pvVRAM=7f0d4996c000 w=1024 h=768 bpp=24 cbLine=0xC00 flags=0x0
>>> 00:00:07.035679 VMMDev: Guest Log: BIOS: int13_diskette_function: 
>>> unsupported AH=41
>>> 00:00:09.319618 RTC: period=0x10 (16) 2048 Hz
>>> 00:00:15.441594 NAT: Old socket recv size: 128KB
>>> 00:00:15.441620 NAT: Old socket send size: 128KB
>>> 00:00:22.650511 Display::handleDisplayResize: uScreenId=0 
>>> pvVRAM=7f0d4996c000 w=1024 h=768 bpp=32 cbLine=0x1000 flags=0x0
>>> 00:00:31.379280 NAT: Link up
>>> 00:00:31.413775 NAT: resolv.conf: nameserver 10.xXX.XXX.21
>>> 00:00:31.413797 NAT: resolv.conf: nameserver 10.XX.XXX.21
>>> 00:00:31.413840 NAT: DNS#0: 10.XXX.XXX.21
>>> 00:00:31.413847 NAT: DNS#1: 10.XXX.XXX.21
>>> 00:00:31.413853 NAT: DHCP offered IP address 10.0.2.15
>>> 00:00:31.415524 NAT: DHCP offered IP address 10.0.2.15
>>> 00:00:31.447769 NAT: IPv6 not supported
>>>
>>>
>>>
>>>
>>> On Tuesday, 13 August 2019 18:24:59 UTC+5:30, Rickard von Essen wrote:

 Run with headless false, add flag --on-error=ask when this fails use 
 the console and debug the winrm setup from the inside or check the status 
 of the installation. 

 On Tue, Aug 13, 2019, 13:11 Automationbuilder360 Builder <
 automation...@gmail.com> wrote:

> Hi All,
>
> Am new to Packer, am trying to 

[packer] Packer v1.4.3 is released!

2019-08-14 Thread Megan Marsh
Hi Packer community!

Packer 1.4.3 is finally out, and it's a big one!

We have:
- FOUR new builders -- Ucloud, Outscale, JDCloud, and Virtualbox Snapshot.
- a new Exoscale import post-processor.
- dozens of bugfixes, including a fix for an Azure crash that was 
introduced in 1.4.2, and a fix to several buggy behaviors in Amazon image 
region copy and encryption.
- Dramatically reduced Vmware CPU usage for certain builds by cleaning up 
leaked file handles

And much, much more. It's a pretty big release, so I recommend that you 
take a look at our changelog 

 
for further details.

As always, reach out if you have any Packer-related needs.

Thanks!
Megan

-- 
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/e1d601db-6f4b-4e82-8491-1f7255b98edd%40googlegroups.com.


[packer] Re: Trouble with sshd_config with packer + virtualbox + vagrant

2019-08-14 Thread Stephen Schlie
As it turns out I'm a complete moron, our setup for Vagrant has a file that 
overrides some settings, and I missed that it was overriding which box to 
use, once set correctly things are working just fine. While I'm upset about 
being a moron I'm happy I'm not insane.

On Wednesday, August 14, 2019 at 10:19:19 AM UTC-7, Stephen Schlie wrote:
>
> Hi Folks,
>
> I've run into an issue recently with packer where my output vagrant box 
> has password based ssh disabled by default, even when I explicitly enable 
> it in the last provisioner step. I'll include the template json below but 
> in short we build an ubuntu 18.04.3 image with the virtualbox-iso builder, 
> run a couple of scripts to setup things, and output the box.
>
> This was working until recently, I went and updated our setup to start 
> building amis too, and the vagrant VMs stopped working. I tried rolling 
> most of it back to see if it helped but I am still seeing this issue.
>
> template:
>
>   "_comment": "This file managed by salt. Local changes will be 
> overwritten.",
>   "builders": [
> {
>   "vm_name": "{{user `vmname`}}",
>   "type": "virtualbox-iso",
>   "headless": true,
>   "vrdp_bind_address": "0.0.0.0",
>   "guest_os_type": "Ubuntu_64",
>   "iso_url": "http://{{user `webserver`}}/{{user `os_file`}}.iso",
>   "iso_checksum_url": "{{user `iso_checksum`}}",
>   "iso_checksum_type": "file",
>   "ssh_username": "packer",
>   "ssh_password": "packer",
>   "ssh_wait_timeout": "15m",
>   "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
>   "disk_size": "3",
>   "hard_drive_interface": "sata",
>   "vboxmanage": [
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--boot1",
>   "dvd"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--boot2",
>   "disk"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--nictype1",
>   "virtio"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--memory",
>   "2048"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--cpus",
>   "4"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--audio",
>   "none"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--usb",
>   "off"
> ]
>   ],
>   "boot_command": [
> "",
> "/install/vmlinuz noapic ",
> "preseed/url=http://{{user `webserver`}}/{{user `os_file`}}.cfg ",
> "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
> "hostname={{user `vmname`}} ",
> "fb=false debconf/frontend=noninteractive ",
> "keyboard-configuration/modelcode=SKIP 
> keyboard-configuration/layout=USA ",
> "keyboard-configuration/variant=USA 
> console-setup/ask_detect=false ",
> "DEBCONF=debug ",
> "initrd=/install/initrd.gz -- "
>   ],
>   "output_directory": "vbox/"
> },
> {
>   "type": "amazon-ebs",
>   "access_key": "{{ user `access_key` }}",
>   "secret_key": "{{ user `secret_key` }}",
>   "ami_users": [
> "",
> ""
>   ],
>   "region": "us-east-1",
>   "source_ami_filter": {
> "filters": {
>   "name": 
> "ubuntu/images/hvm-ssd/*ubuntu-bionic-18.04-amd64-server-*",
>   "root-device-type": "ebs"
> },
> "owners": ["099720109477"],
> "most_recent": true
>   },
>   "vpc_id": "vpc-04ee3040de35bc755",
>   "subnet_id": "subnet-05b0e1ad8679eb394",
>   "instance_type": "t3.micro",
>   "ssh_username": "ubuntu",
>   "ami_name": "{{user `vmname`}}-{{user `salt_environment`}}-{{ user 
> `commit` }}",
>   "spot_price": "0.0104",
>   "run_tags": {
> "application": "packer"
>   }
> }
>   ],
>   "provisioners": [
> {
>   "type": "file",
>   "source": "upload/",
>   "destination": "/tmp"
> },
> {
>   "type": "shell",
>   "inline": [
> "/usr/bin/cloud-init status --wait"
>   ],
>   "only": ["amazon-ebs"]
> },
> {
>   "type": "shell",
>   "scripts": [
> "/etc/vmimage/init.sh"
>   ],
>   "environment_vars": [
> "SALT_ENVIRONMENT={{user `salt_environment`}}",
> "SALT_VERSION={{user `salt_version`}}",
> "SLS_STATES={{user `sls_states`}}"
>   ]
> },
> {
>   "type": "shell",
>   "inline": [
> "sudo mount /home/packer/VBoxGuestAdditions.iso /mnt",
> "sudo sh /mnt/VBoxLinuxAdditions.run || true",
> "sudo umount /mnt",
> "sudo dmidecode -s system-product-name > /home/packer/vmtype"
>   ],
>   "only": ["virtualbox-iso"]
> },
> {
>   "type": "shell",
>   "inline": [
> "sudo sed -i 

[packer] InSpec breaking Packer build

2019-08-14 Thread Stephen Bennett
Hi,

Trying to add Inspec tests to my packer build, if i take out the inspec
provisioner this runs (Attached packer json). Any ideas whats going on?

InSpec code:

{
  "type": "inspec",
  "profile": "https://github.com/dev-sec/windows-patch-baseline;,
  "extra_arguments": [ "--chef-license", "accept", "--reporter",
"json:output.json"]
}

-- 
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/CAJemxzMVZ%2BXmsX7sS23nqxVN-%2B6fLchrvXaXXJ3diQQ8b%3DupwQ%40mail.gmail.com.


aws-windows-2016-base.json
Description: application/json


[packer] Trouble with sshd_config with packer + virtualbox + vagrant

2019-08-14 Thread Stephen Schlie
Hi Folks,

I've run into an issue recently with packer where my output vagrant box has 
password based ssh disabled by default, even when I explicitly enable it in 
the last provisioner step. I'll include the template json below but in 
short we build an ubuntu 18.04.3 image with the virtualbox-iso builder, run 
a couple of scripts to setup things, and output the box.

This was working until recently, I went and updated our setup to start 
building amis too, and the vagrant VMs stopped working. I tried rolling 
most of it back to see if it helped but I am still seeing this issue.

template:

  "_comment": "This file managed by salt. Local changes will be 
overwritten.",
  "builders": [
{
  "vm_name": "{{user `vmname`}}",
  "type": "virtualbox-iso",
  "headless": true,
  "vrdp_bind_address": "0.0.0.0",
  "guest_os_type": "Ubuntu_64",
  "iso_url": "http://{{user `webserver`}}/{{user `os_file`}}.iso",
  "iso_checksum_url": "{{user `iso_checksum`}}",
  "iso_checksum_type": "file",
  "ssh_username": "packer",
  "ssh_password": "packer",
  "ssh_wait_timeout": "15m",
  "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
  "disk_size": "3",
  "hard_drive_interface": "sata",
  "vboxmanage": [
[
  "modifyvm",
  "{{.Name}}",
  "--boot1",
  "dvd"
],
[
  "modifyvm",
  "{{.Name}}",
  "--boot2",
  "disk"
],
[
  "modifyvm",
  "{{.Name}}",
  "--nictype1",
  "virtio"
],
[
  "modifyvm",
  "{{.Name}}",
  "--memory",
  "2048"
],
[
  "modifyvm",
  "{{.Name}}",
  "--cpus",
  "4"
],
[
  "modifyvm",
  "{{.Name}}",
  "--audio",
  "none"
],
[
  "modifyvm",
  "{{.Name}}",
  "--usb",
  "off"
]
  ],
  "boot_command": [
"",
"/install/vmlinuz noapic ",
"preseed/url=http://{{user `webserver`}}/{{user `os_file`}}.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{user `vmname`}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP 
keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false "
,
"DEBCONF=debug ",
"initrd=/install/initrd.gz -- "
  ],
  "output_directory": "vbox/"
},
{
  "type": "amazon-ebs",
  "access_key": "{{ user `access_key` }}",
  "secret_key": "{{ user `secret_key` }}",
  "ami_users": [
"",
""
  ],
  "region": "us-east-1",
  "source_ami_filter": {
"filters": {
  "name": 
"ubuntu/images/hvm-ssd/*ubuntu-bionic-18.04-amd64-server-*",
  "root-device-type": "ebs"
},
"owners": ["099720109477"],
"most_recent": true
  },
  "vpc_id": "vpc-04ee3040de35bc755",
  "subnet_id": "subnet-05b0e1ad8679eb394",
  "instance_type": "t3.micro",
  "ssh_username": "ubuntu",
  "ami_name": "{{user `vmname`}}-{{user `salt_environment`}}-{{ user 
`commit` }}",
  "spot_price": "0.0104",
  "run_tags": {
"application": "packer"
  }
}
  ],
  "provisioners": [
{
  "type": "file",
  "source": "upload/",
  "destination": "/tmp"
},
{
  "type": "shell",
  "inline": [
"/usr/bin/cloud-init status --wait"
  ],
  "only": ["amazon-ebs"]
},
{
  "type": "shell",
  "scripts": [
"/etc/vmimage/init.sh"
  ],
  "environment_vars": [
"SALT_ENVIRONMENT={{user `salt_environment`}}",
"SALT_VERSION={{user `salt_version`}}",
"SLS_STATES={{user `sls_states`}}"
  ]
},
{
  "type": "shell",
  "inline": [
"sudo mount /home/packer/VBoxGuestAdditions.iso /mnt",
"sudo sh /mnt/VBoxLinuxAdditions.run || true",
"sudo umount /mnt",
"sudo dmidecode -s system-product-name > /home/packer/vmtype"
  ],
  "only": ["virtualbox-iso"]
},
{
  "type": "shell",
  "inline": [
"sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication 
yes/' /etc/ssh/sshd_config",
"sudo cat /etc/ssh/sshd_config"
  ],
  "only": ["virtualbox-iso"]
 }
  ],
  "post-processors": [
{
  "type": "vagrant",
  "output": "plos_{{.Provider}}_{{user `commit`}}_{{isotime 
\"2006-01-02-150405\"}}.box",
  "keep_input_artifact": true,
  "only": ["virtualbox-iso"]
}
  ]
}

The init.sh script just installs some packages and sets up salt to run. 
Then the final step is to flip that sshd config setting so we can login the 
first time to set things up in Vagrant. You can see I was cat'ing out the 
file to be sure it was getting changed, and it 

Re: [packer] Trouble with sshd_config with packer + virtualbox + vagrant

2019-08-14 Thread Rickard von Essen
One guess would be that cloud-init might do this.

On Wed, Aug 14, 2019, 19:19 Stephen Schlie  wrote:

> Hi Folks,
>
> I've run into an issue recently with packer where my output vagrant box
> has password based ssh disabled by default, even when I explicitly enable
> it in the last provisioner step. I'll include the template json below but
> in short we build an ubuntu 18.04.3 image with the virtualbox-iso builder,
> run a couple of scripts to setup things, and output the box.
>
> This was working until recently, I went and updated our setup to start
> building amis too, and the vagrant VMs stopped working. I tried rolling
> most of it back to see if it helped but I am still seeing this issue.
>
> template:
>
>   "_comment": "This file managed by salt. Local changes will be
> overwritten.",
>   "builders": [
> {
>   "vm_name": "{{user `vmname`}}",
>   "type": "virtualbox-iso",
>   "headless": true,
>   "vrdp_bind_address": "0.0.0.0",
>   "guest_os_type": "Ubuntu_64",
>   "iso_url": "http://{{user `webserver`}}/{{user `os_file`}}.iso",
>   "iso_checksum_url": "{{user `iso_checksum`}}",
>   "iso_checksum_type": "file",
>   "ssh_username": "packer",
>   "ssh_password": "packer",
>   "ssh_wait_timeout": "15m",
>   "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
>   "disk_size": "3",
>   "hard_drive_interface": "sata",
>   "vboxmanage": [
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--boot1",
>   "dvd"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--boot2",
>   "disk"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--nictype1",
>   "virtio"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--memory",
>   "2048"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--cpus",
>   "4"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--audio",
>   "none"
> ],
> [
>   "modifyvm",
>   "{{.Name}}",
>   "--usb",
>   "off"
> ]
>   ],
>   "boot_command": [
> "",
> "/install/vmlinuz noapic ",
> "preseed/url=http://{{user `webserver`}}/{{user `os_file`}}.cfg ",
> "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
> "hostname={{user `vmname`}} ",
> "fb=false debconf/frontend=noninteractive ",
> "keyboard-configuration/modelcode=SKIP
> keyboard-configuration/layout=USA ",
> "keyboard-configuration/variant=USA
> console-setup/ask_detect=false ",
> "DEBCONF=debug ",
> "initrd=/install/initrd.gz -- "
>   ],
>   "output_directory": "vbox/"
> },
> {
>   "type": "amazon-ebs",
>   "access_key": "{{ user `access_key` }}",
>   "secret_key": "{{ user `secret_key` }}",
>   "ami_users": [
> "",
> ""
>   ],
>   "region": "us-east-1",
>   "source_ami_filter": {
> "filters": {
>   "name":
> "ubuntu/images/hvm-ssd/*ubuntu-bionic-18.04-amd64-server-*",
>   "root-device-type": "ebs"
> },
> "owners": ["099720109477"],
> "most_recent": true
>   },
>   "vpc_id": "vpc-04ee3040de35bc755",
>   "subnet_id": "subnet-05b0e1ad8679eb394",
>   "instance_type": "t3.micro",
>   "ssh_username": "ubuntu",
>   "ami_name": "{{user `vmname`}}-{{user `salt_environment`}}-{{ user
> `commit` }}",
>   "spot_price": "0.0104",
>   "run_tags": {
> "application": "packer"
>   }
> }
>   ],
>   "provisioners": [
> {
>   "type": "file",
>   "source": "upload/",
>   "destination": "/tmp"
> },
> {
>   "type": "shell",
>   "inline": [
> "/usr/bin/cloud-init status --wait"
>   ],
>   "only": ["amazon-ebs"]
> },
> {
>   "type": "shell",
>   "scripts": [
> "/etc/vmimage/init.sh"
>   ],
>   "environment_vars": [
> "SALT_ENVIRONMENT={{user `salt_environment`}}",
> "SALT_VERSION={{user `salt_version`}}",
> "SLS_STATES={{user `sls_states`}}"
>   ]
> },
> {
>   "type": "shell",
>   "inline": [
> "sudo mount /home/packer/VBoxGuestAdditions.iso /mnt",
> "sudo sh /mnt/VBoxLinuxAdditions.run || true",
> "sudo umount /mnt",
> "sudo dmidecode -s system-product-name > /home/packer/vmtype"
>   ],
>   "only": ["virtualbox-iso"]
> },
> {
>   "type": "shell",
>   "inline": [
> "sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication
> yes/' /etc/ssh/sshd_config",
> "sudo cat /etc/ssh/sshd_config"
>   ],
>   "only": ["virtualbox-iso"]
>  }
>   ],
>   "post-processors": [
> {
>   "type": "vagrant",
>   "output": 

Re: [packer] Trouble with sshd_config with packer + virtualbox + vagrant

2019-08-14 Thread Stephen Schlie
I had thought the same but cloud-init does not seem to be installed on the 
18.04.3 server image 
(http://cdimage.ubuntu.com/ubuntu/releases/bionic/release/ubuntu-18.04.3-server-amd64.iso)
 
so I'm reasonably confident that isn't it, unless cloud-init is sneakily on 
there somehow but not showing? I don't see it's dirs in `/etc/cloud` or in 
`/var/lib/cloud` nor does it show in `apt list --installed`.

On Wednesday, August 14, 2019 at 10:55:47 AM UTC-7, Rickard von Essen wrote:
>
> One guess would be that cloud-init might do this. 
>
>
>

-- 
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/bcf789a6-3090-4e23-8c45-b0a4ef8889a9%40googlegroups.com.