Skip to content

[Draft] Try to address the cloudbase init running order #1719

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export AZURE_LOCATION="uksouth"
export AZURE_CLIENT_ID="aa0caef4-31da-4426-9908-f75af27075c8"
export AZURE_SUBSCRIPTION_ID="1c8c4edc-b188-4199-9580-3173033d75f7"
export USE_AZURE_CLI_AUTH=true
Comment on lines +1 to +4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you prob want to remove this file from the draft :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@
src: templates/cloudbase-init.conf
dest: "{{ programfiles.stdout | trim }}\\Cloudbase Solutions\\Cloudbase-Init\\conf\\cloudbase-init.conf"

- name: Configure set up complete
- name: Configure Cloudbase-Init to run on startup
ansible.windows.win_shell: |
# If this file already exists then the following command fails
Remove-Item -Force {{ systemdrive.stdout | trim }}\Windows\Setup\Scripts\SetupComplete.cmd
& "{{ programfiles.stdout | trim }}\Cloudbase Solutions\Cloudbase-Init\bin\SetSetupComplete.cmd"
cmd /c sc config cloudbase-init depend= WindowsAzureGuestAgent start= auto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the impact of this on non-Azure systems or providers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @laozc

become: true
become_method: runas
become_user: System
20 changes: 11 additions & 9 deletions images/capi/packer/azure/scripts/sysprep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ if( Test-Path $Env:SystemRoot\system32\Sysprep\unattend.xml ) {
Remove-Item $Env:SystemRoot\system32\Sysprep\unattend.xml -Force
}

$unattendedXml = "$ENV:ProgramFiles\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removal of this might break things. Might want to confirm this change

$FileExists = Test-Path $unattendedXml
If ($FileExists -eq $True) {
# Use the Cloudbase-init provided unattend file during install
Write-Output "Using cloudbase-init unattend file for sysprep: $unattendedXml"
& $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /mode:vm /quit /quiet /unattend:$unattendedXml
}else {
& $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /mode:vm /quit /quiet
}
& $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /mode:vm /quit /quiet

# $unattendedXml = "$ENV:ProgramFiles\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml"
# $FileExists = Test-Path $unattendedXml
# If ($FileExists -eq $True) {
# # Use the Cloudbase-init provided unattend file during install
# Write-Output "Using cloudbase-init unattend file for sysprep: $unattendedXml"
# & $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /mode:vm /quit /quiet /unattend:$unattendedXml
# }else {
# & $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /mode:vm /quit /quiet
# }

# Wait for the image to be reset
while($true) {
Expand Down
3 changes: 1 addition & 2 deletions images/capi/packer/goss/goss-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,7 @@ windows:
common-windows-service:
cloudbase-init:
expected:
- Manual
- Stopped
- Automatic
kubelet:
expected:
- Automatic
Expand Down