joefitzgerald / packer-windows

Windows Packer Templates
MIT License
1.63k stars 1.12k forks source link

add rsync.bat on the win2012r2.json template but it fails on a vagrant rsync #152

Closed lmayorga1980 closed 9 years ago

lmayorga1980 commented 9 years ago

I've just added the rsync.bat to the provisioners list on the windows2012r2.json and it seems that after creating the box successfully rsync seems to not work.

==> rbs1: Attempting graceful shutdown of VM...
==> rbs1: Clearing any previously set forwarded ports...
==> rbs1: Clearing any previously set network interfaces...
==> rbs1: Preparing network interfaces based on configuration...
    rbs1: Adapter 1: nat
    rbs1: Adapter 2: hostonly
==> rbs1: Forwarding ports...
    rbs1: 5985 => 5985 (adapter 1)
==> rbs1: Running 'pre-boot' VM customizations...
==> rbs1: Booting VM...
==> rbs1: Waiting for machine to boot. This may take a few minutes...
    rbs1: WinRM address: 127.0.0.1:5985
    rbs1: WinRM username: _puppet
    rbs1: WinRM transport: plaintext
==> rbs1: Machine booted and ready!
==> rbs1: Checking for guest additions in VM...
==> rbs1: Setting hostname...
==> rbs1: Configuring and enabling network interfaces...
==> rbs1: Rsyncing folder: /Users/lmo0/git/rabbitmq/ => /vagrant
==> rbs1:   - Exclude: [".vagrant/", ".git/"]
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /Users/lmo0/git/rabbitmq/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group -e ssh -p 22 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i '/Users/lmo0/.vagrant.d/insecure_private_key' --exclude .vagrant/ --exclude .git/ /Users/lmo0/git/rabbitmq/ _puppet@127.0.0.1:/vagrant
Error: Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]

Vagrantfile

 config.vm.define :rbs1 do |rbs1|

    rbs1.vm.box          = 'win2012r2-virtualbox'
    rbs1.vm.communicator = "winrm"
    rbs1.winrm.username  = "_puppet"
    rbs1.ssh.username    = "_puppet"
    rbs1.vm.hostname     = 'vavd-pmo-rmq01-vagrant'
    rbs1.ssh.insert_key = false
    rbs1.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
    rbs1.vm.network   :private_network, ip: '10.11.0.100'
    rbs1.vm.provision :shell, path: 'scripts/disable-firewall.bat'
    rbs1.vm.provision :shell, path: 'scripts/add-hostfile-entries.bat'
    rbs1.vm.provision :shell, path: 'scripts/add-trusted-hosts.bat'
    rbs1.vm.provision :shell, path: 'scripts/puppet-provisioning.bat'
    #rbs1.vm.provision :puppet do |puppet|
    #  puppet.manifests_path = 'manifests'
    #  puppet.manifest_file  = 'default.pp'
    #  puppet.module_path    = 'modules'
    #  puppet.options = '--verbose --debug'
    #end
  end

I know this is not a Packer Windows issue but looking for some clues. Since my default username is NOT vagrant I had to add certain parameters to make it work. Seems like rsync is failing when using the vagrant private key...

lmayorga1980 commented 9 years ago

closed as unrelated to packer-windows