alibaba / packer-provider

Apache License 2.0
93 stars 26 forks source link

Setting windows password on new bare OS installs #52

Closed Marcus-James-Adams closed 5 years ago

Marcus-James-Adams commented 5 years ago

I want to use packer to create our own bare windows OS images that are windows_updated and have other (specific to us) core software installed.

If I'm reading the docs correctly I need to set the password field to a value and then use that password in my winrm communicator. When I try and launch using the below script as an example I get the following error

"variables": { "build_version": "{{env WIN_BUILD}}", "image_name": "BaseWindowsServer2012-V{{env WIN_BUILD}}", "packer_timestamp" :"{{timestamp}}", "winrm_username": "{{env WINRM_user}}", "winrm_password": "{{env WINRM_password}}", "ALI_access_key": "{{env ALICLOUD_ACCESS_KEY}}", "ALI_secret_key": "{{env ALICLOUD_SECRET_KEY}}", "source_image": "win2012r2_64_dtc_17196_en-us_40G_alibase_20170915.vhd" }, "builders" :[ { "name": "alicloud.eu-central-1.ecs.gn5-c4g1.xlarge", "type":"alicloud-ecs", "access_key":"{{user ALI_access_key}}", "secret_key":"{{user ALI_secret_key}}", "region":"eu-central-1", "vpc_id":"xxxxxx",
"vswitch_id":"xxxxx", "security_group_id":"xxxxxx", "instance_type":"ecs.gn5-c4g1.xlarge", "instancename": "PACKER{{user image_name}}_v{{user build_version}}_{{buildname}}{{user packer_timestamp}}",
"internet_charge_type":"PayByTraffic", "internet_max_bandwidth_out": "100", "source_image":"{{user source_image}}", "password":"{{user winrm_password}}", "imagename":"packer{{user image_name}}_{{user region}}", "image_description":"Built for use on YellowDog systems", "image_version":"v{{user build_version}}", "image_ignore_data_disks":"true", "io_optimized":"true", "image_force_delete":"true", "communicator": "winrm",
"winrm_username": "{{user winrm_username}}", "winrm_password": "{{user winrm_password}}", "winrm_timeout": "24h", "winrm_use_ssl": false, "winrm_insecure": true
} ],

chhaj5236 commented 5 years ago

@Marcus-James-Adams You only need to set winrm_password option and set winrm_username to Administrator. password is not a valid option.