Hi.
I am trying to run fairly simple vagrant bootstrup, that have to create
aws windows machine and run their test chef_solo cookbook. Cookbook is
"hello world" style (it simply performs touch of file - simply to give
indication, that chef actually worked).
require File.expand_path('aws/aws_credentials.rb')
Vagrant.configure("2") do |config|
config.vm.guest = :windows
config.vm.communicator = :winrm
config.vm.synced_folder ".", "/vagrant", type: "winrm", :disabled => true
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
config.vm.box = "dummy"
# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "maypass"
#config.winrm.password = "vagrant"
config.nfs.functional = false
config.vm.provider :aws do |aws, override|
aws.user_data = File.read("aws/Setup.txt")
aws.tags = {
'Name' => @aws_machine_name,
}
aws.access_key_id=@access_key_id
aws.secret_access_key=@secret_access_key
aws.keypair_name=@keypair_name
aws.ami=@ami
aws.region=@region
aws.instance_type=@instance_type
#aws.security_groups= [ @security_groups ]
end
config.vm.provision :chef_solo do |chef|
chef.synced_folder_type = "winrm"
chef.add_recipe("Control-M::touch_file")
#chef.add_recipe("vim-windows")
end
end
Now - I face really ministerial mess.
First of all I had to create precooked base windows image at which I
pre-installed chef client, since at windows vagrant function
"chef_install simply do not works...
But after I did it began really strange mess.
When I run vagrant with those job from Linux machine (Redhat) - it works.
When I run same job with same vagrant file from windows machine(that
means - I installed vagrant at my windows desktop and run it with those
vagratfile from there) - I get:
==> default: Uploading with WinRM: C:/DevOps/cookbooks => C:/vagrant-chef/353b41
3e9c77f16b0448c1300d9ab1e0/cookbooks
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: Exception calling "Run" with "1" argument(s): "Element not found. (
Exception
==> default: from HRESULT: 0x80070490)"
==> default: At C:\tmp\vagrant-elevated-shell.ps1:61 char:1
==> default: + $registered_task.Run($null) | Out-Null
==> default: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> default: + CategoryInfo : NotSpecified: (:) [], MethodInvocatio
nException
==> default: + FullyQualifiedErrorId : ComMethodTargetInvocation
==> default:
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
I have tried it number of times. From my local desctop and from windows virtual machine that intself runs at aws... Always same result!