Bootstrap windows ec2 using chef-provisioning


#1

Hi All

I’m currently trying to bootstrap an EC2 instance via chef-provisioning. I’m specifying the correct username and password in my machine options for that AMI, however, I receive the following:-

RuntimeError
------------
You did not specify winrm_password in the machine options and no encrytpted password could be fetched from the instance

So it’s look as though the options aren’t even getting picked up.

Here’s what my recipe looks like.

require ‘chef/provisioning/aws_driver’

with_driver ‘aws’

     machine "console-test" do
        machine_options :is_windows => true,
          :ssh_username => "Administrator",
          :ssh_password => "xxxxxxxx",
        transport_address_location: :private_ip,
      aws_tags: {:'Hostname' => "console-test"},
       :bootstrap_options => {
       :key_name => 'Test-Key',
       :instance_type => 'c3.2xlarge',
       :image_id => 'ami-e12a088b',
       :security_group_ids => 'sg-xxxxxxx',
       :subnet => 'subnet-84de8ef3',
       :associate_public_ip_address => true ,
       :iam_instance_profile => 'test'
}
  end

Any help appreciated.

p.s confirmed that winrm is running, firewall ports and security groups are open,

Many thanks
Mark


#2

Hey Mark -

Its super unclear, but you need to specify winrm_username and winrm_password at the same level as the is_windows option.

machine "console-test" do
  machine_options is_windows: true,
    winrm_username: "Administrator",
    winrm_password: "xxxxxxxx",
    ...
end

I’ve updated the machine_options documentation with this information.

-Tyler