Skip to content

Commit 3571af2

Browse files
committed
manual sc2 build seems to work
1 parent 682404d commit 3571af2

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

ansible/tasks/update_host_kernel.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,33 @@
66
dest: "/tmp/linux-image.deb"
77
mode: '0644'
88

9-
# Step 2: Install the .deb kernel package
109
- name: "Install the new kernel package"
1110
become: true
1211
apt:
1312
deb: "/tmp/linux-image.deb"
1413
state: present
1514

16-
# Step 3: Update the grub configuration to use the new kernel
17-
- name: "Update GRUB to use the new kernel"
15+
- name: "Update GRUB to pick up the newly installed kernel"
1816
become: true
1917
command: update-grub
2018

21-
# Step 4: Reboot the system to load the new kernel
19+
- name: "List all installed kernels"
20+
shell: dpkg --list | grep linux-image
21+
register: installed_kernels
22+
23+
# You can see the different options by running `dpkg --list | grep linux-image`
24+
- name: "Set the default kernel in GRUB"
25+
become: true
26+
lineinfile:
27+
path: /etc/default/grub
28+
regexp: '^GRUB_DEFAULT='
29+
line: 'GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-rc5-next-20240221-snp-host-2cfe07293708"'
30+
31+
- name: "Update GRUB configuration again to pick up new changes"
32+
become: true
33+
command: update-grub
34+
when: installed_kernels is changed
35+
2236
- name: "Reboot the system to apply the new kernel"
2337
become: true
2438
reboot:

ansible/vm.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
gather_facts: yes
55
tasks:
66
- include_tasks: tasks/apt.yaml
7-
# - include_tasks: tasks/update_host_kernel.yaml
7+
- include_tasks: tasks/update_host_kernel.yaml
88
- include_tasks: tasks/rust.yaml
99
- include_tasks: tasks/docker.yaml
1010
- include_tasks: tasks/code.yaml
1111
- include_tasks: tasks/pull_images.yaml
12-
# - include_tasks: tasks/sc2.yml
12+
- include_tasks: tasks/sc2.yml

tasks/azure.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"/CommunityGalleries/cocopreview-91c44057-c3ab-4652-bf00-9242d5a90170/"
1818
"Images/ubu2204-snp-host-upm/Versions/latest"
1919
)
20-
# AZURE_SNP_VM_IMAGE = "/CommunityGalleries/cocopreview-91c44057-c3ab-4652-bf00-9242d5a90170/Images/ubu2204-snp-host-upm/Versions/latest"
2120
AZURE_SNP_VM_LOCATION = "eastus"
2221
AZURE_SNP_VM_OS_DISK_SIZE = 64
2322
AZURE_SNP_VM_SSH_PRIV_KEY = "~/.ssh/id_rsa"
@@ -98,11 +97,7 @@ def delete_resources(resources):
9897
to_delete = [r for r in resources if r["type"] == t]
9998

10099
if to_delete:
101-
print(
102-
"Prioritising {} resources of type {}".format(
103-
len(to_delete), t
104-
)
105-
)
100+
print("Prioritising {} resources of type {}".format(len(to_delete), t))
106101

107102
for r in to_delete:
108103
delete_resource(r["name"], r["type"])
@@ -123,6 +118,7 @@ def list_all(azure_cmd, prefix=None):
123118

124119
return res
125120

121+
126122
# -----------------------------------------------------------------------------
127123
# Ansible functions
128124
# -----------------------------------------------------------------------------
@@ -153,7 +149,11 @@ def ansible_prepare_inventory(prefix):
153149
lines = ["[all]"]
154150
for v in all_vms:
155151
# Include VM name for debugging purposes
156-
lines.append("{} ansible_host={} ansible_user={}".format(v["name"], v["public_ip"], AZURE_SNP_VM_ADMIN))
152+
lines.append(
153+
"{} ansible_host={} ansible_user={}".format(
154+
v["name"], v["public_ip"], AZURE_SNP_VM_ADMIN
155+
)
156+
)
157157

158158
file_content = "\n".join(lines)
159159

@@ -164,6 +164,7 @@ def ansible_prepare_inventory(prefix):
164164
fh.write(file_content)
165165
fh.write("\n")
166166

167+
167168
# -----------------------------------------------------------------------------
168169
# Entrypoint tasks
169170
# -----------------------------------------------------------------------------
@@ -186,11 +187,15 @@ def deploy(ctx):
186187

187188

188189
@task
189-
def setup(ctx, vm_name = "sc2-snp-test"):
190+
def setup(ctx, vm_name="sc2-snp-test"):
190191
ansible_prepare_inventory(vm_name)
191192

192193
vm_playbook = join(ANSIBLE_ROOT, "vm.yaml")
193-
run(f"ansible-playbook -i {ANSIBLE_INVENTORY_FILE} {vm_playbook}", shell=True, check=True)
194+
run(
195+
f"ansible-playbook -i {ANSIBLE_INVENTORY_FILE} {vm_playbook}",
196+
shell=True,
197+
check=True,
198+
)
194199

195200

196201
@task

0 commit comments

Comments
 (0)