Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the host name from custom image #173

Open
wilhelmi opened this issue Jun 13, 2019 · 2 comments
Open

Setting the host name from custom image #173

wilhelmi opened this issue Jun 13, 2019 · 2 comments

Comments

@wilhelmi
Copy link

Have some windows server 2016 images pre-built from Packer/Chef, based on the stock GCE base images. We are then deploying new GCE instances from the custom images. The problem we are seeing is that instance_setup.ps1 doesn't appear to run for the new instances, thus the hostname doesn't get properly set, it gets left as the name of the instance during creation.

Is there a pattern to solve this effectively short of copying the hostname resetting code to a custom startup script?

@zmarano
Copy link
Contributor

zmarano commented Jun 17, 2019

This is most likely due to Packer's process in which the first boot already happened. In the normal case, instance setup will happen on first boot with sysprep. You can run gcesysprep at the end of your process to reset the state (https://github.com/GoogleCloudPlatform/compute-image-windows/blob/master/sysprep/gcesysprep.bat) so that the resulting image will then run initial setup correctly.

@sorenhansendk
Copy link

Hi @wilhelmi

We have solved the problem with an restart just before GCESysprep

{
    "type": "windows-restart",
    "restart_timeout": "15m"
},
{
    "type": "powershell",
    "inline": ["GCESysprep"]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants